diff --git a/READMEvc2010.txt b/READMEvc2010.txt new file mode 100644 index 0000000000000000000000000000000000000000..692fe86ea35ff29d461d8efdc4abea1682d85632 --- /dev/null +++ b/READMEvc2010.txt @@ -0,0 +1,12 @@ + +For use of qt 4x and visual studio2010 and add in. + +The Visual studio adds automatically certain defines + +In the projects properties -> C/C++ ->preprocessor change: + +in DEBUG: + delete QT_NO_DEBUG + +Both: + delete QT_NO_DYNAMIC_CAST diff --git a/copydebug.txt b/copydebug.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf3586abfffaf602b612933341dc8fac2a712b1d --- /dev/null +++ b/copydebug.txt @@ -0,0 +1,2 @@ +designer +.lib diff --git a/copyrelease.txt b/copyrelease.txt new file mode 100644 index 0000000000000000000000000000000000000000..6dd9ecb0e5bc26942c795e92181ddc6a82262d10 --- /dev/null +++ b/copyrelease.txt @@ -0,0 +1,4 @@ +designer +.lib +.pdb +d4.dll \ No newline at end of file diff --git a/lib/QMapControl/COPYING b/lib/QMapControl/COPYING deleted file mode 100644 index 5b6e7c66c276e7610d4a73c70ec1a1f7c1003259..0000000000000000000000000000000000000000 --- a/lib/QMapControl/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, 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 or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -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 give any other recipients of the Program a copy of this License -along with the Program. - -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. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -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 Program, 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 Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) 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; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, 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 executable. However, as a -special exception, the source code 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. - -If distribution of executable or 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 counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program 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. - - 5. 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 Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program 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 to -this License. - - 7. 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 Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program 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 Program. - -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. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program 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. - - 9. The Free Software Foundation may publish revised and/or new versions -of the 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 Program -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 Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, 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 - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. 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. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/lib/QMapControl/COPYING.LESSER b/lib/QMapControl/COPYING.LESSER deleted file mode 100644 index 853047cf8990fd015ac0ef29e45aee9256d66818..0000000000000000000000000000000000000000 --- a/lib/QMapControl/COPYING.LESSER +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - 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 that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU 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 as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/lib/QMapControl/Doxyfile b/lib/QMapControl/Doxyfile deleted file mode 100644 index 7c7fbf58ba6165866d5108ef0804d7f1c38dcd74..0000000000000000000000000000000000000000 --- a/lib/QMapControl/Doxyfile +++ /dev/null @@ -1,1528 +0,0 @@ -# Doxyfile 1.5.9 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = QMapControl - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 0.9.5.2 - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = YES - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = . - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it parses. -# With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this tag. -# The format is ext=language, where ext is a file extension, and language is one of -# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, -# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat -# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), -# use: inc=Fortran f=C. Note that for custom extensions you also need to set -# FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will rougly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = YES - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = YES - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = YES - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = YES - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 26 - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = NO - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by -# doxygen. The layout file controls the global structure of the generated output files -# in an output format independent way. The create the layout file that represents -# doxygen's defaults, run doxygen with the -l option. You can optionally specify a -# file name after the option, if omitted DoxygenLayout.xml will be used as the name -# of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = NO - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = . - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.cpp \ - *.h - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = ./src/layermanager.cpp \ - ./src/layermanager.h \ - ./src/imagemanager.h \ - ./Samples/Mapviewer/src/mapviewer.h \ - ./Samples/Multidemo/src/gps_modul.cpp \ - ./Samples/Multidemo/src/gps_modul.h \ - ./Samples/Multidemo/src/multidemo.h \ - ./Samples/GPS/src/gps_neo.cpp \ - ./Samples/GPS/src/gps_neo.h \ - ./Samples/Citymap/src/citymap.h \ - ./Samples/Citymap/src/dialogs.h \ - ./Samples/Citymap/src/dialogs.cpp \ - ./Samples/Phonebook/src/phonebook.h \ - ./Samples/LinesAndPoints/src/linesandpoints.h - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = QDumper \ - GPS_Position - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = ./Samples - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = YES - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = ./images - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER -# are set, an additional index file will be generated that can be used as input for -# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated -# HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. -# For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's -# filter section matches. -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to FRAME, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. Other possible values -# for this tag are: HIERARCHIES, which will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list; -# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which -# disables this behavior completely. For backwards compatibility with previous -# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE -# respectively. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = QMapControl.tag - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = NO - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = NO - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 1000 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = YES - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = NO - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Options related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/lib/QMapControl/QMapControl.kdevelop b/lib/QMapControl/QMapControl.kdevelop deleted file mode 100644 index 18e0c2c799921979e1f2dbf8cff351cd20e1b85b..0000000000000000000000000000000000000000 --- a/lib/QMapControl/QMapControl.kdevelop +++ /dev/null @@ -1,193 +0,0 @@ - - - - Kai Winter - kaiwinter@gmx.de - 1 - KDevTrollProject - C++ - - Qt - - QMapControl - - src - false - - - - - - - - - - false - false - - - *.o,*.lo,CVS - false - - - - - bash - bash_bugs - clanlib - w3c-dom-level2-html - fortran_bugs_gcc - gnome1 - gnustep - gtk - gtk_bugs - haskell - haskell_bugs_ghc - java_bugs_gcc - java_bugs_sun - kde2book - opengl - pascal_bugs_fp - php - php_bugs - perl - perl_bugs - python - python_bugs - qt-kdev3 - ruby - ruby_bugs - sdl - stl - w3c-svg - sw - w3c-uaag10 - wxwidgets_bugs - - - KDE Libraries (Doxygen) - - - - - - - - - - true - false - false - false - - - false - true - 10 - - - - - 4 - true - 4 - ExternalDesigner - /usr/lib/qt4 - /usr/lib/qt4/bin/qmake-qt4 - /usr/lib/qt4/bin/designer-qt4 - - - - false - true - true - 250 - 400 - 250 - false - 0 - true - true - false - std=_GLIBCXX_STD;__gnu_cxx=std - true - false - false - false - false - true - true - false - .; - - - - set - m_,_ - theValue - true - true - - - false - true - Vertical - - - Qt4 - - - - - - - - - - - - - - - - - executable - . - - - . - true - false - false - false - false - - - - true - false - 1 - false - - 0 - - - - 2 - false - true - false - - - - - .h - .cpp - - - - - . - - - diff --git a/lib/QMapControl/QMapControl.kdevelop.pcs b/lib/QMapControl/QMapControl.kdevelop.pcs deleted file mode 100644 index 5cb7aa495a013cfa0ca17e3b068303ba10ed7798..0000000000000000000000000000000000000000 Binary files a/lib/QMapControl/QMapControl.kdevelop.pcs and /dev/null differ diff --git a/lib/QMapControl/QMapControl.kdevses b/lib/QMapControl/QMapControl.kdevses deleted file mode 100644 index 85754123d1c644c12d400eb6db6d983b1ae71d07..0000000000000000000000000000000000000000 --- a/lib/QMapControl/QMapControl.kdevses +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/QMapControl/QMapControl.pri b/lib/QMapControl/QMapControl.pri deleted file mode 100644 index 3fd297718324eb24d2b30daead89d8be32fee171..0000000000000000000000000000000000000000 --- a/lib/QMapControl/QMapControl.pri +++ /dev/null @@ -1,52 +0,0 @@ -DEPENDPATH += src -INCLUDEPATH += src - -# Input -HEADERS += curve.h \ - geometry.h \ - imagemanager.h \ - layer.h \ - layermanager.h \ - linestring.h \ - mapadapter.h \ - mapcontrol.h \ - mapnetwork.h \ - point.h \ - tilemapadapter.h \ - wmsmapadapter.h \ - circlepoint.h \ - imagepoint.h \ - gps_position.h \ - osmmapadapter.h \ - maplayer.h \ - geometrylayer.h \ - yahoomapadapter.h \ - googlemapadapter.h \ - googlesatmapadapter.h \ - openaerialmapadapter.h \ - fixedimageoverlay.h \ - emptymapadapter.h -SOURCES += curve.cpp \ - geometry.cpp \ - imagemanager.cpp \ - layer.cpp \ - layermanager.cpp \ - linestring.cpp \ - mapadapter.cpp \ - mapcontrol.cpp \ - mapnetwork.cpp \ - point.cpp \ - tilemapadapter.cpp \ - wmsmapadapter.cpp \ - circlepoint.cpp \ - imagepoint.cpp \ - gps_position.cpp \ - osmmapadapter.cpp \ - maplayer.cpp \ - geometrylayer.cpp \ - yahoomapadapter.cpp \ - googlemapadapter.cpp \ - googlesatmapadapter.cpp \ - openaerialmapadapter.cpp \ - fixedimageoverlay.cpp \ - emptymapadapter.cpp diff --git a/lib/QMapControl/QMapControl.pro b/lib/QMapControl/QMapControl.pro deleted file mode 100644 index 860fb6b67e89826723573126503d40793a5731af..0000000000000000000000000000000000000000 --- a/lib/QMapControl/QMapControl.pro +++ /dev/null @@ -1,6 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Thu Nov 22 09:50:33 2007 -###################################################################### - -TEMPLATE = subdirs -SUBDIRS += Samples \ No newline at end of file diff --git a/lib/QMapControl/QMapControl.tag b/lib/QMapControl/QMapControl.tag deleted file mode 100644 index af7272cd27bb25f61ceeee92862aac1ad1554592..0000000000000000000000000000000000000000 --- a/lib/QMapControl/QMapControl.tag +++ /dev/null @@ -1,2216 +0,0 @@ - - - - qmapcontrol - namespaceqmapcontrol.html - qmapcontrol::CirclePoint - qmapcontrol::Curve - qmapcontrol::EmptyMapAdapter - qmapcontrol::FixedImageOverlay - qmapcontrol::Geometry - qmapcontrol::GeometryLayer - qmapcontrol::GoogleMapAdapter - qmapcontrol::GoogleSatMapAdapter - qmapcontrol::GPS_Position - qmapcontrol::ImagePoint - qmapcontrol::Layer - qmapcontrol::LineString - qmapcontrol::MapAdapter - qmapcontrol::MapControl - qmapcontrol::MapLayer - qmapcontrol::MapNetwork - qmapcontrol::OpenAerialMapAdapter - qmapcontrol::OSMMapAdapter - qmapcontrol::Point - qmapcontrol::TileMapAdapter - qmapcontrol::WMSMapAdapter - qmapcontrol::YahooMapAdapter - - - qmapcontrol::CirclePoint - classqmapcontrol_1_1CirclePoint.html - qmapcontrol::Point - - Alignment - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d7982726 - - - - TopLeft - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d798272661f66ddc6702462a94d3e231f02b9017 - - - - TopRight - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d79827267e42a96f07eab63a8c9fa8a0526f34f4 - - - - BottomLeft - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d7982726e61b9b6ea2fa75ca500d5bb1eaf6f6fc - - - - BottomRight - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d79827261640f649d644701a2f4633e6bd88b20c - - - - Middle - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d7982726673e6efef9aafe98078c5552e99c923c - - - - virtual void - setVisible - classqmapcontrol_1_1Point.html - 18e44e30b31525a243960ca3928125aa - (bool visible) - - - void - geometryClicked - classqmapcontrol_1_1Geometry.html - 685dcab83356e5cc449475f177bb487d - (Geometry *geometry, QPoint point) - - - void - positionChanged - classqmapcontrol_1_1Geometry.html - 807f9cfb1b9d680ca76cf825cc9cf46a - (Geometry *geom) - - - virtual QRectF - boundingBox - classqmapcontrol_1_1Point.html - cbb256b5f9f888e9cd3bb475108ece24 - () - - - - CirclePoint - classqmapcontrol_1_1CirclePoint.html - 13300765d52da11cc8cbb4384e8e9e23 - (qreal x, qreal y, int radius=10, QString name=QString(), Alignment alignment=Middle, QPen *pen=0) - - - - CirclePoint - classqmapcontrol_1_1CirclePoint.html - a0dd3496708e507c8185d5ae5f5e79ad - (qreal x, qreal y, QString name=QString(), Alignment alignment=Middle, QPen *pen=0) - - - QPointF - coordinate - classqmapcontrol_1_1Point.html - 2fbb44b2ed047287d715484d2fda7299 - () const - - - bool - Equals - classqmapcontrol_1_1Geometry.html - 029a8b50c439c719aac173bffe4cfb71 - (Geometry *geom) - - - bool - isVisible - classqmapcontrol_1_1Geometry.html - 08422ee75ab02691943c1ca87e2bc563 - () const - - - qreal - latitude - classqmapcontrol_1_1Point.html - 6311aabecac471455760aae4790cff91 - () const - - - qreal - longitude - classqmapcontrol_1_1Point.html - 2b0f7ec9068af09bcf151af61a785845 - () const - - - QString - name - classqmapcontrol_1_1Geometry.html - 2b0a198f837184bf6fff555cee3ce770 - () const - - - Geometry * - parentGeometry - classqmapcontrol_1_1Geometry.html - 771cc513dc079219d5da2c4b81019d7c - () const - - - QPen * - pen - classqmapcontrol_1_1Geometry.html - ed7be2fcd2c1d7bccb55f5ac73d7a662 - () const - - - QPixmap * - pixmap - classqmapcontrol_1_1Point.html - 166d4272301d85cc53e114ce4d26caf5 - () - - - void - setBaselevel - classqmapcontrol_1_1Point.html - 91f1496833bfda9f7a7ec5fcb02a1895 - (int zoomlevel) - - - void - setMaxsize - classqmapcontrol_1_1Point.html - dc2724c4e195727b823ff55c940283de - (QSize maxsize) - - - void - setMinsize - classqmapcontrol_1_1Point.html - c40b3e44f54fab1330b9309ac7bd84d2 - (QSize minsize) - - - void - setName - classqmapcontrol_1_1Geometry.html - 6220fae15759fd0fa7d75e415df34e83 - (QString name) - - - virtual void - setPen - classqmapcontrol_1_1CirclePoint.html - a92f0f1b5d2fd424196a33012ffe8ea1 - (QPen *pen) - - - QString - toString - classqmapcontrol_1_1Geometry.html - 3a013a6edb6d10a71297978bc31a796b - () - - - QWidget * - widget - classqmapcontrol_1_1Point.html - d1eaabeb2b227cd055ccf4b4e2818480 - () - - - virtual bool - Touches - classqmapcontrol_1_1Point.html - 73504541bf9e21ceceb82c6b4c3f2b04 - (Point *geom, const MapAdapter *mapadapter) - - - - qmapcontrol::Curve - classqmapcontrol_1_1Curve.html - qmapcontrol::Geometry - - virtual void - setVisible - classqmapcontrol_1_1Geometry.html - 18e44e30b31525a243960ca3928125aa - (bool visible) - - - void - geometryClicked - classqmapcontrol_1_1Geometry.html - 685dcab83356e5cc449475f177bb487d - (Geometry *geometry, QPoint point) - - - void - positionChanged - classqmapcontrol_1_1Geometry.html - 807f9cfb1b9d680ca76cf825cc9cf46a - (Geometry *geom) - - - virtual QRectF - boundingBox - classqmapcontrol_1_1Geometry.html - f92c4fa46f711bea92efe5ab80f9084d - ()=0 - - - bool - Equals - classqmapcontrol_1_1Geometry.html - 029a8b50c439c719aac173bffe4cfb71 - (Geometry *geom) - - - bool - isVisible - classqmapcontrol_1_1Geometry.html - 08422ee75ab02691943c1ca87e2bc563 - () const - - - QString - name - classqmapcontrol_1_1Geometry.html - 2b0a198f837184bf6fff555cee3ce770 - () const - - - Geometry * - parentGeometry - classqmapcontrol_1_1Geometry.html - 771cc513dc079219d5da2c4b81019d7c - () const - - - QPen * - pen - classqmapcontrol_1_1Geometry.html - ed7be2fcd2c1d7bccb55f5ac73d7a662 - () const - - - void - setName - classqmapcontrol_1_1Geometry.html - 6220fae15759fd0fa7d75e415df34e83 - (QString name) - - - QString - toString - classqmapcontrol_1_1Geometry.html - 3a013a6edb6d10a71297978bc31a796b - () - - - - qmapcontrol::EmptyMapAdapter - classqmapcontrol_1_1EmptyMapAdapter.html - qmapcontrol::MapAdapter - - virtual QPoint - coordinateToDisplay - classqmapcontrol_1_1EmptyMapAdapter.html - 94134b06e350d302f5b3a63f0016aa60 - (const QPointF &) const - - - int - currentZoom - classqmapcontrol_1_1MapAdapter.html - 8c7b803b9faa35db237e40c361e1c036 - () const - - - virtual QPointF - displayToCoordinate - classqmapcontrol_1_1EmptyMapAdapter.html - 601b4631d9d891eabffb063c510cc088 - (const QPoint &) const - - - - EmptyMapAdapter - classqmapcontrol_1_1EmptyMapAdapter.html - 9208e1a9da209564f85a50318cda7310 - (int tileSize=256, int minZoom=0, int maxZoom=17) - - - QString - host - classqmapcontrol_1_1MapAdapter.html - 7ee8388c7880d8a3466967464f5034b6 - () const - - - int - maxZoom - classqmapcontrol_1_1MapAdapter.html - 3a33e897bc474405772d17a7c81f8747 - () const - - - int - minZoom - classqmapcontrol_1_1MapAdapter.html - 7457f51db57914a85bbefcc8c9fa97b4 - () const - - - int - tilesize - classqmapcontrol_1_1MapAdapter.html - f105c5a0cf588a3f60d67744bd353391 - () const - - - - qmapcontrol::FixedImageOverlay - classqmapcontrol_1_1FixedImageOverlay.html - qmapcontrol::ImagePoint - - Alignment - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d7982726 - - - - TopLeft - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d798272661f66ddc6702462a94d3e231f02b9017 - - - - TopRight - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d79827267e42a96f07eab63a8c9fa8a0526f34f4 - - - - BottomLeft - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d7982726e61b9b6ea2fa75ca500d5bb1eaf6f6fc - - - - BottomRight - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d79827261640f649d644701a2f4633e6bd88b20c - - - - Middle - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d7982726673e6efef9aafe98078c5552e99c923c - - - - virtual void - setVisible - classqmapcontrol_1_1Point.html - 18e44e30b31525a243960ca3928125aa - (bool visible) - - - void - geometryClicked - classqmapcontrol_1_1Geometry.html - 685dcab83356e5cc449475f177bb487d - (Geometry *geometry, QPoint point) - - - void - positionChanged - classqmapcontrol_1_1Geometry.html - 807f9cfb1b9d680ca76cf825cc9cf46a - (Geometry *geom) - - - virtual QRectF - boundingBox - classqmapcontrol_1_1Point.html - cbb256b5f9f888e9cd3bb475108ece24 - () - - - QPointF - coordinate - classqmapcontrol_1_1Point.html - 2fbb44b2ed047287d715484d2fda7299 - () const - - - bool - Equals - classqmapcontrol_1_1Geometry.html - 029a8b50c439c719aac173bffe4cfb71 - (Geometry *geom) - - - - FixedImageOverlay - classqmapcontrol_1_1FixedImageOverlay.html - a3cc273119f113f1ba255315b9327d0e - (qreal x_upperleft, qreal y_upperleft, qreal x_lowerright, qreal y_lowerright, QPixmap *pixmap, QString name=QString()) - - - - FixedImageOverlay - classqmapcontrol_1_1FixedImageOverlay.html - 621806ec022f1b35a2383b64787a5827 - (qreal x_upperleft, qreal y_upperleft, qreal x_lowerright, qreal y_lowerright, QString filename, QString name=QString()) - - - bool - isVisible - classqmapcontrol_1_1Geometry.html - 08422ee75ab02691943c1ca87e2bc563 - () const - - - qreal - latitude - classqmapcontrol_1_1Point.html - 6311aabecac471455760aae4790cff91 - () const - - - qreal - longitude - classqmapcontrol_1_1Point.html - 2b0f7ec9068af09bcf151af61a785845 - () const - - - QString - name - classqmapcontrol_1_1Geometry.html - 2b0a198f837184bf6fff555cee3ce770 - () const - - - Geometry * - parentGeometry - classqmapcontrol_1_1Geometry.html - 771cc513dc079219d5da2c4b81019d7c - () const - - - QPen * - pen - classqmapcontrol_1_1Geometry.html - ed7be2fcd2c1d7bccb55f5ac73d7a662 - () const - - - QPixmap * - pixmap - classqmapcontrol_1_1Point.html - 166d4272301d85cc53e114ce4d26caf5 - () - - - void - setBaselevel - classqmapcontrol_1_1Point.html - 91f1496833bfda9f7a7ec5fcb02a1895 - (int zoomlevel) - - - void - setMaxsize - classqmapcontrol_1_1Point.html - dc2724c4e195727b823ff55c940283de - (QSize maxsize) - - - void - setMinsize - classqmapcontrol_1_1Point.html - c40b3e44f54fab1330b9309ac7bd84d2 - (QSize minsize) - - - void - setName - classqmapcontrol_1_1Geometry.html - 6220fae15759fd0fa7d75e415df34e83 - (QString name) - - - QString - toString - classqmapcontrol_1_1Geometry.html - 3a013a6edb6d10a71297978bc31a796b - () - - - QWidget * - widget - classqmapcontrol_1_1Point.html - d1eaabeb2b227cd055ccf4b4e2818480 - () - - - virtual bool - Touches - classqmapcontrol_1_1Point.html - 73504541bf9e21ceceb82c6b4c3f2b04 - (Point *geom, const MapAdapter *mapadapter) - - - - qmapcontrol::Geometry - classqmapcontrol_1_1Geometry.html - - virtual void - setVisible - classqmapcontrol_1_1Geometry.html - 18e44e30b31525a243960ca3928125aa - (bool visible) - - - void - geometryClicked - classqmapcontrol_1_1Geometry.html - 685dcab83356e5cc449475f177bb487d - (Geometry *geometry, QPoint point) - - - void - positionChanged - classqmapcontrol_1_1Geometry.html - 807f9cfb1b9d680ca76cf825cc9cf46a - (Geometry *geom) - - - virtual QRectF - boundingBox - classqmapcontrol_1_1Geometry.html - f92c4fa46f711bea92efe5ab80f9084d - ()=0 - - - bool - Equals - classqmapcontrol_1_1Geometry.html - 029a8b50c439c719aac173bffe4cfb71 - (Geometry *geom) - - - bool - isVisible - classqmapcontrol_1_1Geometry.html - 08422ee75ab02691943c1ca87e2bc563 - () const - - - QString - name - classqmapcontrol_1_1Geometry.html - 2b0a198f837184bf6fff555cee3ce770 - () const - - - Geometry * - parentGeometry - classqmapcontrol_1_1Geometry.html - 771cc513dc079219d5da2c4b81019d7c - () const - - - QPen * - pen - classqmapcontrol_1_1Geometry.html - ed7be2fcd2c1d7bccb55f5ac73d7a662 - () const - - - void - setName - classqmapcontrol_1_1Geometry.html - 6220fae15759fd0fa7d75e415df34e83 - (QString name) - - - QString - toString - classqmapcontrol_1_1Geometry.html - 3a013a6edb6d10a71297978bc31a796b - () - - - - qmapcontrol::GeometryLayer - classqmapcontrol_1_1GeometryLayer.html - qmapcontrol::Layer - - LayerType - classqmapcontrol_1_1Layer.html - 56943a0946e5f15e5e58054b8e7a04a4 - - - - MapLayer - classqmapcontrol_1_1Layer.html - 56943a0946e5f15e5e58054b8e7a04a4fe7df421203e4175d260b8dabcbe3002 - - - - GeometryLayer - classqmapcontrol_1_1Layer.html - 56943a0946e5f15e5e58054b8e7a04a46c04bd58c42df8a7539aba782503fee0 - - - - void - setVisible - classqmapcontrol_1_1Layer.html - 18e44e30b31525a243960ca3928125aa - (bool visible) - - - void - geometryClicked - classqmapcontrol_1_1Layer.html - 685dcab83356e5cc449475f177bb487d - (Geometry *geometry, QPoint point) - - - void - addGeometry - classqmapcontrol_1_1Layer.html - b692d7d08414ed2b744946b88872827f - (Geometry *geometry) - - - void - clearGeometries - classqmapcontrol_1_1Layer.html - 0b551ef8f4d0fd26cfa2ed0ec4c981b3 - () - - - - GeometryLayer - classqmapcontrol_1_1GeometryLayer.html - 64e2ab047db14f0d86424bee947c94af - (QString layername, MapAdapter *mapadapter, bool takeevents=true) - - - bool - isVisible - classqmapcontrol_1_1Layer.html - 08422ee75ab02691943c1ca87e2bc563 - () const - - - QString - layername - classqmapcontrol_1_1Layer.html - 414e94fdd70490d75ddccb6923ae3410 - () const - - - Layer::LayerType - layertype - classqmapcontrol_1_1Layer.html - 1cfbd8a5c27cf9cb400fa458a1f70ba5 - () const - - - const MapAdapter * - mapadapter - classqmapcontrol_1_1Layer.html - 23cb6462136a0920739cdeb5f1709fa7 - () const - - - void - removeGeometry - classqmapcontrol_1_1Layer.html - b34ffa138d7262b801cdfedaf4a129d3 - (Geometry *geometry) - - - - qmapcontrol::GoogleMapAdapter - classqmapcontrol_1_1GoogleMapAdapter.html - qmapcontrol::TileMapAdapter - - virtual QPoint - coordinateToDisplay - classqmapcontrol_1_1TileMapAdapter.html - 94134b06e350d302f5b3a63f0016aa60 - (const QPointF &) const - - - int - currentZoom - classqmapcontrol_1_1MapAdapter.html - 8c7b803b9faa35db237e40c361e1c036 - () const - - - virtual QPointF - displayToCoordinate - classqmapcontrol_1_1TileMapAdapter.html - 601b4631d9d891eabffb063c510cc088 - (const QPoint &) const - - - - GoogleMapAdapter - classqmapcontrol_1_1GoogleMapAdapter.html - cce53053ca2cbe6b91836ee24fc98b22 - () - - - QString - host - classqmapcontrol_1_1MapAdapter.html - 7ee8388c7880d8a3466967464f5034b6 - () const - - - int - maxZoom - classqmapcontrol_1_1MapAdapter.html - 3a33e897bc474405772d17a7c81f8747 - () const - - - int - minZoom - classqmapcontrol_1_1MapAdapter.html - 7457f51db57914a85bbefcc8c9fa97b4 - () const - - - int - tilesize - classqmapcontrol_1_1MapAdapter.html - f105c5a0cf588a3f60d67744bd353391 - () const - - - - qmapcontrol::GoogleSatMapAdapter - classqmapcontrol_1_1GoogleSatMapAdapter.html - qmapcontrol::TileMapAdapter - - virtual QPoint - coordinateToDisplay - classqmapcontrol_1_1GoogleSatMapAdapter.html - 94134b06e350d302f5b3a63f0016aa60 - (const QPointF &) const - - - int - currentZoom - classqmapcontrol_1_1MapAdapter.html - 8c7b803b9faa35db237e40c361e1c036 - () const - - - virtual QPointF - displayToCoordinate - classqmapcontrol_1_1GoogleSatMapAdapter.html - 601b4631d9d891eabffb063c510cc088 - (const QPoint &) const - - - QString - getHost - classqmapcontrol_1_1GoogleSatMapAdapter.html - 47a82056e29973632b3f3323c1fa5e30 - () const - - - - GoogleSatMapAdapter - classqmapcontrol_1_1GoogleSatMapAdapter.html - 3f7fb833b8e1325d5164c88e07425b94 - () - - - QString - host - classqmapcontrol_1_1MapAdapter.html - 7ee8388c7880d8a3466967464f5034b6 - () const - - - int - maxZoom - classqmapcontrol_1_1MapAdapter.html - 3a33e897bc474405772d17a7c81f8747 - () const - - - int - minZoom - classqmapcontrol_1_1MapAdapter.html - 7457f51db57914a85bbefcc8c9fa97b4 - () const - - - int - tilesize - classqmapcontrol_1_1MapAdapter.html - f105c5a0cf588a3f60d67744bd353391 - () const - - - - qmapcontrol::ImagePoint - classqmapcontrol_1_1ImagePoint.html - qmapcontrol::Point - - Alignment - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d7982726 - - - - TopLeft - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d798272661f66ddc6702462a94d3e231f02b9017 - - - - TopRight - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d79827267e42a96f07eab63a8c9fa8a0526f34f4 - - - - BottomLeft - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d7982726e61b9b6ea2fa75ca500d5bb1eaf6f6fc - - - - BottomRight - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d79827261640f649d644701a2f4633e6bd88b20c - - - - Middle - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d7982726673e6efef9aafe98078c5552e99c923c - - - - virtual void - setVisible - classqmapcontrol_1_1Point.html - 18e44e30b31525a243960ca3928125aa - (bool visible) - - - void - geometryClicked - classqmapcontrol_1_1Geometry.html - 685dcab83356e5cc449475f177bb487d - (Geometry *geometry, QPoint point) - - - void - positionChanged - classqmapcontrol_1_1Geometry.html - 807f9cfb1b9d680ca76cf825cc9cf46a - (Geometry *geom) - - - virtual QRectF - boundingBox - classqmapcontrol_1_1Point.html - cbb256b5f9f888e9cd3bb475108ece24 - () - - - QPointF - coordinate - classqmapcontrol_1_1Point.html - 2fbb44b2ed047287d715484d2fda7299 - () const - - - bool - Equals - classqmapcontrol_1_1Geometry.html - 029a8b50c439c719aac173bffe4cfb71 - (Geometry *geom) - - - - ImagePoint - classqmapcontrol_1_1ImagePoint.html - 27a768be97d6147e8a7ac92f23ce4a48 - (qreal x, qreal y, QPixmap *pixmap, QString name=QString(), Alignment alignment=Middle) - - - - ImagePoint - classqmapcontrol_1_1ImagePoint.html - a5121dbb37cf1b8924a376e4c7edd728 - (qreal x, qreal y, QString filename, QString name=QString(), Alignment alignment=Middle) - - - bool - isVisible - classqmapcontrol_1_1Geometry.html - 08422ee75ab02691943c1ca87e2bc563 - () const - - - qreal - latitude - classqmapcontrol_1_1Point.html - 6311aabecac471455760aae4790cff91 - () const - - - qreal - longitude - classqmapcontrol_1_1Point.html - 2b0f7ec9068af09bcf151af61a785845 - () const - - - QString - name - classqmapcontrol_1_1Geometry.html - 2b0a198f837184bf6fff555cee3ce770 - () const - - - Geometry * - parentGeometry - classqmapcontrol_1_1Geometry.html - 771cc513dc079219d5da2c4b81019d7c - () const - - - QPen * - pen - classqmapcontrol_1_1Geometry.html - ed7be2fcd2c1d7bccb55f5ac73d7a662 - () const - - - QPixmap * - pixmap - classqmapcontrol_1_1Point.html - 166d4272301d85cc53e114ce4d26caf5 - () - - - void - setBaselevel - classqmapcontrol_1_1Point.html - 91f1496833bfda9f7a7ec5fcb02a1895 - (int zoomlevel) - - - void - setMaxsize - classqmapcontrol_1_1Point.html - dc2724c4e195727b823ff55c940283de - (QSize maxsize) - - - void - setMinsize - classqmapcontrol_1_1Point.html - c40b3e44f54fab1330b9309ac7bd84d2 - (QSize minsize) - - - void - setName - classqmapcontrol_1_1Geometry.html - 6220fae15759fd0fa7d75e415df34e83 - (QString name) - - - QString - toString - classqmapcontrol_1_1Geometry.html - 3a013a6edb6d10a71297978bc31a796b - () - - - QWidget * - widget - classqmapcontrol_1_1Point.html - d1eaabeb2b227cd055ccf4b4e2818480 - () - - - virtual bool - Touches - classqmapcontrol_1_1Point.html - 73504541bf9e21ceceb82c6b4c3f2b04 - (Point *geom, const MapAdapter *mapadapter) - - - - qmapcontrol::Layer - classqmapcontrol_1_1Layer.html - - LayerType - classqmapcontrol_1_1Layer.html - 56943a0946e5f15e5e58054b8e7a04a4 - - - - MapLayer - classqmapcontrol_1_1Layer.html - 56943a0946e5f15e5e58054b8e7a04a4fe7df421203e4175d260b8dabcbe3002 - - - - GeometryLayer - classqmapcontrol_1_1Layer.html - 56943a0946e5f15e5e58054b8e7a04a46c04bd58c42df8a7539aba782503fee0 - - - - void - setVisible - classqmapcontrol_1_1Layer.html - 18e44e30b31525a243960ca3928125aa - (bool visible) - - - void - geometryClicked - classqmapcontrol_1_1Layer.html - 685dcab83356e5cc449475f177bb487d - (Geometry *geometry, QPoint point) - - - void - addGeometry - classqmapcontrol_1_1Layer.html - b692d7d08414ed2b744946b88872827f - (Geometry *geometry) - - - void - clearGeometries - classqmapcontrol_1_1Layer.html - 0b551ef8f4d0fd26cfa2ed0ec4c981b3 - () - - - bool - isVisible - classqmapcontrol_1_1Layer.html - 08422ee75ab02691943c1ca87e2bc563 - () const - - - - Layer - classqmapcontrol_1_1Layer.html - 7ffb001076dc500ad13e523836bda23d - (QString layername, MapAdapter *mapadapter, enum LayerType layertype, bool takeevents=true) - - - QString - layername - classqmapcontrol_1_1Layer.html - 414e94fdd70490d75ddccb6923ae3410 - () const - - - Layer::LayerType - layertype - classqmapcontrol_1_1Layer.html - 1cfbd8a5c27cf9cb400fa458a1f70ba5 - () const - - - const MapAdapter * - mapadapter - classqmapcontrol_1_1Layer.html - 23cb6462136a0920739cdeb5f1709fa7 - () const - - - void - removeGeometry - classqmapcontrol_1_1Layer.html - b34ffa138d7262b801cdfedaf4a129d3 - (Geometry *geometry) - - - - qmapcontrol::LineString - classqmapcontrol_1_1LineString.html - qmapcontrol::Curve - - virtual void - setVisible - classqmapcontrol_1_1Geometry.html - 18e44e30b31525a243960ca3928125aa - (bool visible) - - - void - geometryClicked - classqmapcontrol_1_1Geometry.html - 685dcab83356e5cc449475f177bb487d - (Geometry *geometry, QPoint point) - - - void - positionChanged - classqmapcontrol_1_1Geometry.html - 807f9cfb1b9d680ca76cf825cc9cf46a - (Geometry *geom) - - - void - addPoint - classqmapcontrol_1_1LineString.html - 8694ab9a03b0ed4986c98ad727755f8a - (Point *point) - - - virtual QRectF - boundingBox - classqmapcontrol_1_1LineString.html - cbb256b5f9f888e9cd3bb475108ece24 - () - - - virtual QList< Geometry * > - clickedPoints - classqmapcontrol_1_1LineString.html - c1cdf207019e92f289e62e9abb5ba2c3 - () - - - bool - Equals - classqmapcontrol_1_1Geometry.html - 029a8b50c439c719aac173bffe4cfb71 - (Geometry *geom) - - - virtual bool - hasClickedPoints - classqmapcontrol_1_1LineString.html - 3f7357f0362b6bee75f8c8c623fb528e - () const - - - virtual bool - hasPoints - classqmapcontrol_1_1LineString.html - c3fc4ac8c80b5bf64c0bf095d7fde94b - () const - - - bool - isVisible - classqmapcontrol_1_1Geometry.html - 08422ee75ab02691943c1ca87e2bc563 - () const - - - - LineString - classqmapcontrol_1_1LineString.html - d8efdad1cc0ff6c63357cb72180c3a0a - (QList< Point * > const points, QString name=QString(), QPen *pen=0) - - - QString - name - classqmapcontrol_1_1Geometry.html - 2b0a198f837184bf6fff555cee3ce770 - () const - - - int - numberOfPoints - classqmapcontrol_1_1LineString.html - 06b5ac0b597b8d1cb7e8817f7e66c2eb - () const - - - Geometry * - parentGeometry - classqmapcontrol_1_1Geometry.html - 771cc513dc079219d5da2c4b81019d7c - () const - - - QPen * - pen - classqmapcontrol_1_1Geometry.html - ed7be2fcd2c1d7bccb55f5ac73d7a662 - () const - - - QList< Point * > - points - classqmapcontrol_1_1LineString.html - 18d4d26904bca7c54fb9d2a1b054c2fb - () - - - void - setName - classqmapcontrol_1_1Geometry.html - 6220fae15759fd0fa7d75e415df34e83 - (QString name) - - - void - setPoints - classqmapcontrol_1_1LineString.html - 6af8f478f54e6704e87dcf184a258a8c - (QList< Point * > points) - - - QString - toString - classqmapcontrol_1_1Geometry.html - 3a013a6edb6d10a71297978bc31a796b - () - - - - qmapcontrol::MapAdapter - classqmapcontrol_1_1MapAdapter.html - - virtual QPoint - coordinateToDisplay - classqmapcontrol_1_1MapAdapter.html - 0a7f30d12395e615eec9440070795349 - (const QPointF &coordinate) const =0 - - - int - currentZoom - classqmapcontrol_1_1MapAdapter.html - 8c7b803b9faa35db237e40c361e1c036 - () const - - - virtual QPointF - displayToCoordinate - classqmapcontrol_1_1MapAdapter.html - a26c33260233907672b1b23f4b1fd033 - (const QPoint &point) const =0 - - - QString - host - classqmapcontrol_1_1MapAdapter.html - 7ee8388c7880d8a3466967464f5034b6 - () const - - - int - maxZoom - classqmapcontrol_1_1MapAdapter.html - 3a33e897bc474405772d17a7c81f8747 - () const - - - int - minZoom - classqmapcontrol_1_1MapAdapter.html - 7457f51db57914a85bbefcc8c9fa97b4 - () const - - - int - tilesize - classqmapcontrol_1_1MapAdapter.html - f105c5a0cf588a3f60d67744bd353391 - () const - - - - qmapcontrol::MapControl - classqmapcontrol_1_1MapControl.html - - MouseMode - classqmapcontrol_1_1MapControl.html - 034ae8169a2202325de4ef39ffd3e431 - - - - Panning - classqmapcontrol_1_1MapControl.html - 034ae8169a2202325de4ef39ffd3e431e105bcd8daf776fd01704a7186c49608 - - - - Dragging - classqmapcontrol_1_1MapControl.html - 034ae8169a2202325de4ef39ffd3e431ea74c0c82481d6d724a43536424e3977 - - - - None - classqmapcontrol_1_1MapControl.html - 034ae8169a2202325de4ef39ffd3e431c9d3e887722f2bc482bcca9d41c512af - - - - void - resize - classqmapcontrol_1_1MapControl.html - 148f8aec7ea97e2e465cf2bd979846ab - (const QSize newSize) - - - void - scroll - classqmapcontrol_1_1MapControl.html - 527394cb8e8aa2d77f7a50a07b9e9f3e - (const QPoint scroll) - - - void - scrollDown - classqmapcontrol_1_1MapControl.html - 51db121d79cb0a651a7441b98bb7d7a9 - (int pixel=10) - - - void - scrollLeft - classqmapcontrol_1_1MapControl.html - 02f3bf431288e7ed34ecc59f7b8de996 - (int pixel=10) - - - void - scrollRight - classqmapcontrol_1_1MapControl.html - 216e70011cb465e61e2992d761f568df - (int pixel=10) - - - void - scrollUp - classqmapcontrol_1_1MapControl.html - ed27d1373fd9e05fb86fa319df4fe375 - (int pixel=10) - - - void - setZoom - classqmapcontrol_1_1MapControl.html - bb4bd8d8137d16816838c97d32407f39 - (int zoomlevel) - - - void - updateRequest - classqmapcontrol_1_1MapControl.html - 5cb68a198a28000fec8b7de1064d0a41 - (QRect rect) - - - void - updateRequestNew - classqmapcontrol_1_1MapControl.html - cf37bc294477796509e00e8f546fbd44 - () - - - void - zoomIn - classqmapcontrol_1_1MapControl.html - 7d7e315e34a66d9a66022d31635e7aca - () - - - void - zoomOut - classqmapcontrol_1_1MapControl.html - 72d29d38d8dd2c091cdd7078e1364f25 - () - - - void - boxDragged - classqmapcontrol_1_1MapControl.html - 1fd82da86a16f8932d45f4a0cadb60d1 - (const QRectF) - - - void - geometryClicked - classqmapcontrol_1_1MapControl.html - cc9ddd8e1721682682f85e73dae5f768 - (Geometry *geometry, QPoint coord_px) - - - void - mouseEventCoordinate - classqmapcontrol_1_1MapControl.html - a463d9dfa43fa385b48aab115d374637 - (const QMouseEvent *evnt, const QPointF coordinate) - - - void - viewChanged - classqmapcontrol_1_1MapControl.html - 08eac7c36a9f2b940daa171d450f6d76 - (const QPointF &coordinate, int zoom) - - - void - addLayer - classqmapcontrol_1_1MapControl.html - 87c6ef3c45ee9c21e173db2aa16cf567 - (Layer *layer) - - - QPointF - currentCoordinate - classqmapcontrol_1_1MapControl.html - 010c83996ab94a3db104aecf0550d480 - () const - - - int - currentZoom - classqmapcontrol_1_1MapControl.html - 8c7b803b9faa35db237e40c361e1c036 - () const - - - void - enablePersistentCache - classqmapcontrol_1_1MapControl.html - f27ac1bc11a80f7ff9a4bd3ec2527df7 - (const QDir &path=QDir::homePath()+"/QMapControl.cache") - - - void - followGeometry - classqmapcontrol_1_1MapControl.html - 6f7a69381097c74928af4ab3aa970386 - (const Geometry *geometry) const - - - Layer * - layer - classqmapcontrol_1_1MapControl.html - 8e22ad201cb035fda7d7fefd8f348b11 - (const QString &layername) const - - - QList< QString > - layers - classqmapcontrol_1_1MapControl.html - ee9467ec4674af32aed2fbeb1175e0b5 - () const - - - - MapControl - classqmapcontrol_1_1MapControl.html - 738341656ae7554bad78f0085c62c1f0 - (QSize size, MouseMode mousemode=Panning) - - - MapControl::MouseMode - mouseMode - classqmapcontrol_1_1MapControl.html - 9106ab9dcac042b57fc4e797c94d84dc - () - - - void - moveTo - classqmapcontrol_1_1MapControl.html - f7e3575f01f98a4096ccf48ac6bd4a50 - (QPointF coordinate) - - - int - numberOfLayers - classqmapcontrol_1_1MapControl.html - f3950823abbdf717124c279a386ca280 - () const - - - void - setMouseMode - classqmapcontrol_1_1MapControl.html - 346037e336da8525fe41ec30bf216d82 - (MouseMode mousemode) - - - void - setProxy - classqmapcontrol_1_1MapControl.html - ffaa4e5f0b461da0a1016d5459a550e0 - (QString host, int port) - - - void - setView - classqmapcontrol_1_1MapControl.html - 4ea85421ec8df905fba209510c909e2c - (const Point *point) const - - - void - setView - classqmapcontrol_1_1MapControl.html - c837e5df11959daca31bd1d01d12b94c - (const QList< QPointF > coordinates) const - - - void - setView - classqmapcontrol_1_1MapControl.html - b10ff3e8fed3a535de2a435ab1db48fb - (const QPointF &coordinate) const - - - void - setViewAndZoomIn - classqmapcontrol_1_1MapControl.html - e8c52337a968729d53c1ba57bfd65ea4 - (const QList< QPointF > coordinates) const - - - void - showScale - classqmapcontrol_1_1MapControl.html - a98cf43403323f601b3c91c6fe26a30c - (bool show) - - - void - stopFollowing - classqmapcontrol_1_1MapControl.html - f406ce597f3fa7ffe4e7d46c8b1e48c7 - (Geometry *geometry) - - - - qmapcontrol::MapLayer - classqmapcontrol_1_1MapLayer.html - qmapcontrol::Layer - - LayerType - classqmapcontrol_1_1Layer.html - 56943a0946e5f15e5e58054b8e7a04a4 - - - - MapLayer - classqmapcontrol_1_1Layer.html - 56943a0946e5f15e5e58054b8e7a04a4fe7df421203e4175d260b8dabcbe3002 - - - - GeometryLayer - classqmapcontrol_1_1Layer.html - 56943a0946e5f15e5e58054b8e7a04a46c04bd58c42df8a7539aba782503fee0 - - - - void - setVisible - classqmapcontrol_1_1Layer.html - 18e44e30b31525a243960ca3928125aa - (bool visible) - - - void - geometryClicked - classqmapcontrol_1_1Layer.html - 685dcab83356e5cc449475f177bb487d - (Geometry *geometry, QPoint point) - - - void - addGeometry - classqmapcontrol_1_1Layer.html - b692d7d08414ed2b744946b88872827f - (Geometry *geometry) - - - void - clearGeometries - classqmapcontrol_1_1Layer.html - 0b551ef8f4d0fd26cfa2ed0ec4c981b3 - () - - - bool - isVisible - classqmapcontrol_1_1Layer.html - 08422ee75ab02691943c1ca87e2bc563 - () const - - - QString - layername - classqmapcontrol_1_1Layer.html - 414e94fdd70490d75ddccb6923ae3410 - () const - - - Layer::LayerType - layertype - classqmapcontrol_1_1Layer.html - 1cfbd8a5c27cf9cb400fa458a1f70ba5 - () const - - - const MapAdapter * - mapadapter - classqmapcontrol_1_1Layer.html - 23cb6462136a0920739cdeb5f1709fa7 - () const - - - - MapLayer - classqmapcontrol_1_1MapLayer.html - c50a4fcff04c6859ce5601543b8ac821 - (QString layername, MapAdapter *mapadapter, bool takeevents=true) - - - void - removeGeometry - classqmapcontrol_1_1Layer.html - b34ffa138d7262b801cdfedaf4a129d3 - (Geometry *geometry) - - - - qmapcontrol::OpenAerialMapAdapter - classqmapcontrol_1_1OpenAerialMapAdapter.html - qmapcontrol::TileMapAdapter - - virtual QPoint - coordinateToDisplay - classqmapcontrol_1_1TileMapAdapter.html - 94134b06e350d302f5b3a63f0016aa60 - (const QPointF &) const - - - int - currentZoom - classqmapcontrol_1_1MapAdapter.html - 8c7b803b9faa35db237e40c361e1c036 - () const - - - virtual QPointF - displayToCoordinate - classqmapcontrol_1_1TileMapAdapter.html - 601b4631d9d891eabffb063c510cc088 - (const QPoint &) const - - - QString - host - classqmapcontrol_1_1MapAdapter.html - 7ee8388c7880d8a3466967464f5034b6 - () const - - - int - maxZoom - classqmapcontrol_1_1MapAdapter.html - 3a33e897bc474405772d17a7c81f8747 - () const - - - int - minZoom - classqmapcontrol_1_1MapAdapter.html - 7457f51db57914a85bbefcc8c9fa97b4 - () const - - - - OpenAerialMapAdapter - classqmapcontrol_1_1OpenAerialMapAdapter.html - 8b9f8f912aa1bf34e1b4d11e7dfec394 - () - - - int - tilesize - classqmapcontrol_1_1MapAdapter.html - f105c5a0cf588a3f60d67744bd353391 - () const - - - - qmapcontrol::OSMMapAdapter - classqmapcontrol_1_1OSMMapAdapter.html - qmapcontrol::TileMapAdapter - - virtual QPoint - coordinateToDisplay - classqmapcontrol_1_1TileMapAdapter.html - 94134b06e350d302f5b3a63f0016aa60 - (const QPointF &) const - - - int - currentZoom - classqmapcontrol_1_1MapAdapter.html - 8c7b803b9faa35db237e40c361e1c036 - () const - - - virtual QPointF - displayToCoordinate - classqmapcontrol_1_1TileMapAdapter.html - 601b4631d9d891eabffb063c510cc088 - (const QPoint &) const - - - QString - host - classqmapcontrol_1_1MapAdapter.html - 7ee8388c7880d8a3466967464f5034b6 - () const - - - int - maxZoom - classqmapcontrol_1_1MapAdapter.html - 3a33e897bc474405772d17a7c81f8747 - () const - - - int - minZoom - classqmapcontrol_1_1MapAdapter.html - 7457f51db57914a85bbefcc8c9fa97b4 - () const - - - - OSMMapAdapter - classqmapcontrol_1_1OSMMapAdapter.html - b6f5dd078b96030385b14d2a5d777092 - () - - - int - tilesize - classqmapcontrol_1_1MapAdapter.html - f105c5a0cf588a3f60d67744bd353391 - () const - - - - qmapcontrol::Point - classqmapcontrol_1_1Point.html - qmapcontrol::Geometry - - Alignment - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d7982726 - - - - TopLeft - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d798272661f66ddc6702462a94d3e231f02b9017 - - - - TopRight - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d79827267e42a96f07eab63a8c9fa8a0526f34f4 - - - - BottomLeft - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d7982726e61b9b6ea2fa75ca500d5bb1eaf6f6fc - - - - BottomRight - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d79827261640f649d644701a2f4633e6bd88b20c - - - - Middle - classqmapcontrol_1_1Point.html - cdfaca60ec19c0265bac2692d7982726673e6efef9aafe98078c5552e99c923c - - - - virtual void - setVisible - classqmapcontrol_1_1Point.html - 18e44e30b31525a243960ca3928125aa - (bool visible) - - - void - geometryClicked - classqmapcontrol_1_1Geometry.html - 685dcab83356e5cc449475f177bb487d - (Geometry *geometry, QPoint point) - - - void - positionChanged - classqmapcontrol_1_1Geometry.html - 807f9cfb1b9d680ca76cf825cc9cf46a - (Geometry *geom) - - - virtual QRectF - boundingBox - classqmapcontrol_1_1Point.html - cbb256b5f9f888e9cd3bb475108ece24 - () - - - QPointF - coordinate - classqmapcontrol_1_1Point.html - 2fbb44b2ed047287d715484d2fda7299 - () const - - - bool - Equals - classqmapcontrol_1_1Geometry.html - 029a8b50c439c719aac173bffe4cfb71 - (Geometry *geom) - - - bool - isVisible - classqmapcontrol_1_1Geometry.html - 08422ee75ab02691943c1ca87e2bc563 - () const - - - qreal - latitude - classqmapcontrol_1_1Point.html - 6311aabecac471455760aae4790cff91 - () const - - - qreal - longitude - classqmapcontrol_1_1Point.html - 2b0f7ec9068af09bcf151af61a785845 - () const - - - QString - name - classqmapcontrol_1_1Geometry.html - 2b0a198f837184bf6fff555cee3ce770 - () const - - - Geometry * - parentGeometry - classqmapcontrol_1_1Geometry.html - 771cc513dc079219d5da2c4b81019d7c - () const - - - QPen * - pen - classqmapcontrol_1_1Geometry.html - ed7be2fcd2c1d7bccb55f5ac73d7a662 - () const - - - QPixmap * - pixmap - classqmapcontrol_1_1Point.html - 166d4272301d85cc53e114ce4d26caf5 - () - - - - Point - classqmapcontrol_1_1Point.html - 735b9dc17b1ba1595e7d29cadb4d18c1 - (qreal x, qreal y, QPixmap *pixmap, QString name=QString(), enum Alignment alignment=Middle) - - - - Point - classqmapcontrol_1_1Point.html - a1767675df0bc3c13c75b3a48241125e - (qreal x, qreal y, QWidget *widget, QString name=QString(), enum Alignment alignment=Middle) - - - - Point - classqmapcontrol_1_1Point.html - 47257eee92b14e7c7f9b778c67bcb9a5 - (qreal x, qreal y, QString name=QString(), enum Alignment alignment=Middle) - - - void - setBaselevel - classqmapcontrol_1_1Point.html - 91f1496833bfda9f7a7ec5fcb02a1895 - (int zoomlevel) - - - void - setMaxsize - classqmapcontrol_1_1Point.html - dc2724c4e195727b823ff55c940283de - (QSize maxsize) - - - void - setMinsize - classqmapcontrol_1_1Point.html - c40b3e44f54fab1330b9309ac7bd84d2 - (QSize minsize) - - - void - setName - classqmapcontrol_1_1Geometry.html - 6220fae15759fd0fa7d75e415df34e83 - (QString name) - - - QString - toString - classqmapcontrol_1_1Geometry.html - 3a013a6edb6d10a71297978bc31a796b - () - - - QWidget * - widget - classqmapcontrol_1_1Point.html - d1eaabeb2b227cd055ccf4b4e2818480 - () - - - virtual bool - Touches - classqmapcontrol_1_1Point.html - 73504541bf9e21ceceb82c6b4c3f2b04 - (Point *geom, const MapAdapter *mapadapter) - - - - qmapcontrol::TileMapAdapter - classqmapcontrol_1_1TileMapAdapter.html - qmapcontrol::MapAdapter - - virtual QPoint - coordinateToDisplay - classqmapcontrol_1_1TileMapAdapter.html - 94134b06e350d302f5b3a63f0016aa60 - (const QPointF &) const - - - int - currentZoom - classqmapcontrol_1_1MapAdapter.html - 8c7b803b9faa35db237e40c361e1c036 - () const - - - virtual QPointF - displayToCoordinate - classqmapcontrol_1_1TileMapAdapter.html - 601b4631d9d891eabffb063c510cc088 - (const QPoint &) const - - - QString - host - classqmapcontrol_1_1MapAdapter.html - 7ee8388c7880d8a3466967464f5034b6 - () const - - - int - maxZoom - classqmapcontrol_1_1MapAdapter.html - 3a33e897bc474405772d17a7c81f8747 - () const - - - int - minZoom - classqmapcontrol_1_1MapAdapter.html - 7457f51db57914a85bbefcc8c9fa97b4 - () const - - - - TileMapAdapter - classqmapcontrol_1_1TileMapAdapter.html - 1233007f4393d3ae476a5284f9294e8c - (const QString &host, const QString &serverPath, int tilesize, int minZoom=0, int maxZoom=17) - - - int - tilesize - classqmapcontrol_1_1MapAdapter.html - f105c5a0cf588a3f60d67744bd353391 - () const - - - - qmapcontrol::WMSMapAdapter - classqmapcontrol_1_1WMSMapAdapter.html - qmapcontrol::MapAdapter - - virtual QPoint - coordinateToDisplay - classqmapcontrol_1_1WMSMapAdapter.html - 94134b06e350d302f5b3a63f0016aa60 - (const QPointF &) const - - - int - currentZoom - classqmapcontrol_1_1MapAdapter.html - 8c7b803b9faa35db237e40c361e1c036 - () const - - - virtual QPointF - displayToCoordinate - classqmapcontrol_1_1WMSMapAdapter.html - 601b4631d9d891eabffb063c510cc088 - (const QPoint &) const - - - QString - host - classqmapcontrol_1_1MapAdapter.html - 7ee8388c7880d8a3466967464f5034b6 - () const - - - int - maxZoom - classqmapcontrol_1_1MapAdapter.html - 3a33e897bc474405772d17a7c81f8747 - () const - - - int - minZoom - classqmapcontrol_1_1MapAdapter.html - 7457f51db57914a85bbefcc8c9fa97b4 - () const - - - int - tilesize - classqmapcontrol_1_1MapAdapter.html - f105c5a0cf588a3f60d67744bd353391 - () const - - - - WMSMapAdapter - classqmapcontrol_1_1WMSMapAdapter.html - 0bfce681fddbae34a9fae6fc8c2f0a38 - (QString host, QString serverPath, int tilesize=256) - - - - qmapcontrol::YahooMapAdapter - classqmapcontrol_1_1YahooMapAdapter.html - qmapcontrol::TileMapAdapter - - virtual QPoint - coordinateToDisplay - classqmapcontrol_1_1TileMapAdapter.html - 94134b06e350d302f5b3a63f0016aa60 - (const QPointF &) const - - - int - currentZoom - classqmapcontrol_1_1MapAdapter.html - 8c7b803b9faa35db237e40c361e1c036 - () const - - - virtual QPointF - displayToCoordinate - classqmapcontrol_1_1TileMapAdapter.html - 601b4631d9d891eabffb063c510cc088 - (const QPoint &) const - - - QString - host - classqmapcontrol_1_1MapAdapter.html - 7ee8388c7880d8a3466967464f5034b6 - () const - - - int - maxZoom - classqmapcontrol_1_1MapAdapter.html - 3a33e897bc474405772d17a7c81f8747 - () const - - - int - minZoom - classqmapcontrol_1_1MapAdapter.html - 7457f51db57914a85bbefcc8c9fa97b4 - () const - - - int - tilesize - classqmapcontrol_1_1MapAdapter.html - f105c5a0cf588a3f60d67744bd353391 - () const - - - - YahooMapAdapter - classqmapcontrol_1_1YahooMapAdapter.html - 9755050f27b44221d3e473b1cebd70cf - () - - - diff --git a/lib/QMapControl/images/sample_citymap.png b/lib/QMapControl/images/sample_citymap.png deleted file mode 100644 index 126b3465bf085ab70ba4711c18af081f6656750a..0000000000000000000000000000000000000000 Binary files a/lib/QMapControl/images/sample_citymap.png and /dev/null differ diff --git a/lib/QMapControl/images/sample_gps.png b/lib/QMapControl/images/sample_gps.png deleted file mode 100644 index 62a3d4bdf8853dfb02b4ebe5f7df04598a14c568..0000000000000000000000000000000000000000 Binary files a/lib/QMapControl/images/sample_gps.png and /dev/null differ diff --git a/lib/QMapControl/images/sample_linesandpoints.png b/lib/QMapControl/images/sample_linesandpoints.png deleted file mode 100644 index 5bb7d3d14ceac344afeee827250bb0d1c381ba5f..0000000000000000000000000000000000000000 Binary files a/lib/QMapControl/images/sample_linesandpoints.png and /dev/null differ diff --git a/lib/QMapControl/images/sample_mapviewer.png b/lib/QMapControl/images/sample_mapviewer.png deleted file mode 100644 index b02a78051a4d9cf00417b962143ac46f1eaa047c..0000000000000000000000000000000000000000 Binary files a/lib/QMapControl/images/sample_mapviewer.png and /dev/null differ diff --git a/lib/QMapControl/images/sample_multidemo.png b/lib/QMapControl/images/sample_multidemo.png deleted file mode 100644 index 0cf2d03ecdfc551c5aba94388d23eb4ecd3f7d43..0000000000000000000000000000000000000000 Binary files a/lib/QMapControl/images/sample_multidemo.png and /dev/null differ diff --git a/lib/QMapControl/qmapcontrol.h b/lib/QMapControl/qmapcontrol.h deleted file mode 100644 index 1faf4e32b91bb2150fe2a147166b946ebdb2cd36..0000000000000000000000000000000000000000 --- a/lib/QMapControl/qmapcontrol.h +++ /dev/null @@ -1,18 +0,0 @@ -#include "src/mapcontrol.h" -#include "src/gps_position.h" -#include "src/wmsmapadapter.h" -#include "src/geometry.h" -#include "src/point.h" -#include "src/imagepoint.h" -#include "src/circlepoint.h" -#include "src/linestring.h" -#include "src/gps_position.h" -#include "src/osmmapadapter.h" -#include "src/maplayer.h" -#include "src/geometrylayer.h" -#include "src/yahoomapadapter.h" -#include "src/googlemapadapter.h" -#include "src/googlesatmapadapter.h" -#include "src/openaerialmapadapter.h" -#include "src/fixedimageoverlay.h" -#include "src/emptymapadapter.h" diff --git a/lib/QMapControl/src/circlepoint.cpp b/lib/QMapControl/src/circlepoint.cpp deleted file mode 100644 index afc79a2c6468d27c037c948ab1a529a4de1c0a9c..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/circlepoint.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "circlepoint.h" -namespace qmapcontrol -{ - CirclePoint::CirclePoint(qreal x, qreal y, int radius, QString name, Alignment alignment, QPen* pen) - : Point(x, y, name, alignment) - { - size = QSize(radius, radius); - mypixmap = new QPixmap(radius+1, radius+1); - mypixmap->fill(Qt::transparent); - QPainter painter(mypixmap); - if (pen != 0) - { - painter.setPen(*pen); - } - painter.drawEllipse(0,0,radius, radius); - } - - CirclePoint::CirclePoint(qreal x, qreal y, QString name, Alignment alignment, QPen* pen) - : Point(x, y, name, alignment) - { - int radius = 10; - size = QSize(radius, radius); - mypixmap = new QPixmap(radius+1, radius+1); - mypixmap->fill(Qt::transparent); - QPainter painter(mypixmap); - if (pen != 0) - { - painter.setPen(*pen); - } - painter.drawEllipse(0,0,radius, radius); - } - - CirclePoint::~CirclePoint() - { - delete mypixmap; - } - - void CirclePoint::setPen(QPen* pen) - { - mypen = pen; - mypixmap = new QPixmap(size.width()+1, size.height()+1); - mypixmap->fill(Qt::transparent); - QPainter painter(mypixmap); - painter.setPen(*pen); - painter.drawEllipse(0,0, size.width(), size.height()); - } -} diff --git a/lib/QMapControl/src/circlepoint.h b/lib/QMapControl/src/circlepoint.h deleted file mode 100644 index 9c90be2814b3ec282bdeef4854120408b8cf9a9c..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/circlepoint.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef CIRCLEPOINT_H -#define CIRCLEPOINT_H - -#include "point.h" - -namespace qmapcontrol -{ - //! Draws a circle into the map - /*! This is a conveniece class for Point. - * It configures the pixmap of a Point to draw a circle. - * A QPen could be used to change the color or line-width of the circle - * - * @author Kai Winter - */ - class CirclePoint : public Point - { - public: - //! - /*! - * - * @param x longitude - * @param y latitude - * @param name name of the circle point - * @param alignment alignment (Middle or TopLeft) - * @param pen QPen for drawing - */ - CirclePoint(qreal x, qreal y, QString name = QString(), Alignment alignment = Middle, QPen* pen=0); - - //! - /*! - * - * @param x longitude - * @param y latitude - * @param radius the radius of the circle - * @param name name of the circle point - * @param alignment alignment (Middle or TopLeft) - * @param pen QPen for drawing - */ - CirclePoint(qreal x, qreal y, int radius = 10, QString name = QString(), Alignment alignment = Middle, QPen* pen=0); - virtual ~CirclePoint(); - - //! sets the QPen which is used for drawing the circle - /*! - * A QPen can be used to modify the look of the drawn circle - * @param pen the QPen which should be used for drawing - * @see http://doc.trolltech.com/4.3/qpen.html - */ - virtual void setPen(QPen* pen); - - }; -} -#endif diff --git a/lib/QMapControl/src/curve.cpp b/lib/QMapControl/src/curve.cpp deleted file mode 100644 index d837e49362607496fd0874c562967c63b4f6d394..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/curve.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "curve.h" -namespace qmapcontrol -{ - Curve::Curve(QString name) - : Geometry(name) - { - } - - - Curve::~Curve() - { - } -} -// Geometry Curve::Clone(){} - -// QRectF Curve::GetBoundingBox(){} diff --git a/lib/QMapControl/src/curve.h b/lib/QMapControl/src/curve.h deleted file mode 100644 index 5a71c01c14d58dd90623d21c80ab4c22d967127d..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/curve.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef CURVE_H -#define CURVE_H - -#include "geometry.h" -#include "point.h" - -namespace qmapcontrol -{ - //! A Curve Geometry, implemented to fullfil OGC Spec - /*! - * The Curve class is used by LineString as parent class. - * This class could not be used directly. - * - * From the OGC Candidate Implementation Specification: - * "A Curve is a 1-dimensional geometric object usually stored as a sequence of Points, with the subtype of Curve - * specifying the form of the interpolation between Points. This specification defines only one subclass of Curve, - * LineString, which uses a linear interpolation between Points." - * @author Kai Winter - */ - class Curve : public Geometry - { - Q_OBJECT - public: - virtual ~Curve(); - - double Length; - - // virtual Geometry Clone(); - // virtual QRectF GetBoundingBox(); - - // virtual Point EndPoint() = 0; - // virtual Point StartPoint() = 0; - // virtual Point Value() = 0; - - protected: - Curve(QString name = QString()); - virtual void draw(QPainter* painter, const MapAdapter* mapadapter, const QRect &screensize, const QPoint offset) = 0; - }; -} -#endif diff --git a/lib/QMapControl/src/emptymapadapter.cpp b/lib/QMapControl/src/emptymapadapter.cpp deleted file mode 100644 index 0de9cc47378574b07d57aa1660372d354d12082d..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/emptymapadapter.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "emptymapadapter.h" -namespace qmapcontrol -{ - EmptyMapAdapter::EmptyMapAdapter(int tileSize, int minZoom, int maxZoom) - :MapAdapter("", "", 256, minZoom, maxZoom) - { - Q_UNUSED(tileSize); - PI = acos(-1.0); - - numberOfTiles = tilesonzoomlevel(minZoom); - } - - EmptyMapAdapter::~EmptyMapAdapter() - { - } - - void EmptyMapAdapter::zoom_in() - { - if (current_zoom < max_zoom) - { - current_zoom = current_zoom + 1; - } - numberOfTiles = tilesonzoomlevel(current_zoom); - } - - void EmptyMapAdapter::zoom_out() - { - if (current_zoom > min_zoom) - { - current_zoom = current_zoom - 1; - } - numberOfTiles = tilesonzoomlevel(current_zoom); - } - - qreal EmptyMapAdapter::deg_rad(qreal x) const - { - return x * (PI/180.0); - } - qreal EmptyMapAdapter::rad_deg(qreal x) const - { - return x * (180/PI); - } - - QString EmptyMapAdapter::query(int x, int y, int z) const - { - Q_UNUSED(x); - Q_UNUSED(y); - Q_UNUSED(z); - return ""; - } - - QPoint EmptyMapAdapter::coordinateToDisplay(const QPointF& coordinate) const - { - qreal x = (coordinate.x()+180) * (numberOfTiles*mytilesize)/360.; // coord to pixel! - qreal y = (1-(log(tan(PI/4+deg_rad(coordinate.y())/2)) /PI)) /2 * (numberOfTiles*mytilesize); - - return QPoint(int(x), int(y)); - } - - QPointF EmptyMapAdapter::displayToCoordinate(const QPoint& point) const - { - qreal longitude = (point.x()*(360/(numberOfTiles*mytilesize)))-180; - qreal latitude = rad_deg(atan(sinh((1-point.y()*(2/(numberOfTiles*mytilesize)))*PI))); - - return QPointF(longitude, latitude); - - } - - bool EmptyMapAdapter::isValid(int x, int y, int z) const - { - if (max_zoom < min_zoom) - { - z= min_zoom - z; - } - - if (x<0 || x>pow(2.0,z)-1 || - y<0 || y>pow(2.0,z)-1) - { - return false; - } - return true; - - } - int EmptyMapAdapter::tilesonzoomlevel(int zoomlevel) const - { - return int(pow(2.0, zoomlevel)); - } - int EmptyMapAdapter::xoffset(int x) const - { - return x; - } - int EmptyMapAdapter::yoffset(int y) const - { - return y; - } -} diff --git a/lib/QMapControl/src/emptymapadapter.h b/lib/QMapControl/src/emptymapadapter.h deleted file mode 100644 index 07393eea8ceb9274ba50326ec8f7e4dda0314df6..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/emptymapadapter.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef EMPTYMAPADAPTER_H -#define EMPTYMAPADAPTER_H - -#include "mapadapter.h" - -namespace qmapcontrol -{ - //! MapAdapter which do not load map tiles. - /*! - * The EmptyMapAdapter can be used if QMapControl should not load any map tiles. This is useful if you - * only want to display an image through a FixedImageOverlay e.g. - * @author Kai Winter - */ - class EmptyMapAdapter : public MapAdapter - { - Q_OBJECT - public: - //! Constructor. - /*! - * @param tileSize This parameter seems unnecessary for this type of MapAdaper on first sight. But since - * this parameter defines the size of the offscreen image it could be used for a little performance - * tuning (larger offscreen-images have to be redrawed less times). - * @param minZoom the minimum zoom level - * @param maxZoom the maximum zoom level - */ - EmptyMapAdapter(int tileSize = 256, int minZoom = 0, int maxZoom = 17); - - virtual ~EmptyMapAdapter(); - - virtual QPoint coordinateToDisplay(const QPointF&) const; - virtual QPointF displayToCoordinate(const QPoint&) const; - - qreal PI; - - protected: - qreal rad_deg(qreal) const; - qreal deg_rad(qreal) const; - - virtual bool isValid(int x, int y, int z) const; - virtual void zoom_in(); - virtual void zoom_out(); - virtual QString query(int x, int y, int z) const; - virtual int tilesonzoomlevel(int zoomlevel) const; - virtual int xoffset(int x) const; - virtual int yoffset(int y) const; - }; -} -#endif diff --git a/lib/QMapControl/src/fixedimageoverlay.cpp b/lib/QMapControl/src/fixedimageoverlay.cpp deleted file mode 100644 index a0e6cb70d2cf7cde46443ec96925c8c2aaabc94e..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/fixedimageoverlay.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2009 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "fixedimageoverlay.h" -namespace qmapcontrol -{ - FixedImageOverlay::FixedImageOverlay(qreal x_upperleft, qreal y_upperleft, qreal x_lowerright, qreal y_lowerright, QString filename, QString name) - : ImagePoint(x_upperleft, y_upperleft, filename, name, TopLeft), - x_lowerright(x_lowerright), y_lowerright(y_lowerright) - { - //qDebug() << "loading image: " << filename; - mypixmap = new QPixmap(filename); - size = mypixmap->size(); - //qDebug() << "image size: " << size; - } - - FixedImageOverlay::FixedImageOverlay(qreal x_upperleft, qreal y_upperleft, qreal x_lowerright, qreal y_lowerright, QPixmap* pixmap, QString name) - : ImagePoint(x_upperleft, y_upperleft, pixmap, name, TopLeft), - x_lowerright(x_lowerright), y_lowerright(y_lowerright) - { - mypixmap = pixmap; - size = mypixmap->size(); - } - - void FixedImageOverlay::draw(QPainter* painter, const MapAdapter* mapadapter, const QRect &viewport, const QPoint offset) - { - Q_UNUSED(viewport) - Q_UNUSED(offset) - if (!visible) - return; - - if (mypixmap !=0) - { - const QPointF c = QPointF(X, Y); - QPoint topleft = mapadapter->coordinateToDisplay(c); - - const QPointF c2 = QPointF(x_lowerright, y_lowerright); - QPoint lowerright = mapadapter->coordinateToDisplay(c2); - - painter->drawPixmap(topleft.x(), topleft.y(), lowerright.x()-topleft.x(), lowerright.y()-topleft.y(), *mypixmap); - } - - - } - - FixedImageOverlay::~FixedImageOverlay() - { - } -} diff --git a/lib/QMapControl/src/fixedimageoverlay.h b/lib/QMapControl/src/fixedimageoverlay.h deleted file mode 100644 index 6d154af001e348e6c4a87fa3e3fa2039cd0878a7..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/fixedimageoverlay.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2009 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef FIXEDIMAGEOVERLAY_H -#define FIXEDIMAGEOVERLAY_H - -#include "imagepoint.h" - -namespace qmapcontrol -{ - - //! Draws a fixed image into the map. - /*! - * This class draws a image overlay onto a map, whose upper left and lower - * right corners lay always on the given coordinates. The methods - * setBaselevel, setMaxsize and setMinsize have no effect for this class. - * - * @author Kai Winter - */ - class FixedImageOverlay : public ImagePoint - { - public: - //! Creates an image overlay which loads and displays the given image file - /*! - * Use this contructor to load the given image file and let the point - * display it. - * When you want multiple points to display the same image, use the - * other contructor and pass a pointer to that image. - * @param x_upperleft the coordinate of the upper left corner where the image should be aligned - * @param y_upperleft the coordinate of the upper left corner where the image should be aligned - * @param x_lowerright the coordinate of the lower right corner where the image should be aligned - * @param y_lowerright the coordinate of the lower right corner where the image should be aligned - * @param filename the file which should be loaded and displayed - * @param name the name of the image point - */ - FixedImageOverlay(qreal x_upperleft, qreal y_upperleft, qreal x_lowerright, qreal y_lowerright, QString filename, QString name = QString()); - - //! Creates an image overlay which displays the given image - /*! - * Use this contructor to display the given image. - * @param x_upperleft the coordinate of the upper left corner where the image should be aligned - * @param y_upperleft the coordinate of the upper left corner where the image should be aligned - * @param x_lowerright the coordinate of the lower right corner where the image should be aligned - * @param y_lowerright the coordinate of the lower right corner where the image should be aligned - * @param pixmap pointer to the image pixmap - * @param name the name of the image point - */ - FixedImageOverlay(qreal x_upperleft, qreal y_upperleft, qreal x_lowerright, qreal y_lowerright, QPixmap* pixmap, QString name = QString()); - - virtual void draw(QPainter* painter, const MapAdapter* mapadapter, const QRect &viewport, const QPoint offset); - virtual ~FixedImageOverlay(); - - private: - qreal x_lowerright; - qreal y_lowerright; - }; -} -#endif diff --git a/lib/QMapControl/src/geometry.cpp b/lib/QMapControl/src/geometry.cpp deleted file mode 100644 index 62f45a75d7cfc07a2377fcba42f407c61c36583d..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/geometry.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "geometry.h" -namespace qmapcontrol -{ - Geometry::Geometry(QString name) - : GeometryType("Geometry"), myparentGeometry(0), mypen(0), visible(true), myname(name) - { - myIndex = name.toInt(0,10); - } - - Geometry::~Geometry() - { - } - - QString Geometry::name() const - { - return myname; - } - int Geometry::get_myIndex() const - { - return myIndex; - } - - Geometry* Geometry::parentGeometry() const - { - return myparentGeometry; - } - void Geometry::setParentGeometry(Geometry* geom) - { - myparentGeometry = geom; - } - bool Geometry::hasPoints() const - { - return false; - } - bool Geometry::hasClickedPoints() const - { - return false; - } - QList Geometry::clickedPoints() - { - QList tmp; - return tmp; - } - - bool Geometry::isVisible() const - { - return visible; - } - void Geometry::setVisible(bool visible) - { - this->visible = visible; - emit(updateRequest(boundingBox())); - } - - void Geometry::setName(QString name) - { - myname = name; - } - - void Geometry::setPen(QPen* pen) - { - mypen = pen; - } - QPen* Geometry::pen() const - { - return mypen; - } - -} diff --git a/lib/QMapControl/src/geometry.h b/lib/QMapControl/src/geometry.h deleted file mode 100644 index 127ab799151aa9f0d6cea25830be5b5d25d32d71..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/geometry.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef GEOMETRY_H -#define GEOMETRY_H -#include -#include -#include -#include "mapadapter.h" - -namespace qmapcontrol -{ - class Point; - //! Main class for objects that should be painted in maps - /*! - * Geometry is the root class of the hierarchy. Geometry is an abstract (non-instantiable) class. - * - * This class and the derived classes Point, Curve and LineString are leant on the Simple - * Feature Specification of the Open Geospatial Consortium. - * @see www.opengeospatial.com - * - * @author Kai Winter - */ - class Geometry : public QObject - { - friend class LineString; - Q_OBJECT - public: - explicit Geometry(QString name = QString()); - - virtual ~Geometry(); - - QString GeometryType; - - //! - /*! returns true if the given Geometry is equal to this Geometry - * not implemented yet! - * @param geom The Geometry to be tested - * @return true if the given Geometry is equal to this - */ - bool Equals(Geometry* geom); - - //! returns a String representation of this Geometry - /*! - * not implemented yet! - * @return a String representation of this Geometry - */ - QString toString(); - - //! returns the name of this Geometry - /*! - * @return the name of this Geometry - */ - QString name() const; - - //! returns the index of this Geometry - /*! - * @return the index of this Geometry - */ - int get_myIndex() const; - - //! returns the parent Geometry of this Geometry - /*! - * A LineString is a composition of many Points. This methods returns the parent (the LineString) of a Point - * @return the parent Geometry of this Geometry - */ - Geometry* parentGeometry() const; - - //! returns true if this Geometry is visible - /*! - * @return true if this Geometry is visible - */ - bool isVisible() const; - - //! sets the name of the geometry - /*! - * @param name the new name of the geometry - */ - void setName(QString name); - - //! returns the QPen which is used on drawing - /*! - * The pen is set depending on the Geometry. A CirclePoint for example takes one with the constructor. - * @return the QPen which is used for drawing - */ - QPen* pen() const; - - //! returns the BoundingBox - /*! - * The bounding box in world coordinates - * @return the BoundingBox - */ - virtual QRectF boundingBox()=0; - virtual bool Touches(Point* geom, const MapAdapter* mapadapter)=0; - virtual void draw(QPainter* painter, const MapAdapter* mapadapter, const QRect &viewport, const QPoint offset)=0; - virtual bool hasPoints() const; - virtual bool hasClickedPoints() const; - virtual void setPen(QPen* pen); - virtual QList clickedPoints(); - virtual QList& points()=0; - - private: - Geometry* myparentGeometry; - Geometry(const Geometry& old); - Geometry& operator=(const Geometry& rhs); - - protected: - QPen* mypen; - bool visible; - QString myname; - int myIndex; - void setParentGeometry(Geometry* geom); - - signals: - void updateRequest(Geometry* geom); - void updateRequest(QRectF rect); - //! This signal is emitted when a Geometry is clicked - /*! - * A Geometry is clickable, if the containing layer is clickable. - * The objects emits a signal if it gets clicked - * @param geometry The clicked Geometry - * @param point -unused- - */ - void geometryClicked(Geometry* geometry, QPoint point); - - //! A Geometry emits this signal, when its position gets changed - /*! - * @param geom the Geometry - */ - void positionChanged(Geometry* geom); - - public slots: - //! if visible is true, the layer is made visible - /*! - * @param visible if the layer should be visible - */ - virtual void setVisible(bool visible); - - - }; -} -#endif diff --git a/lib/QMapControl/src/geometrylayer.cpp b/lib/QMapControl/src/geometrylayer.cpp deleted file mode 100644 index e52dfcb88505e4978538ab0362cc56bdacc65608..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/geometrylayer.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "geometrylayer.h" -namespace qmapcontrol -{ - GeometryLayer::GeometryLayer(QString layername, MapAdapter* mapadapter, bool takeevents) - : Layer(layername, mapadapter, Layer::GeometryLayer, takeevents) - { - } - - - GeometryLayer::~GeometryLayer() - { - } -} diff --git a/lib/QMapControl/src/geometrylayer.h b/lib/QMapControl/src/geometrylayer.h deleted file mode 100644 index 93bda472ec9cfb8c18811a07bd2812e9c1bd5154..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/geometrylayer.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef GEOMETRYLAYER_H -#define GEOMETRYLAYER_H - -#include "layer.h" - -namespace qmapcontrol -{ - //! GeometryLayer class - /*! - * There are two different layer types: - * - MapLayer: Displays Maps, but also Geometries. The configuration for displaying maps have to be done in the MapAdapter - * - GeometryLayer: Only displays Geometry objects. - * - * MapLayers also can display Geometry objects. The difference to the GeometryLayer is the repainting. Objects that are - * added to a MapLayer are "baken" on the map. This means, when you change it´s position for example the changes are - * not visible until a new offscreen image has been drawn. If you have "static" Geometries which won´t change their - * position this is fine. But if you want to change the objects position or pen you should use a GeometryLayer. Those - * are repainted immediately on changes. - * - * @author Kai Winter - */ - class GeometryLayer : public Layer - { - Q_OBJECT - - public: - //! GeometryLayer constructor - /*! - * This is used to construct a map layer. - * - * @param layername The name of the Layer - * @param mapadapter The MapAdapter which does coordinate translation and Query-String-Forming - * @param takeevents Should the Layer receive MouseEvents? This is set to true by default. Setting it to false could - * be something like a "speed up hint" - */ - GeometryLayer(QString layername, MapAdapter* mapadapter, bool takeevents=true); - virtual ~GeometryLayer(); - }; -} -#endif diff --git a/lib/QMapControl/src/googlemapadapter.cpp b/lib/QMapControl/src/googlemapadapter.cpp deleted file mode 100644 index 945aca765b9ac06b39062d608d9974cc92be474a..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/googlemapadapter.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "googlemapadapter.h" -namespace qmapcontrol -{ - GoogleMapAdapter::GoogleMapAdapter() - : TileMapAdapter("mt0.google.com", "/vt/lyrs=&x=%2&s=&y=%3&z=%1", 256, 0, 17) - { - } - - GoogleMapAdapter::~GoogleMapAdapter() - { - } -} diff --git a/lib/QMapControl/src/googlemapadapter.h b/lib/QMapControl/src/googlemapadapter.h deleted file mode 100644 index 46ceea76420e97acd7deaa8016df2392dbd52edf..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/googlemapadapter.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef GOOGLEMAPADAPTER_H -#define GOOGLEMAPADAPTER_H - -#include "tilemapadapter.h" - -namespace qmapcontrol -{ - //! MapAdapter for Google - /*! - * This is a conveniece class, which extends and configures a TileMapAdapter - * @author Kai Winter - */ - class GoogleMapAdapter : public TileMapAdapter - { - Q_OBJECT - - public: - //! constructor - /*! - * This construct a Google Adapter - */ - GoogleMapAdapter(); - virtual ~GoogleMapAdapter(); - }; -} -#endif diff --git a/lib/QMapControl/src/googlesatmapadapter.cpp b/lib/QMapControl/src/googlesatmapadapter.cpp deleted file mode 100644 index 5692b29489c36eae9c9d44ef54ed0964b5dee94a..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/googlesatmapadapter.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "googlesatmapadapter.h" - -#include -namespace qmapcontrol -{ - GoogleSatMapAdapter::GoogleSatMapAdapter() - : TileMapAdapter("khm.google.com", "/kh?v=51&x=%2&s=&y=%3&z=%1", 256, 9, 21) - { -// // name = "googlesat"; -// -// numberOfTiles = pow(2, current_zoom+0.0); -// coord_per_x_tile = 360. / numberOfTiles; -// coord_per_y_tile = 180. / numberOfTiles; - } - - GoogleSatMapAdapter::~GoogleSatMapAdapter() - { - } -// -// QString GoogleSatMapAdapter::getHost() const -// { -// int random = qrand() % 4; -// return QString("kh%1.google.com").arg(random); -// } -// -// QPoint GoogleSatMapAdapter::coordinateToDisplay(const QPointF& coordinate) const -// { -// //double x = ((coordinate.x()+180)*(tilesize*numberOfTiles/360)); -// //double y = (((coordinate.y()*-1)+90)*(tilesize*numberOfTiles/180)); -// -// qreal x = (coordinate.x()+180.) * (numberOfTiles*mytilesize)/360.; // coord to pixel! -// //double y = -1*(coordinate.y()-90) * (numberOfTiles*tilesize)/180.; // coord to pixel! -// qreal y = (getMercatorYCoord(coordinate.y())-M_PI) * -1 * (numberOfTiles*mytilesize)/(2*M_PI); // coord to pixel! -// return QPoint(int(x), int(y)); -// } -// -// QPointF GoogleSatMapAdapter::displayToCoordinate(const QPoint& point) const -// { -// //double lon = ((point.x()/tilesize*numberOfTiles)*360)-180; -// //double lat = (((point.y()/tilesize*numberOfTiles)*180)-90)*-1; -// -// qreal lon = (point.x()*(360.0/(numberOfTiles*mytilesize)))-180.0; -// // qreal lat = -(point.y()*(180.0/(numberOfTiles*mytilesize)))+90.0; -// // FIXME Looks buggy -// -// qreal lat = getMercatorLatitude(point.y()*-1*(2*M_PI/(numberOfTiles*mytilesize)) + M_PI); -// //qreal lat = lat *180./M_PI; -// return QPointF(lon, lat); -// } -// -// qreal GoogleSatMapAdapter::getMercatorLatitude(qreal YCoord) const -// { -// //http://welcome.warnercnr.colostate.edu/class_info/nr502/lg4/projection_mathematics/converting.html -// if (YCoord > M_PI) return 9999.; -// if (YCoord < -M_PI) return -9999.; -// -// qreal t = atan(exp(YCoord)); -// qreal res = (2.*(t))-(M_PI/2.); -// return res; -// } -// -// qreal GoogleSatMapAdapter::getMercatorYCoord(qreal lati) const -// { -// qreal lat = lati; -// -// // conversion degre=>radians -// qreal phi = M_PI * lat / 180; -// -// qreal res; -// //double temp = Math.Tan(Math.PI / 4 - phi / 2); -// //res = Math.Log(temp); -// res = 0.5 * log((1 + sin(phi)) / (1 - sin(phi))); -// -// return res; -// } -// -// void GoogleSatMapAdapter::zoom_in() -// { -// current_zoom+=1; -// numberOfTiles = pow(2, current_zoom+0.0); -// coord_per_x_tile = 360. / numberOfTiles; -// coord_per_y_tile = 180. / numberOfTiles; -// } -// -// void GoogleSatMapAdapter::zoom_out() -// { -// current_zoom-=1; -// numberOfTiles = pow(2, current_zoom+0.0); -// coord_per_x_tile = 360. / numberOfTiles; -// coord_per_y_tile = 180. / numberOfTiles; -// } -// -// bool GoogleSatMapAdapter::isValid(int x, int y, int z) const -// { -// if ((x>=0 && x < numberOfTiles) && (y>=0 && y < numberOfTiles) && z>=0) -// { -// return true; -// } -// return false; -// } -// QString GoogleSatMapAdapter::query(int i, int j, int z) const -// { -// return getQ(-180+i*coord_per_x_tile, -// 90-(j+1)*coord_per_y_tile, z); -// } -// -// QString GoogleSatMapAdapter::getQ(qreal longitude, qreal latitude, int zoom) const -// { -// qreal xmin=-180; -// qreal xmax=180; -// qreal ymin=-90; -// qreal ymax=90; -// -// qreal xmoy=0; -// qreal ymoy=0; -// QString location="t"; -// -// //Google uses a latitude divided by 2; -// qreal halflat = latitude; -// -// for (int i = 0; i < zoom; i++) -// { -// xmoy = (xmax + xmin) / 2; -// ymoy = (ymax + ymin) / 2; -// if (halflat >= ymoy) //upper part (q or r) -// { -// ymin = ymoy; -// if (longitude < xmoy) -// { /*q*/ -// location+= "q"; -// xmax = xmoy; -// } -// else -// {/*r*/ -// location+= "r"; -// xmin = xmoy; -// } -// } -// else //lower part (t or s) -// { -// ymax = ymoy; -// if (longitude < xmoy) -// { /*t*/ -// -// location+= "t"; -// xmax = xmoy; -// } -// else -// {/*s*/ -// location+= "s"; -// xmin = xmoy; -// } -// } -// } -// return QString("/kh?n=404&v=24&t=%1").arg(location); -// } -} - diff --git a/lib/QMapControl/src/googlesatmapadapter.h b/lib/QMapControl/src/googlesatmapadapter.h deleted file mode 100644 index 0c56a6d5e7e4f752ef01582b9beb0888c8a543a2..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/googlesatmapadapter.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef GOOGLESATMAPADAPTER_H -#define GOOGLESATMAPADAPTER_H - -#include "tilemapadapter.h" -namespace qmapcontrol -{ - //! MapAdapter for Google - /*! - * This is a conveniece class, which extends and configures a TileMapAdapter - * @author Kai Winter - */ - class GoogleSatMapAdapter : public TileMapAdapter - { - Q_OBJECT - public: - //! constructor - /*! - * This construct a Google Adapter - */ - GoogleSatMapAdapter(); - virtual ~GoogleSatMapAdapter(); -// -// virtual QPoint coordinateToDisplay(const QPointF&) const; -// virtual QPointF displayToCoordinate(const QPoint&) const; -// -// //! returns the host of this MapAdapter -// /*! -// * @return the host of this MapAdapter -// */ -// QString getHost () const; -// -// -// protected: -// virtual void zoom_in(); -// virtual void zoom_out(); -// virtual QString query(int x, int y, int z) const; -// virtual bool isValid(int x, int y, int z) const; -// -// private: -// virtual QString getQ(qreal longitude, qreal latitude, int zoom) const; -// qreal getMercatorLatitude(qreal YCoord) const; -// qreal getMercatorYCoord(qreal lati) const; -// -// qreal coord_per_x_tile; -// qreal coord_per_y_tile; -// int srvNum; - }; -} -#endif diff --git a/lib/QMapControl/src/gps_position.cpp b/lib/QMapControl/src/gps_position.cpp deleted file mode 100644 index 67307913aaadade748ef208fb7e0bbe0d7b2ff3d..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/gps_position.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "gps_position.h" -namespace qmapcontrol -{ - GPS_Position::GPS_Position(float time, float longitude, QString longitude_dir, float latitude, QString latitude_dir) - :time(time), longitude(longitude), latitude(latitude), longitude_dir(longitude_dir), latitude_dir(latitude_dir) - { - } -} diff --git a/lib/QMapControl/src/gps_position.h b/lib/QMapControl/src/gps_position.h deleted file mode 100644 index 46aeb2ed32ca775e4ab7ca891079e232e179baad..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/gps_position.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef GPS_POSITION_H -#define GPS_POSITION_H - -#include - -namespace qmapcontrol -{ - //! Represents a coordinate from a GPS receiver - /*! - * This class is used to represent a coordinate which has been parsed from a NMEA string. - * This is not fully integrated in the API. An example which uses this data type can be found under Samples. - * @author Kai Winter - */ - class GPS_Position - { - public: - GPS_Position(float time, float longitude, QString longitude_dir, float latitude, QString latitude_dir); - float time; /*!< time of the string*/ - float longitude; /*!< longitude coordinate*/ - float latitude; /*!< latitude coordinate*/ - - private: - QString longitude_dir; - QString latitude_dir; - }; -} -#endif diff --git a/lib/QMapControl/src/imagemanager.cpp b/lib/QMapControl/src/imagemanager.cpp deleted file mode 100644 index d681753b1c3d024e036b0217e32d4225c5d6f791..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/imagemanager.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "imagemanager.h" -namespace qmapcontrol -{ - ImageManager* ImageManager::m_Instance = 0; - ImageManager::ImageManager(QObject* parent) - :QObject(parent), emptyPixmap(QPixmap(1,1)), net(new MapNetwork(this)), doPersistentCaching(false) - { - emptyPixmap.fill(Qt::transparent); - - if (QPixmapCache::cacheLimit() <= 20000) - { - QPixmapCache::setCacheLimit(20000); // in kb - } - } - - - ImageManager::~ImageManager() - { - if (ImageManager::m_Instance != 0) - { - delete ImageManager::m_Instance; - } - delete net; - } - - QPixmap ImageManager::getImage(const QString& host, const QString& url) - { - //qDebug() << "ImageManager::getImage"; - QPixmap pm; - //pm.fill(Qt::black); - - //is image cached (memory) or currently loading? - if (!QPixmapCache::find(url, pm) && !net->imageIsLoading(url)) - // if (!images.contains(url) && !net->imageIsLoading(url)) - { - //image cached (persistent)? - if (doPersistentCaching && tileExist(url)) - { - loadTile(url,pm); - QPixmapCache::insert(url.toAscii().toBase64(), pm); - } - else - { - //load from net, add empty image - net->loadImage(host, url); - //QPixmapCache::insert(url, emptyPixmap); - return emptyPixmap; - } - } - return pm; - } - - QPixmap ImageManager::prefetchImage(const QString& host, const QString& url) - { -#ifdef Q_WS_QWS - // on mobile devices we don´t want the display resfreshing when tiles are received which are - // prefetched... This is a performance issue, because mobile devices are very slow in - // repainting the screen - prefetch.append(url); -#endif - return getImage(host, url); - } - - void ImageManager::receivedImage(const QPixmap pixmap, const QString& url) - { - //qDebug() << "ImageManager::receivedImage"; - QPixmapCache::insert(url, pixmap); - //images[url] = pixmap; - - // needed? - if (doPersistentCaching && !tileExist(url) ) - saveTile(url,pixmap); - - //((Layer*)this->parent())->imageReceived(); - - if (!prefetch.contains(url)) - { - emit(imageReceived()); - } - else - { - -#ifdef Q_WS_QWS - prefetch.remove(prefetch.indexOf(url)); -#endif - } - } - - void ImageManager::loadingQueueEmpty() - { - emit(loadingFinished()); - //((Layer*)this->parent())->removeZoomImage(); - //qDebug() << "size of image-map: " << images.size(); - //qDebug() << "size: " << QPixmapCache::cacheLimit(); - } - - void ImageManager::abortLoading() - { - net->abortLoading(); - } - void ImageManager::setProxy(QString host, int port) - { - net->setProxy(host, port); - } - - void ImageManager::setCacheDir(const QDir& path) - { - doPersistentCaching = true; - cacheDir = path; - if (!cacheDir.exists()) - { - cacheDir.mkpath(cacheDir.absolutePath()); - } - } - - bool ImageManager::saveTile(QString tileName,QPixmap tileData) - { - tileName.replace("/","-"); - - QFile file(cacheDir.absolutePath() + "/" + tileName.toAscii().toBase64()); - - //qDebug() << "writing: " << file.fileName(); - if (!file.open(QIODevice::ReadWrite )){ - qDebug()<<"error reading file"; - return false; - } - QByteArray bytes; - QBuffer buffer(&bytes); - buffer.open(QIODevice::WriteOnly); - tileData.save(&buffer, "PNG"); - // FIXME This is weird - why first write in buffer and then in file? - file.write(bytes); - file.close(); - return true; - } - bool ImageManager::loadTile(QString tileName,QPixmap &tileData) - { - tileName.replace("/","-"); - QFile file(cacheDir.absolutePath() + "/" + tileName.toAscii().toBase64()); - if (!file.open(QIODevice::ReadOnly )) { - return false; - } - tileData.loadFromData( file.readAll() ); - - file.close(); - return true; - } - bool ImageManager::tileExist(QString tileName) - { - tileName.replace("/","-"); - QFile file(cacheDir.absolutePath() + "/" + tileName.toAscii().toBase64()); - if (file.exists()) - return true; - else - return false; - } -} diff --git a/lib/QMapControl/src/imagemanager.h b/lib/QMapControl/src/imagemanager.h deleted file mode 100644 index d4b36f1d0cb56537527b30e06e5ffd4dba1bd849..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/imagemanager.h +++ /dev/null @@ -1,125 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef IMAGEMANAGER_H -#define IMAGEMANAGER_H - -#include -#include -#include -#include -#include -#include -#include -#include "mapnetwork.h" - -namespace qmapcontrol -{ - class MapNetwork; - /** - @author Kai Winter - */ - class ImageManager : public QObject - { - Q_OBJECT; - - public: - static ImageManager* instance() - { - if(!m_Instance) - { - m_Instance = new ImageManager; - } - return m_Instance; - } - - ~ImageManager(); - - //! returns a QPixmap of the asked image - /*! - * If this component doesn´t have the image a network query gets started to load it. - * @param host the host of the image - * @param path the path to the image - * @return the pixmap of the asked image - */ - QPixmap getImage(const QString& host, const QString& path); - - QPixmap prefetchImage(const QString& host, const QString& path); - - void receivedImage(const QPixmap pixmap, const QString& url); - - /*! - * This method is called by MapNetwork, after all images in its queue were loaded. - * The ImageManager emits a signal, which is used in MapControl to remove the zoom image. - * The zoom image should be removed on Tile Images with transparency. - * Else the zoom image stay visible behind the newly loaded tiles. - */ - void loadingQueueEmpty(); - - /*! - * Aborts all current loading threads. - * This is useful when changing the zoom-factor, though newly needed images loads faster - */ - void abortLoading(); - - //! sets the proxy for HTTP connections - /*! - * This method sets the proxy for HTTP connections. - * This is not provided by the current Qtopia version! - * @param host the proxy´s hostname or ip - * @param port the proxy´s port - */ - void setProxy(QString host, int port); - - //! sets the cache directory for persistently saving map tiles - /*! - * - * @param path the path where map tiles should be stored - * @todo add maximum size - */ - void setCacheDir(const QDir& path); - - private: - ImageManager(QObject* parent = 0); - ImageManager(const ImageManager&); - ImageManager& operator=(const ImageManager&); - QPixmap emptyPixmap; - MapNetwork* net; - QVector prefetch; - QDir cacheDir; - bool doPersistentCaching; - - static ImageManager* m_Instance; - - bool saveTile(QString tileName,QPixmap tileData); - bool loadTile(QString tileName,QPixmap &tileData); - bool tileExist(QString tileName); - - signals: - void imageReceived(); - void loadingFinished(); - }; -} -#endif diff --git a/lib/QMapControl/src/imagepoint.cpp b/lib/QMapControl/src/imagepoint.cpp deleted file mode 100644 index dd8a1d84aae486fb95752fa6b68055573a665fec..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/imagepoint.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "imagepoint.h" -namespace qmapcontrol -{ - ImagePoint::ImagePoint(qreal x, qreal y, QString filename, QString name, Alignment alignment) - : Point(x, y, name, alignment) - { - //qDebug() << "loading image: " << filename; - mypixmap = new QPixmap(filename); - size = mypixmap->size(); - //qDebug() << "image size: " << size; - } - - ImagePoint::ImagePoint(qreal x, qreal y, QPixmap* pixmap, QString name, Alignment alignment) - : Point(x, y, name, alignment) - { - mypixmap = pixmap; - size = mypixmap->size(); - } - - - ImagePoint::~ImagePoint() - { - } -} diff --git a/lib/QMapControl/src/imagepoint.h b/lib/QMapControl/src/imagepoint.h deleted file mode 100644 index dde2b9b6ac1877eb3a32a7aaf52684c795f2b6e6..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/imagepoint.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef IMAGEPOINT_H -#define IMAGEPOINT_H - -#include "point.h" - -namespace qmapcontrol -{ - - //! Draws an image into the map - /*! This is a convenience class for Point. - * It configures the pixmap of a Point to draw the given image. - * The image will be loaded from the given path and written in the points pixmap. - * - * @author Kai Winter - */ - class ImagePoint : public Point - { - public: - //! Creates a point which loads and displays the given image file - /*! - * Use this contructor to load the given image file and let the point display it. - * When you want multiple points to display the same image, use the other contructor and pass a pointer to that image. - * @param x longitude - * @param y latitude - * @param filename the file which should be loaded and displayed - * @param name the name of the image point - * @param alignment alignment (Middle or TopLeft) - */ - ImagePoint(qreal x, qreal y, QString filename, QString name = QString(), Alignment alignment = Middle); - - //! Creates a point which displays the given image - /*! - * Use this contructor to display the given image. - * You have to load that image yourself, but can use it for multiple points. - * @param x longitude - * @param y latitude - * @param pixmap pointer to the image pixmap - * @param name the name of the image point - * @param alignment alignment (Middle or TopLeft) - */ - ImagePoint(qreal x, qreal y, QPixmap* pixmap, QString name = QString(), Alignment alignment = Middle); - virtual ~ImagePoint(); - }; -} -#endif diff --git a/lib/QMapControl/src/images/marker1.png b/lib/QMapControl/src/images/marker1.png deleted file mode 100644 index 60b2f9e3c200cf817c78a7bef11ad51598930b91..0000000000000000000000000000000000000000 Binary files a/lib/QMapControl/src/images/marker1.png and /dev/null differ diff --git a/lib/QMapControl/src/images/marker2.png b/lib/QMapControl/src/images/marker2.png deleted file mode 100644 index 7ea3fa10f58d3987787cbd27c4372f71e1286883..0000000000000000000000000000000000000000 Binary files a/lib/QMapControl/src/images/marker2.png and /dev/null differ diff --git a/lib/QMapControl/src/images/marker3.png b/lib/QMapControl/src/images/marker3.png deleted file mode 100644 index 2aa2817652df9e6bd6133f34653b5bdbc8998e00..0000000000000000000000000000000000000000 Binary files a/lib/QMapControl/src/images/marker3.png and /dev/null differ diff --git a/lib/QMapControl/src/layer.cpp b/lib/QMapControl/src/layer.cpp deleted file mode 100644 index dddd4c3d3b1b4bbdae2aa51ce415ea4acc360d75..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/layer.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "layer.h" -namespace qmapcontrol -{ - Layer::Layer(QString layername, MapAdapter* mapadapter, enum LayerType layertype, bool takeevents) - :visible(true), mylayername(layername), mylayertype(layertype), mapAdapter(mapadapter), takeevents(takeevents), myoffscreenViewport(QRect(0,0,0,0)) - { - draggingGeometry = false; - //qDebug() << "creating new Layer: " << layername << ", type: " << contents; - //qDebug() << this->layertype; - } - - Layer::~Layer() - { - delete mapAdapter; - } - - void Layer::setSize(QSize size, QPoint screenmiddle) - { - this->size = size; - this->screenmiddle = screenmiddle;// QPoint(size.width()/2, size.height()/2); - //QMatrix mat; - //mat.translate(480/2, 640/2); - //mat.rotate(45); - //mat.translate(-480/2,-640/2); - //screenmiddle = mat.map(screenmiddle); - } - - QString Layer::layername() const - { - return mylayername; - } - - const MapAdapter* Layer::mapadapter() const - { - return mapAdapter; - } - - void Layer::setVisible(bool visible) - { - this->visible = visible; - emit(updateRequest()); - } - - void Layer::addGeometry(Geometry* geom) - { - //qDebug() << geom->getName() << ", " << geom->getPoints().at(0)->getWidget(); - - geometries.append(geom); - emit(updateRequest(geom->boundingBox())); - //a geometry can request a redraw, e.g. when its position has been changed - connect(geom, SIGNAL(updateRequest(QRectF)), - this, SIGNAL(updateRequest(QRectF))); - } - void Layer::removeGeometry(Geometry* geometry) - { - for (int i=0; iname() == QString::number(index)) - { - geo = geometry; - } - } - -// foreach(Geometry *geometry, geometries) -// { - -// if(geometry->name() == QString::number(index)) -// { -// return geometry; -// } - -// } - } - return geo; - } - - bool Layer::isVisible() const - { - return visible; - } - void Layer::zoomIn() const - { - mapAdapter->zoom_in(); - } - void Layer::zoomOut() const - { - mapAdapter->zoom_out(); - } - - void Layer::mouseEvent(const QMouseEvent* evnt, const QPoint mapmiddle_px) - { - if (takesMouseEvents()) - { - if (evnt->button() == Qt::LeftButton && evnt->type() == QEvent::MouseButtonPress) - { - // check for collision - QPointF c = mapAdapter->displayToCoordinate(QPoint(evnt->x()-screenmiddle.x()+mapmiddle_px.x(), - evnt->y()-screenmiddle.y()+mapmiddle_px.y())); - Point* tmppoint = new Point(c.x(), c.y()); - for (int i=0; iisVisible() && geometries.at(i)->Touches(tmppoint, mapAdapter)) - - //if (geometries.at(i)->Touches(c, mapAdapter)) - { - - emit(geometryClicked(geometries.at(i), QPoint(evnt->x(), evnt->y()))); - draggingGeometry = true; - geometrySelected = geometries.at(i); - } - } - delete tmppoint; - } - - if (evnt->type() == QEvent::MouseButtonRelease){ - QPointF c = mapAdapter->displayToCoordinate(QPoint(evnt->x()-screenmiddle.x()+mapmiddle_px.x(), - evnt->y()-screenmiddle.y()+mapmiddle_px.y())); - draggingGeometry = false; - emit (geometryEndDrag(geometrySelected, c)); - geometrySelected = 0; - } - - if ( evnt->type() == QEvent::MouseMove && draggingGeometry){ - QPointF c = mapAdapter->displayToCoordinate(QPoint(evnt->x()-screenmiddle.x()+mapmiddle_px.x(), - evnt->y()-screenmiddle.y()+mapmiddle_px.y())); - emit(geometryDragged(geometrySelected, c)); - } - } - } - - bool Layer::takesMouseEvents() const - { - return takeevents; - } - - void Layer::drawYourImage(QPainter* painter, const QPoint mapmiddle_px) const - { - if (mylayertype == MapLayer) - { - //qDebug() << ":: " << mapmiddle_px; - //QMatrix mat; - //mat.translate(480/2, 640/2); - //mat.rotate(45); - //mat.translate(-480/2,-640/2); - - //mapmiddle_px = mat.map(mapmiddle_px); - //qDebug() << ":: " << mapmiddle_px; - _draw(painter, mapmiddle_px); - } - - drawYourGeometries(painter, QPoint(mapmiddle_px.x()-screenmiddle.x(), mapmiddle_px.y()-screenmiddle.y()), myoffscreenViewport); - } - void Layer::drawYourGeometries(QPainter* painter, const QPoint mapmiddle_px, QRect viewport) const - { - QPoint offset; - if (mylayertype == MapLayer) - offset = mapmiddle_px; - else - offset = mapmiddle_px-screenmiddle; - - painter->translate(-mapmiddle_px+screenmiddle); - for (int i=0; idraw(painter, mapAdapter, viewport, offset); - } - painter->translate(mapmiddle_px-screenmiddle); - - } - void Layer::_draw(QPainter* painter, const QPoint mapmiddle_px) const - { - // screen middle rotieren... - - int tilesize = mapAdapter->tilesize(); - int cross_x = int(mapmiddle_px.x())%tilesize; // position on middle tile - int cross_y = int(mapmiddle_px.y())%tilesize; - //qDebug() << screenmiddle << " - " << cross_x << ", " << cross_y; - - // calculate how many surrounding tiles have to be drawn to fill the display - int space_left = screenmiddle.x() - cross_x; - int tiles_left = space_left/tilesize; - if (space_left>0) - tiles_left+=1; - - int space_above = screenmiddle.y() - cross_y; - int tiles_above = space_above/tilesize; - if (space_above>0) - tiles_above+=1; - - int space_right = screenmiddle.x() - (tilesize-cross_x); - int tiles_right = space_right/tilesize; - if (space_right>0) - tiles_right+=1; - - int space_bottom = screenmiddle.y() - (tilesize-cross_y); - int tiles_bottom = space_bottom/tilesize; - if (space_bottom>0) - tiles_bottom+=1; - - //int tiles_displayed = 0; - int mapmiddle_tile_x = mapmiddle_px.x()/tilesize; - int mapmiddle_tile_y = mapmiddle_px.y()/tilesize; - - const QPoint from = QPoint((-tiles_left+mapmiddle_tile_x)*tilesize, (-tiles_above+mapmiddle_tile_y)*tilesize); - const QPoint to = QPoint((tiles_right+mapmiddle_tile_x+1)*tilesize, (tiles_bottom+mapmiddle_tile_y+1)*tilesize); - - myoffscreenViewport = QRect(from, to); - - // for the EmptyMapAdapter no tiles should be loaded and painted. - if (mapAdapter->host() == "") - { - return; - } - - if (mapAdapter->isValid(mapmiddle_tile_x, mapmiddle_tile_y, mapAdapter->currentZoom())) - { - painter->drawPixmap(-cross_x+size.width(), - -cross_y+size.height(), - ImageManager::instance()->getImage(mapAdapter->host(), mapAdapter->query(mapmiddle_tile_x, mapmiddle_tile_y, mapAdapter->currentZoom()))); - } - - for (int i=-tiles_left+mapmiddle_tile_x; i<=tiles_right+mapmiddle_tile_x; i++) - { - for (int j=-tiles_above+mapmiddle_tile_y; j<=tiles_bottom+mapmiddle_tile_y; j++) - { - // check if image is valid - if (!(i==mapmiddle_tile_x && j==mapmiddle_tile_y)) - if (mapAdapter->isValid(i, j, mapAdapter->currentZoom())) - { - - painter->drawPixmap(((i-mapmiddle_tile_x)*tilesize)-cross_x+size.width(), - ((j-mapmiddle_tile_y)*tilesize)-cross_y+size.height(), - ImageManager::instance()->getImage(mapAdapter->host(), mapAdapter->query(i, j, mapAdapter->currentZoom()))); - //if (QCoreApplication::hasPendingEvents()) - // QCoreApplication::processEvents(); - } - } - } - - - // PREFETCHING - - // FIXME Make prefetching a parameter - int upper = mapmiddle_tile_y-tiles_above-2; - int right = mapmiddle_tile_x+tiles_right+2; - int left = mapmiddle_tile_x-tiles_right-2; - int lower = mapmiddle_tile_y+tiles_bottom+2; - - int j = upper; - for (int i=left; i<=right; i++) - { - if (mapAdapter->isValid(i, j, mapAdapter->currentZoom())) - ImageManager::instance()->prefetchImage(mapAdapter->host(), mapAdapter->query(i, j, mapAdapter->currentZoom())); - } - j = lower; - for (int i=left; i<=right; i++) - { - if (mapAdapter->isValid(i, j, mapAdapter->currentZoom())) - ImageManager::instance()->prefetchImage(mapAdapter->host(), mapAdapter->query(i, j, mapAdapter->currentZoom())); - } - int i = left; - for (int j=upper+1; j<=lower-1; j++) - { - if (mapAdapter->isValid(i, j, mapAdapter->currentZoom())) - ImageManager::instance()->prefetchImage(mapAdapter->host(), mapAdapter->query(i, j, mapAdapter->currentZoom())); - } - i = right; - for (int j=upper+1; j<=lower-1; j++) - { - if (mapAdapter->isValid(i, j, mapAdapter->currentZoom())) - ImageManager::instance()->prefetchImage(mapAdapter->host(), mapAdapter->query(i, j, mapAdapter->currentZoom())); - } - } - - QRect Layer::offscreenViewport() const - { - return myoffscreenViewport; - } - - void Layer::moveWidgets(const QPoint mapmiddle_px) const - { - for (int i=0; iGeometryType == "Point") - { - if (((Point*)geom)->widget()!=0) - { - QPoint topleft_relative = QPoint(mapmiddle_px-screenmiddle); - ((Point*)geom)->drawWidget(mapAdapter, topleft_relative); - } - } - } - } - Layer::LayerType Layer::layertype() const - { - return mylayertype; - } - - void Layer::setMapAdapter(MapAdapter* mapadapter) - { - - mapAdapter = mapadapter; - } -} - - diff --git a/lib/QMapControl/src/layer.h b/lib/QMapControl/src/layer.h deleted file mode 100644 index 48db8b4aa1f80291529ba2047a7e614d7babb3e9..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/layer.h +++ /dev/null @@ -1,211 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef LAYER_H -#define LAYER_H - -#include -#include -#include -#include - -#include "mapadapter.h" -#include "layermanager.h" -#include "geometry.h" -#include "point.h" - -#include "wmsmapadapter.h" -#include "tilemapadapter.h" - -namespace qmapcontrol -{ - //! Layer class - /*! - * There are two different layer types: - * - MapLayer: Displays Maps, but also Geometries. The configuration for displaying maps have to be done in the MapAdapter - * - GeometryLayer: Only displays Geometry objects. - * - * MapLayers also can display Geometry objects. The difference to the GeometryLayer is the repainting. Objects that are - * added to a MapLayer are "baken" on the map. This means, when you change it´s position for example the changes are - * not visible until a new offscreen image has been drawn. If you have "static" Geometries which won´t change their - * position this is fine. But if you want to change the objects position or pen you should use a GeometryLayer. Those - * are repainted immediately on changes. - * You can either use this class and give a layertype on creation or you can use the classes MapLayer and GeometryLayer. - * - * @author Kai Winter - */ - class Layer : public QObject - { - Q_OBJECT - - public: - friend class LayerManager; - - - //! sets the type of a layer, see Layer class doc for further information - enum LayerType - { - MapLayer, /*!< uses the MapAdapter to display maps, only gets refreshed when a new offscreen image is needed */ - GeometryLayer /*!< gets refreshed everytime when a geometry changes */ - }; - - //! Layer constructor - /*! - * This is used to construct a layer. - * - * @param layername The name of the Layer - * @param mapadapter The MapAdapter which does coordinate translation and Query-String-Forming - * @param layertype The above explained LayerType - * @param takeevents Should the Layer receive MouseEvents? This is set to true by default. Setting it to false could - * be something like a "speed up hint" - */ - Layer(QString layername, MapAdapter* mapadapter, enum LayerType layertype, bool takeevents=true); - virtual ~Layer(); - - //! returns the layer's name - /*! - * @return the name of this layer - */ - QString layername() const; - - //! returns the layer´s MapAdapter - /*! - * This method returns the MapAdapter of this Layer, which can be useful - * to do coordinate transformations. - * @return the MapAdapter which us used by this Layer - */ - const MapAdapter* mapadapter() const; - - //! adds a Geometry object to this Layer - /*! - * Please notice the different LayerTypes (MapLayer and GeometryLayer) and the differences - * @param geometry the new Geometry - */ - void addGeometry(Geometry* geometry); - - //! removes the Geometry object from this Layer - /*! - * This method removes a Geometry object from this Layer. - */ - void removeGeometry(Geometry* geometry); - - //! removes all Geometry objects from this Layer - /*! - * This method removes all Geometry objects from this Layer. - */ - void clearGeometries(); - - //! return true if the layer is visible - /*! - * @return if the layer is visible - */ - bool isVisible() const; - - //! returns the LayerType of the Layer - /*! - * There are two LayerTypes: MapLayer and GeometryLayer - * @return the LayerType of this Layer - */ - Layer::LayerType layertype() const; - - void setMapAdapter(MapAdapter* mapadapter); - - Layer& operator=(const Layer& rhs); - Layer(const Layer& old); - - private: - void moveWidgets(const QPoint mapmiddle_px) const; - void drawYourImage(QPainter* painter, const QPoint mapmiddle_px) const; - void drawYourGeometries(QPainter* painter, const QPoint mapmiddle_px, QRect viewport) const; - void setSize(QSize size, QPoint screenmiddle); - QRect offscreenViewport() const; - bool takesMouseEvents() const; - void mouseEvent(const QMouseEvent*, const QPoint mapmiddle_px); - void zoomIn() const; - void zoomOut() const; - void _draw(QPainter* painter, const QPoint mapmiddle_px) const; - - bool visible; - QString mylayername; - LayerType mylayertype; - QSize size; - QPoint screenmiddle; - - QList geometries; - MapAdapter* mapAdapter; - bool takeevents; - mutable QRect myoffscreenViewport; - - Geometry* geometrySelected; - bool draggingGeometry; - - signals: - //! This signal is emitted when a Geometry is clicked - /*! - * A Geometry is clickable, if the containing layer is clickable. - * The layer emits a signal for every clicked geometry - * @param geometry The clicked Geometry - * @param point The coordinate (in widget coordinates) of the click - */ - void geometryClicked(Geometry* geometry, QPoint point); - - //! This signal is emitted while a Geometry is being dragged - /*! - * A Geometry is clickable, if the containing layer is clickable. - * The layer emits a signal as it is dragged - * @param geometry The selected Geometry - * @param coordinate The new coordinate (in world coordinates) - */ - void geometryDragged(Geometry* geometrySelected, QPointF coordinate); - - - //! This signal is emitted when a User releases the button after selecting a Geometry - /*! - * A Geometry is clickable, if the containing layer is clickable. - * The layer emits a signal when it is released - * @param geometry The selected Geometry - * @param coordinate The new coordinate (in world coordinates) - */ - void geometryEndDrag(Geometry* geometrySelected, QPointF coordinate); - - void updateRequest(QRectF rect); - void updateRequest(); - - public slots: - //! if visible is true, the layer is made visible - /*! - * @param visible if the layer should be visible - */ - void setVisible(bool visible); - - //! get geometry selected by index - /*! - * @param index of geometry selected - */ - Geometry* get_Geometry(int index); - - }; -} -#endif diff --git a/lib/QMapControl/src/layermanager.cpp b/lib/QMapControl/src/layermanager.cpp deleted file mode 100644 index 7721e7448e4274932e9f9a050ead67ccfbd55c36..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/layermanager.cpp +++ /dev/null @@ -1,502 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "layermanager.h" -namespace qmapcontrol -{ - LayerManager::LayerManager(MapControl* mapcontrol, QSize size) - :mapcontrol(mapcontrol), scroll(QPoint(0,0)), size(size), whilenewscroll(QPoint(0,0)) - { - setOffscreenImageFactor(2); - zoomImage = QPixmap(size); - zoomImage.fill(Qt::black); - screenmiddle = QPoint(size.width()/2, size.height()/2); - } - - - LayerManager::~LayerManager() - { - mylayers.clear(); - } - - void LayerManager::setOffscreenImageFactor(float factor) - { - offSize = size * factor; - offFactor = factor; - composedOffscreenImage = QPixmap(offSize); - composedOffscreenImage2 = QPixmap(offSize); - resize(size); - } - - float LayerManager::offscreenImageFactor() - { - return offFactor; - } - - QPointF LayerManager::currentCoordinate() const - { - return mapmiddle; - } - - QPixmap LayerManager::getImage() const - { - return composedOffscreenImage; - } - - Layer* LayerManager::layer() const - { - Q_ASSERT_X(mylayers.size()>0, "LayerManager::getLayer()", "No layers were added!"); - return mylayers.first(); - } - - Layer* LayerManager::layer(const QString& layername) const - { - QListIterator layerit(mylayers); - while (layerit.hasNext()) - { - Layer* l = layerit.next(); - if (l->layername() == layername) - return l; - } - return 0; - } - - QList LayerManager::layers() const - { - QList keys; - QListIterator layerit(mylayers); - while (layerit.hasNext()) - { - keys.append(layerit.next()->layername()); - } - return keys; - } - - - void LayerManager::scrollView(const QPoint& point) - { - scroll += point; - zoomImageScroll+=point; - mapmiddle_px += point; - - mapmiddle = layer()->mapadapter()->displayToCoordinate(mapmiddle_px); - if (!checkOffscreen()) - { - newOffscreenImage(); - } - else - { - moveWidgets(); - } - } - - void LayerManager::moveWidgets() - { - QListIterator it(mylayers); - while (it.hasNext()) - { - it.next()->moveWidgets(mapmiddle_px); - } - } - - void LayerManager::setView(const QPointF& coordinate) - { - QPoint oldMapPx = mapmiddle_px; - - mapmiddle_px = layer()->mapadapter()->coordinateToDisplay(coordinate); - - scroll += mapmiddle_px - oldMapPx; - zoomImageScroll+= mapmiddle_px - oldMapPx; - - - mapmiddle = coordinate; - - //TODO: muss wegen moveTo() raus - if (!checkOffscreen()) - { - newOffscreenImage(); - } - else - { - //TODO: - // verschiebung ausrechnen - // oder immer neues offscreenimage - //newOffscreenImage(); - moveWidgets(); - } - } - - void LayerManager::setView(QList coordinates) - { - setMiddle(coordinates); - // mapcontrol->update(); - } - - void LayerManager::setViewAndZoomIn(const QList coordinates) - { - while (containsAll(coordinates)) - { - setMiddle(coordinates); - zoomIn(); - } - - - if (!containsAll(coordinates)) - { - zoomOut(); - } - - mapcontrol->update(); - } - - void LayerManager::setMiddle(QList coordinates) - { - int sum_x = 0; - int sum_y = 0; - for (int i=0; imapadapter()->coordinateToDisplay(coordinates.at(i)); - sum_x += p.x(); - sum_y += p.y(); - } - QPointF middle = layer()->mapadapter()->displayToCoordinate(QPoint(sum_x/coordinates.size(), sum_y/coordinates.size())); - // middle in px rechnen! - - setView(middle); - } - - bool LayerManager::containsAll(QList coordinates) const - { - QRectF bb = getViewport(); - bool containsall = true; - for (int i=0; imapadapter()->displayToCoordinate(upperLeft); - QPointF lrCoord = layer()->mapadapter()->displayToCoordinate(lowerRight); - - QRectF coordinateBB = QRectF(ulCoord, QSizeF( (lrCoord-ulCoord).x(), (lrCoord-ulCoord).y())); - return coordinateBB; - } - - void LayerManager::addLayer(Layer* layer) - { - mylayers.append(layer); - - layer->setSize(size, screenmiddle); - - connect(layer, SIGNAL(updateRequest(QRectF)), - this, SLOT(updateRequest(QRectF))); - connect(layer, SIGNAL(updateRequest()), - this, SLOT(updateRequest())); - - if (mylayers.size()==1) - { - setView(QPointF(0,0)); - } - } - - void LayerManager::newOffscreenImage(bool clearImage, bool showZoomImage) - { - // qDebug() << "LayerManager::newOffscreenImage()"; - whilenewscroll = mapmiddle_px; - - if (clearImage) - { - composedOffscreenImage2.fill(Qt::black); - } - - QPainter painter(&composedOffscreenImage2); - if (showZoomImage) - { - painter.drawPixmap(screenmiddle.x()-zoomImageScroll.x(), screenmiddle.y()-zoomImageScroll.y(),zoomImage); - } - //only draw basemaps - for (int i=0; iisVisible()) - { - if (l->layertype() == Layer::MapLayer) - { - l->drawYourImage(&painter, whilenewscroll); - } - } - } - - composedOffscreenImage = composedOffscreenImage2; - scroll = mapmiddle_px-whilenewscroll; - - mapcontrol->update(); - } - - void LayerManager::zoomIn() - { - QCoreApplication::processEvents(); - - ImageManager::instance()->abortLoading(); - // layer rendern abbrechen? - zoomImageScroll = QPoint(0,0); - - zoomImage.fill(Qt::black); - QPixmap tmpImg = composedOffscreenImage.copy(screenmiddle.x()+scroll.x(),screenmiddle.y()+scroll.y(), size.width(), size.height()); - - QPainter painter(&zoomImage); - painter.translate(screenmiddle); - painter.scale(2, 2); - painter.translate(-screenmiddle); - - painter.drawPixmap(0,0,tmpImg); - - QListIterator it(mylayers); - //TODO: remove hack, that mapadapters wont get set zoom multiple times - QList doneadapters; - while (it.hasNext()) - { - Layer* l = it.next(); - if (!doneadapters.contains(l->mapadapter())) - { - l->zoomIn(); - doneadapters.append(l->mapadapter()); - } - } - mapmiddle_px = layer()->mapadapter()->coordinateToDisplay(mapmiddle); - whilenewscroll = mapmiddle_px; - - newOffscreenImage(); - - } - - bool LayerManager::checkOffscreen() const - { - // calculate offscreenImage dimension (px) - QPoint upperLeft = mapmiddle_px - screenmiddle; - QPoint lowerRight = mapmiddle_px + screenmiddle; - QRect viewport = QRect(upperLeft, lowerRight); - - QRect testRect = layer()->offscreenViewport(); - - if (!testRect.contains(viewport)) - { - return false; - } - - return true; - } - void LayerManager::zoomOut() - { - QCoreApplication::processEvents(); - ImageManager::instance()->abortLoading(); - zoomImageScroll = QPoint(0,0); - zoomImage.fill(Qt::white); - QPixmap tmpImg = composedOffscreenImage.copy(screenmiddle.x()+scroll.x(),screenmiddle.y()+scroll.y(), size.width(), size.height()); - QPainter painter(&zoomImage); - painter.translate(screenmiddle); - painter.scale(0.500001,0.500001); - painter.translate(-screenmiddle); - painter.drawPixmap(0,0,tmpImg); - - painter.translate(screenmiddle); - painter.scale(2,2); - painter.translate(-screenmiddle); - - QListIterator it(mylayers); - //TODO: remove hack, that mapadapters wont get set zoom multiple times - QList doneadapters; - while (it.hasNext()) - { - Layer* l = it.next(); - if (!doneadapters.contains(l->mapadapter())) - { - l->zoomOut(); - doneadapters.append(l->mapadapter()); - } - } - mapmiddle_px = layer()->mapadapter()->coordinateToDisplay(mapmiddle); - whilenewscroll = mapmiddle_px; - newOffscreenImage(); - } - - void LayerManager::setZoom(int zoomlevel) - { - int current_zoom; - if (layer()->mapadapter()->minZoom() < layer()->mapadapter()->maxZoom()) - { - current_zoom = layer()->mapadapter()->currentZoom(); - } - else - { - current_zoom = layer()->mapadapter()->minZoom() - layer()->mapadapter()->currentZoom(); - } - - - if (zoomlevel < current_zoom) - { - for (int i=current_zoom; i>zoomlevel; i--) - { - zoomOut(); - } - } - else - { - for (int i=current_zoom; iisVisible()) - { - l->mouseEvent(evnt, mapmiddle_px); - } - } -// QListIterator it(mylayers); - -// while (it.hasNext()) -// { -// qDebug() << it.next(); -// Layer* l = it.next(); -// if (l->isVisible()) -// { -// l->mouseEvent(evnt, mapmiddle_px); -// } -// } - } - - void LayerManager::updateRequest(QRectF rect) - { - const QPoint topleft = mapmiddle_px - screenmiddle; - - QPointF c = rect.topLeft(); - - if (getViewport().contains(c) || getViewport().contains(rect.bottomRight())) - { - // QPoint point = getLayer()->getMapAdapter()->coordinateToDisplay(c); - // QPoint finalpoint = point-topleft; - // QRect rect_px = QRect(int(finalpoint.x()-(rect.width()-1)/2), int(finalpoint.y()-(rect.height()-1)/2), - // int(rect.width()+1), int(rect.height()+1)); - // - // mapcontrol->updateRequest(rect_px); - mapcontrol->update(); - // newOffscreenImage(); - } - } - void LayerManager::updateRequest() - { - newOffscreenImage(); - } - void LayerManager::forceRedraw() - { - newOffscreenImage(); - } - void LayerManager::removeZoomImage() - { - zoomImage.fill(Qt::white); - forceRedraw(); - } - - void LayerManager::drawGeoms() - { - QPainter painter(&composedOffscreenImage); - QListIterator it(mylayers); - while (it.hasNext()) - { - Layer* l = it.next(); - if (l->layertype() == Layer::GeometryLayer && l->isVisible()) - { - l->drawYourGeometries(&painter, mapmiddle_px, layer()->offscreenViewport()); - } - } - } - - void LayerManager::drawGeoms(QPainter* painter) - { - QListIterator it(mylayers); - while (it.hasNext()) - { - Layer* l = it.next(); - if (l->layertype() == Layer::GeometryLayer && l->isVisible()) - { - l->drawYourGeometries(painter, mapmiddle_px, layer()->offscreenViewport()); - } - } - } - - - void LayerManager::drawImage(QPainter* painter) - { - painter->drawPixmap(-scroll.x()-screenmiddle.x(), - -scroll.y()-screenmiddle.y(), - composedOffscreenImage); - } - - int LayerManager::currentZoom() const - { - return layer()->mapadapter()->currentZoom(); - } - - void LayerManager::resize(QSize newSize) - { - size = newSize; - offSize = newSize *offFactor; - composedOffscreenImage = QPixmap(offSize); - composedOffscreenImage2 = QPixmap(offSize); - zoomImage = QPixmap(newSize); - zoomImage.fill(Qt::black); - - screenmiddle = QPoint(newSize.width()/2, newSize.height()/2); - - QListIterator it(mylayers); - while (it.hasNext()) - { - Layer* l = it.next(); - l->setSize(newSize, screenmiddle); - } - - newOffscreenImage(); - } -} diff --git a/lib/QMapControl/src/layermanager.h b/lib/QMapControl/src/layermanager.h deleted file mode 100644 index 89bdf4e4a21ada4ba24395e12237ce460c4cf985..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/layermanager.h +++ /dev/null @@ -1,219 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef LAYERMANAGER_H -#define LAYERMANAGER_H - -#include -#include -#include -#include "layer.h" -#include "mapadapter.h" -#include "mapcontrol.h" - -namespace qmapcontrol -{ - class Layer; - class MapAdapter; - class MapControl; - - class LayerManager; - - //! Handles Layers and viewport related settings - /*! - * This class handles internally all layers which were added to the MapControl. - * It also stores values for scrolling. - * It initiates the creation of a new offscreen image and on zooming the zoom images gets here created. - * @author Kai Winter - */ - class LayerManager : public QObject - { - Q_OBJECT - - public: - LayerManager(MapControl*, QSize); - ~LayerManager(); - - //! returns the coordinate of the center of the map - /*! - * @return returns the coordinate of the middle of the screen - */ - QPointF currentCoordinate() const; - - //! returns the current offscreen image - /*! - * @return the current offscreen image - */ - QPixmap getImage() const; - - //! returns the layer with the given name - /*! - * @param layername name of the wanted layer - * @return the layer with the given name - */ - Layer* layer(const QString&) const; - - //! returns the base layer - /*! - * This will return the base layer of the LayerManager. - * The base layer is the one which is used to do internal coordinate calculations. - * @return the base layer - */ - Layer* layer() const; - - //! returns the names of all layers - /*! - * @return returns a QList with the names of all layers - */ - QList layers() const; - - //! sets the middle of the map to the given coordinate - /*! - * @param coordinate the coordinate which the view´s middle should be set to - */ - void setView(const QPointF& coordinate); - - //! sets the view, so all coordinates are visible - /*! - * @param coordinates the Coorinates which should be visible - */ - void setView(const QList coordinates); - - //! sets the view and zooms in, so all coordinates are visible - /*! - * The code of setting the view to multiple coordinates is "brute force" and pretty slow. - * Have to be reworked. - * @param coordinates the Coorinates which should be visible - */ - void setViewAndZoomIn (const QList coordinates); - - //! zooms in one step - void zoomIn(); - - //! zooms out one step - void zoomOut(); - - //! sets the given zoomlevel - /*! - * @param zoomlevel the zoomlevel - */ - void setZoom(int zoomlevel); - - //! Sets the factor the offscreen image should be larger than the visible area - void setOffscreenImageFactor(float factor); - //! Get the factor the offscreen image is larger than the screen - float offscreenImageFactor(); - - //! The Viewport of the display - /*! - * Returns the visible viewport in world coordinates - * @return the visible viewport in world coordinates - */ - QRectF getViewport() const; - - //! scrolls the view - /*! - * Scrolls the view by the given value in pixels and in display coordinates - * @param offset the distance which the view should be scrolled - */ - void scrollView(const QPoint& offset); - - //! forwards mouseevents to the layers - /*! - * This method is invoked by the MapControl which receives Mouse Events. - * These events are forwarded to the layers, so they can check for clicked geometries. - * @param evnt the mouse event - */ - void mouseEvent(const QMouseEvent* evnt); - - //! returns the middle of the map in projection coordinates - /*! - * - * @return the middle of the map in projection coordinates - */ - QPoint getMapmiddle_px() const; - - void forceRedraw(); - void removeZoomImage(); - - //! adds a layer - /*! - * If multiple layers are added, they are painted in the added order. - * @param layer the layer which should be added - */ - void addLayer(Layer* layer); - - //! returns the current zoom level - /*! - * @return returns the current zoom level - */ - int currentZoom() const; - - - void drawGeoms(); - void drawGeoms(QPainter* painter); - void drawImage(QPainter* painter); - - private: - LayerManager& operator=(const LayerManager& rhs); - LayerManager(const LayerManager& old); - //! This method has to be invoked to draw a new offscreen image - /*! - * @param clearImage if the current offscreeen image should be cleared - * @param showZoomImage if a zoom image should be painted - */ - void newOffscreenImage(bool clearImage=true, bool showZoomImage=true); - inline bool checkOffscreen() const; - inline bool containsAll(QList coordinates) const; - inline void moveWidgets(); - inline void setMiddle(QList coordinates); - - MapControl* mapcontrol; - QPoint screenmiddle; // middle of the screen - QPoint scroll; // scrollvalue of the offscreen image - QPoint zoomImageScroll; // scrollvalue of the zoom image - - QSize size; ///< widget size - QSize offSize; ///< size of the offscreen image - float offFactor; ///< Size of the offscreen image - - QPixmap composedOffscreenImage; - QPixmap composedOffscreenImage2; - QPixmap zoomImage; - - QList mylayers; - - QPoint mapmiddle_px; // projection-display coordinates - QPointF mapmiddle; // world coordinate - - QPoint whilenewscroll; - - public slots: - void updateRequest(QRectF rect); - void updateRequest(); - void resize(QSize newSize); - }; -} -#endif diff --git a/lib/QMapControl/src/linestring.cpp b/lib/QMapControl/src/linestring.cpp deleted file mode 100644 index 0f60d9a1d91b8b2ee72a4a65af221fb327bd30b4..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/linestring.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "linestring.h" -namespace qmapcontrol -{ - LineString::LineString() - : Curve() - { - GeometryType = "LineString"; - } - - LineString::LineString(QList const points, QString name, QPen* pen) - :Curve(name) - { - mypen = pen; - LineString(); - setPoints(points); - } - - LineString::~LineString() - { - } - - // Geometry LineString::Clone(){} - - // Point LineString::EndPoint(){} - // Point LineString::StartPoint(){} - // Point LineString::Value(){} - - - void LineString::addPoint(Point* point) - { - vertices.append(point); - } - - void LineString::clearPoints() - { - vertices.clear(); - } - - QList& LineString::points() - { - return vertices; - } - - void LineString::setPoints(QList points) - { - for (int i=0; isetParentGeometry(this); - } - vertices = points; - } - - void LineString::draw(QPainter* painter, const MapAdapter* mapadapter, const QRect &screensize, const QPoint offset) - { - if (!visible) - return; - - QPolygon p = QPolygon(); - - QPointF c; - for (int i=0; icoordinate(); - p.append(mapadapter->coordinateToDisplay(c)); - } - if (mypen != 0) - { - painter->save(); - painter->setPen(*mypen); - } - painter->drawPolyline(p); - if (mypen != 0) - { - painter->restore(); - } - for (int i=0; idraw(painter, mapadapter, screensize, offset); - } - } - - int LineString::numberOfPoints() const - { - return vertices.count(); - } - bool LineString::Touches(Point* geom, const MapAdapter* mapadapter) - { - // qDebug() << "LineString::Touches Point"; - touchedPoints.clear(); - bool touches = false; - for (int i=0; iTouches(geom, mapadapter)) - { - touchedPoints.append(vertices.at(i)); - - touches = true; - } - } - if (touches) - { - emit(geometryClicked(this, QPoint(0,0))); - } - return touches; - } - bool LineString::Touches(Geometry* /*geom*/, const MapAdapter* /*mapadapter*/) - { - // qDebug() << "LineString::Touches Geom"; - touchedPoints.clear(); - - return false; - } - - QList LineString::clickedPoints() - { - return touchedPoints; - } - bool LineString::hasPoints() const - { - return vertices.size() > 0 ? true : false; - } - bool LineString::hasClickedPoints() const - { - return touchedPoints.size() > 0 ? true : false; - } - - QRectF LineString::boundingBox() - { - qreal minlon=180; - qreal maxlon=-180; - qreal minlat=90; - qreal maxlat=-90; - for (int i=0; ilongitude() < minlon) minlon = tmp->longitude(); - if (tmp->longitude() > maxlon) maxlon = tmp->longitude(); - if (tmp->latitude() < minlat) minlat = tmp->latitude(); - if (tmp->latitude() > maxlat) maxlat = tmp->latitude(); - } - QPointF min = QPointF(minlon, minlat); - QPointF max = QPointF(maxlon, maxlat); - QPointF dist = max - min; - QSizeF si = QSizeF(dist.x(), dist.y()); - - return QRectF(min, si); - - } -} diff --git a/lib/QMapControl/src/linestring.h b/lib/QMapControl/src/linestring.h deleted file mode 100644 index 355e568d2e93ca613bb21860b1df12c0464328fc..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/linestring.h +++ /dev/null @@ -1,123 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef LINESTRING_H -#define LINESTRING_H - -#include "curve.h" - -namespace qmapcontrol -{ - //! A collection of Point objects to describe a line - /*! - * A LineString is a Curve with linear interpolation between Points. Each consecutive pair of Points defines a Line segment. - * @author Kai Winter - */ - class LineString : public Curve - { - Q_OBJECT - - public: - LineString(); - //! constructor - /*! - * The constructor of a LineString takes a list of Points to form a line. - * @param points a list of points - * @param name the name of the LineString - * @param pen a QPen can be used to modify the look of the line. - * @see http://doc.trolltech.com/4.3/qpen.html - */ - LineString ( QList const points, QString name = QString(), QPen* pen = 0 ); - virtual ~LineString(); - - //! returns the points of the LineString - /*! - * @return a list with the points of the LineString - */ - QList& points(); - - //! adds a point at the end of the LineString - /*! - * @param point the point which should be added to the LineString - */ - void addPoint ( Point* point ); - - //! Remove all points from the LineString - void clearPoints(); - - //! sets the given list as points of the LineString - /*! - * @param points the points which should be set for the LineString - */ - void setPoints ( QList points ); - - //! returns the number of Points the LineString consists of - /*! - * @return the number of the LineString´s Points - */ - int numberOfPoints() const; - - // virtual Geometry Clone(); - virtual QRectF boundingBox(); - // virtual Point EndPoint(); - // virtual Point StartPoint(); - // virtual Point Value(); - - //! returns true if the LineString has Childs - /*! - * This is equal to: numberOfPoints() > 0 - * @return true it the LineString has Childs (=Points) - * @see clickedPoints() - */ - virtual bool hasPoints() const; - - //! returns true if the LineString has clicked Points - /*! - * @return true if childs of a LineString were clicked - * @see clickedPoints() - */ - virtual bool hasClickedPoints() const; - - //! returns the clicked Points - /*! - * If a LineString was clicked it could be neccessary to figure out which of its points where clicked. - * Do do so the methods hasPoints() and clickedPoints() can be used. - * When a point is added to a LineString the Point becomes its child. - * It is possible (depending on the zoomfactor) to click more than one Point of a LineString, so this method returns a list. - * @return the clicked Points of the LineString - */ - virtual QList clickedPoints(); - - protected: - virtual bool Touches ( Geometry* geom, const MapAdapter* mapadapter ); - virtual bool Touches ( Point* geom, const MapAdapter* mapadapter ); - virtual void draw ( QPainter* painter, const MapAdapter* mapadapter, const QRect &screensize, const QPoint offset ); - - private: - QList vertices; - QList touchedPoints; - }; -} -#endif diff --git a/lib/QMapControl/src/mapadapter.cpp b/lib/QMapControl/src/mapadapter.cpp deleted file mode 100644 index 36e9ddb15e19d0fe9a6f8d7f31587d861b47da14..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/mapadapter.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "mapadapter.h" -namespace qmapcontrol -{ - MapAdapter::MapAdapter(const QString& host, const QString& serverPath, int tilesize, int minZoom, int maxZoom) - :myhost(host), serverPath(serverPath), mytilesize(tilesize), min_zoom(minZoom), max_zoom(maxZoom) - { - current_zoom = min_zoom; - loc = QLocale(QLocale::English); - } - - MapAdapter::~MapAdapter() - { - } - - QString MapAdapter::host() const - { - return myhost; - } - - int MapAdapter::tilesize() const - { - return mytilesize; - } - - int MapAdapter::minZoom() const - { - return min_zoom; - } - - int MapAdapter::maxZoom() const - { - return max_zoom; - } - - int MapAdapter::currentZoom() const - { - return current_zoom; - } - - int MapAdapter::adaptedZoom() const - { - return max_zoom < min_zoom ? min_zoom - current_zoom : current_zoom; - } -} diff --git a/lib/QMapControl/src/mapadapter.h b/lib/QMapControl/src/mapadapter.h deleted file mode 100644 index be52c71ed6a402bebce9282b2c6c37b4804ee885..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/mapadapter.h +++ /dev/null @@ -1,151 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef MAPADAPTER_H -#define MAPADAPTER_H - -#include -#include -#include -#include -#include -#include -#include - -namespace qmapcontrol -{ - //! Used to fit map servers into QMapControl - /*! - * MapAdapters are needed to convert between world- and display coordinates. - * This calculations depend on the used map projection. - * There are two ready-made MapAdapters: - * - TileMapAdapter, which is ready to use for OpenStreetMap or Google (Mercator projection) - * - WMSMapAdapter, which could be used for the most WMS-Server (some servers show errors, because of image ratio) - * - * MapAdapters are also needed to form the HTTP-Queries to load the map tiles. - * The maps from WMS Servers are also divided into tiles, because those can be better cached. - * - * @see TileMapAdapter, @see WMSMapAdapter - * - * @author Kai Winter - */ - class MapAdapter : public QObject - { - friend class Layer; - - Q_OBJECT - - public: - virtual ~MapAdapter(); - - //! returns the host of this MapAdapter - /*! - * @return the host of this MapAdapter - */ - QString host() const; - - //! returns the size of the tiles - /*! - * @return the size of the tiles - */ - int tilesize() const; - - //! returns the min zoom value - /*! - * @return the min zoom value - */ - int minZoom() const; - - //! returns the max zoom value - /*! - * @return the max zoom value - */ - int maxZoom() const; - - //! returns the current zoom - /*! - * @return the current zoom - */ - int currentZoom() const; - - virtual int adaptedZoom()const; - - //! translates a world coordinate to display coordinate - /*! - * The calculations also needs the current zoom. The current zoom is managed by the MapAdapter, so this is no problem. - * To divide model from view the current zoom should be moved to the layers. - * @param coordinate the world coordinate - * @return the display coordinate (in widget coordinates) - */ - virtual QPoint coordinateToDisplay(const QPointF& coordinate) const = 0; - - //! translates display coordinate to world coordinate - /*! - * The calculations also needs the current zoom. The current zoom is managed by the MapAdapter, so this is no problem. - * To divide model from view the current zoom should be moved to the layers. - * @param point the display coordinate - * @return the world coordinate - */ - virtual QPointF displayToCoordinate(const QPoint& point) const = 0; - - protected: - MapAdapter(const QString& host, const QString& serverPath, int tilesize, int minZoom = 0, int maxZoom = 0); - virtual void zoom_in() = 0; - virtual void zoom_out() = 0; - virtual bool isValid(int x, int y, int z) const = 0; - virtual QString query(int x, int y, int z) const = 0; - - QSize size; - QString myhost; - QString serverPath; - int mytilesize; - int min_zoom; - int max_zoom; - int current_zoom; - - int param1; - int param2; - int param3; - int param4; - int param5; - int param6; - - QString sub1; - QString sub2; - QString sub3; - QString sub4; - QString sub5; - QString sub6; - - int order[3][2]; - - int middle_x; - int middle_y; - - qreal numberOfTiles; - QLocale loc; - }; -} -#endif diff --git a/lib/QMapControl/src/mapcontrol.cpp b/lib/QMapControl/src/mapcontrol.cpp deleted file mode 100644 index 12a70a5a41f5733bdab747159ea8599661819f00..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/mapcontrol.cpp +++ /dev/null @@ -1,488 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include -#include - -#include "mapcontrol.h" -namespace qmapcontrol -{ - MapControl::MapControl(QSize size, MouseMode mousemode) - : size(size), mymousemode(mousemode), scaleVisible(false), cursorPosVisible(false), mapPen(Qt::black) - { - layermanager = new LayerManager(this, size); - screen_middle = QPoint(size.width()/2, size.height()/2); - - mousepressed = false; - - connect(ImageManager::instance(), SIGNAL(imageReceived()), - this, SLOT(updateRequestNew())); - - connect(ImageManager::instance(), SIGNAL(loadingFinished()), - this, SLOT(loadingFinished())); - - this->setMaximumSize(size.width()+1, size.height()+1); - - distanceList<<5000000<<2000000<<1000000<<1000000<<1000000<<100000<<100000<<50000<<50000<<10000<<10000<<10000<<1000<<1000<<500<<200<<100<<50<<25; - - } - - MapControl::~MapControl() - { - delete layermanager; - } - - QPointF MapControl::currentCoordinate() const - { - return layermanager->currentCoordinate(); - } - - Layer* MapControl::layer(const QString& layername) const - { - return layermanager->layer(layername); - } - - void MapControl::setOffscreenImageFactor(double factor) - { - layermanager->setOffscreenImageFactor(factor); - } - - float MapControl::offscreenImageFactor() - { - return layermanager->offscreenImageFactor(); - } - - void MapControl::openImageSaveDialog() - { - QString fileName = QFileDialog::getSaveFileName(this, tr("Save Image as"), QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), tr("Image file (*.jpg *.png);;")); - if (fileName != "") - { - if (!fileName.contains(".png") && !fileName.contains(".jpg")) - { - fileName.append(".png"); - } - layermanager->getImage().save(fileName, fileName.split(".").last().toUpper().toAscii(), 95); - } - } - - QList MapControl::layers() const - { - return layermanager->layers(); - } - - int MapControl::numberOfLayers() const - { - return layermanager->layers().size(); - } - - void MapControl::followGeometry(const Geometry* geom) const - { - connect(geom, SIGNAL(positionChanged(Geometry*)), - this, SLOT(positionChanged(Geometry*))); - } - - void MapControl::positionChanged(Geometry* geom) - { - QPoint start = layermanager->layer()->mapadapter()->coordinateToDisplay(currentCoordinate()); - QPoint dest = layermanager->layer()->mapadapter()->coordinateToDisplay(((Point*)geom)->coordinate()); - - QPoint step = (dest-start); - - layermanager->scrollView(step); - - // setView(geom); - update(); - } - - void MapControl::moveTo(QPointF coordinate) - { - target = coordinate; - steps = 25; - if (moveMutex.tryLock()) - { - QTimer::singleShot(40, this, SLOT(tick())); - } - else - { - // stopMove(coordinate); - } - } - void MapControl::tick() - { - QPoint start = layermanager->layer()->mapadapter()->coordinateToDisplay(currentCoordinate()); - QPoint dest = layermanager->layer()->mapadapter()->coordinateToDisplay(target); - - QPoint step = (dest-start)/steps; - QPointF next = currentCoordinate()- step; - - // setView(Coordinate(next.x(), next.y())); - layermanager->scrollView(step); - - update(); - steps--; - if (steps>0) - { - QTimer::singleShot(40, this, SLOT(tick())); - } - else - { - moveMutex.unlock(); - } - } - - void MapControl::setPen(QPen pen) - { - this->mapPen = pen; - } - - void MapControl::paintEvent(QPaintEvent* evnt) - { - QWidget::paintEvent(evnt); - QPainter painter(this); - double line; - - - // painter.translate(150,190); - // painter.scale(0.5,0.5); - - // painter.setClipRect(0,0, size.width(), size.height()); - - // painter.setViewport(10000000000,0,size.width(),size.height()); - - /* - // rotating - rotation = 45; - painter.translate(256,256); - painter.rotate(rotation); - painter.translate(-256,-256); - */ - - layermanager->drawImage(&painter); - layermanager->drawGeoms(&painter); - - // added by wolf - // draw scale - if (scaleVisible) - { - if (currentZoom() >= 0 && distanceList.size() > currentZoom()) - { - line = distanceList.at( currentZoom() ) / pow(2.0, 18-currentZoom() ) / 0.597164; - - // draw the scale - painter.setPen(mapPen); - QPoint p1(10,size.height()-20); - QPoint p2((int)line,size.height()-20); - painter.drawLine(p1,p2); - - painter.drawLine(10,size.height()-15, 10,size.height()-25); - painter.drawLine((int)line,size.height()-15, (int)line,size.height()-25); - - QString distance; - if (distanceList.at(currentZoom()) >= 1000) - { - distance = QVariant( distanceList.at(currentZoom())/1000 ) .toString()+ " km"; - } - else - { - distance = QVariant( distanceList.at(currentZoom()) ).toString() + " m"; - } - - painter.drawText(QPoint((int)line+10,size.height()-15), distance); - } - } - - painter.drawLine(screen_middle.x(), screen_middle.y()-10, - screen_middle.x(), screen_middle.y()+10); // | - painter.drawLine(screen_middle.x()-10, screen_middle.y(), - screen_middle.x()+10, screen_middle.y()); // - - - // int cross_x = int(layermanager->getMapmiddle_px().x())%256; - // int cross_y = int(layermanager->getMapmiddle_px().y())%256; - // painter.drawLine(screen_middle.x()-cross_x+cross_x, screen_middle.y()-cross_y+0, - // screen_middle.x()-cross_x+cross_x, screen_middle.y()-cross_y+256); // | - // painter.drawLine(screen_middle.x()-cross_x+0, screen_middle.y()-cross_y+cross_y, - // screen_middle.x()-cross_x+256, screen_middle.y()-cross_y+cross_y); // - - - painter.drawRect(0,0, size.width(), size.height()); - /* - // rotating - painter.setMatrix(painter.matrix().inverted()); - //qt = painter.transform(); - qm = painter.combinedMatrix(); - */ - if (mousepressed && mymousemode == Dragging) - { - QRect rect = QRect(pre_click_px, current_mouse_pos); - painter.drawRect(rect); - } - - - // Draw the Lat and Lon if needed - - // FIXME Mariano - if (cursorPosVisible && currentZoom() < 19) - { - line = distanceList.at( currentZoom() ) / pow(2.0, 18-currentZoom() ) / 0.597164; - - QString str; - str = QString(tr(" Lat: %1")).arg(currentWorldCoordinate.y()); - painter.drawText(QPoint((int)line+70,size.height()-15), str); - - str = QString(tr(" Lon: %1")).arg(currentWorldCoordinate.x()); - painter.drawText(QPoint((int)line+160,size.height()-15), str); - } - - emit viewChanged(currentCoordinate(), currentZoom()); - } - - // mouse events - void MapControl::mousePressEvent(QMouseEvent* evnt) - { - //rotating (experimental) - // QMouseEvent* me = new QMouseEvent(evnt->type(), qm.map(QPoint(evnt->x(),evnt->y())), evnt->button(), evnt->buttons(), evnt->modifiers()); - // evnt = me; - // qDebug() << "evnt: " << evnt->x() << ", " << evnt->y() << ", " << evnt->pos(); - - layermanager->mouseEvent(evnt); - - if (layermanager->layers().size()>0) - { - if (evnt->button() == 1) - { - mousepressed = true; - pre_click_px = QPoint(evnt->x(), evnt->y()); - } - else if (evnt->button() == 2 && mymousemode != None) // zoom in - { - zoomIn(); - } else if (evnt->button() == 4 && mymousemode != None) // zoom out - { - zoomOut(); - } - } - - // emit(mouseEvent(evnt)); - emit(mouseEventCoordinate(evnt, clickToWorldCoordinate(evnt->pos()))); - } - - void MapControl::mouseReleaseEvent(QMouseEvent* evnt) - { - layermanager->mouseEvent(evnt); - mousepressed = false; - if (mymousemode == Dragging) - { - QPointF ulCoord = clickToWorldCoordinate(pre_click_px); - QPointF lrCoord = clickToWorldCoordinate(current_mouse_pos); - - QRectF coordinateBB = QRectF(ulCoord, QSizeF( (lrCoord-ulCoord).x(), (lrCoord-ulCoord).y())); - - emit(boxDragged(coordinateBB)); - } - - emit(mouseEventCoordinate(evnt, clickToWorldCoordinate(evnt->pos()))); - } - - void MapControl::mouseMoveEvent(QMouseEvent* evnt) - { - layermanager->mouseEvent(evnt); - emit(mouseEvent(evnt)); - - - /* - // rotating - QMouseEvent* me = new QMouseEvent(evnt->type(), qm.map(QPoint(evnt->x(),evnt->y())), evnt->button(), evnt->buttons(), evnt->modifiers()); - evnt = me; - */ - if (mousepressed && mymousemode == Panning) - { - QPoint offset = pre_click_px - QPoint(evnt->x(), evnt->y()); - layermanager->scrollView(offset); - pre_click_px = QPoint(evnt->x(), evnt->y()); - } - else if (mousepressed && mymousemode == Dragging) - { - current_mouse_pos = QPoint(evnt->x(), evnt->y()); - } - // emit(mouseEventCoordinate(evnt, clickToWorldCoordinate(evnt->pos()))); - - currentWorldCoordinate = clickToWorldCoordinate(evnt->pos()); - - emit(mouseMoveCoordinateEvent(currentWorldCoordinate)); - - update(); - - //emit(mouseEventCoordinate(evnt, clickToWorldCoordinate(evnt->pos()))); - } - - QPointF MapControl::clickToWorldCoordinate(QPoint click) - { - // click coordinate to image coordinate - QPoint displayToImage= QPoint(click.x()-screen_middle.x()+layermanager->getMapmiddle_px().x(), - click.y()-screen_middle.y()+layermanager->getMapmiddle_px().y()); - // image coordinate to world coordinate - return layermanager->layer()->mapadapter()->displayToCoordinate(displayToImage); - - } - - void MapControl::updateRequest(QRect rect) - { - update(rect); - } - - void MapControl::drawGeometries() - { - layermanager->drawGeoms(); - } - - void MapControl::updateRequestNew() - { - // qDebug() << "MapControl::updateRequestNew()"; - layermanager->forceRedraw(); - update(); - } - // slots - void MapControl::zoomIn() - { - layermanager->zoomIn(); - update(); - } - - void MapControl::zoomOut() - { - layermanager->zoomOut(); - update(); - } - - void MapControl::setZoom(int zoomlevel) - { - layermanager->setZoom(zoomlevel); - - //qDebug() << "MAPCONTROL: Set zoomlevel to:" << zoomlevel << "at " << __FILE__ << __LINE__; - - update(); - } - int MapControl::currentZoom() const - { - return layermanager->currentZoom(); - } - void MapControl::scrollLeft(int pixel) - { - layermanager->scrollView(QPoint(-pixel,0)); - update(); - } - void MapControl::scrollRight(int pixel) - { - layermanager->scrollView(QPoint(pixel,0)); - update(); - } - void MapControl::scrollUp(int pixel) - { - layermanager->scrollView(QPoint(0,-pixel)); - update(); - } - void MapControl::scrollDown(int pixel) - { - layermanager->scrollView(QPoint(0,pixel)); - update(); - } - void MapControl::scroll(const QPoint scroll) - { - layermanager->scrollView(scroll); - update(); - } - - void MapControl::setView(const QPointF& coordinate) const - { - layermanager->setView(coordinate); - } - - void MapControl::setView(const QList coordinates) const - { - layermanager->setView(coordinates); - } - - void MapControl::setViewAndZoomIn(const QList coordinates) const - { - layermanager->setViewAndZoomIn(coordinates); - } - - void MapControl::setView(const Point* point) const - { - layermanager->setView(point->coordinate()); - } - - void MapControl::loadingFinished() - { - // qDebug() << "MapControl::loadingFinished()"; - layermanager->removeZoomImage(); - } - void MapControl::addLayer(Layer* layer) - { - layermanager->addLayer(layer); - } - - void MapControl::setMouseMode(MouseMode mousemode) - { - mymousemode = mousemode; - } - MapControl::MouseMode MapControl::mouseMode() - { - return mymousemode; - } - - void MapControl::stopFollowing(Geometry* geom) - { - geom->disconnect(SIGNAL(positionChanged(Geometry*))); - } - - void MapControl::enablePersistentCache(const QDir& path) - { - ImageManager::instance()->setCacheDir(path); - } - - void MapControl::setProxy(QString host, int port) - { - ImageManager::instance()->setProxy(host, port); - } - - void MapControl::showScale(bool show) - { - scaleVisible = show; - } - - void MapControl::showCoord(bool show) - { - cursorPosVisible = show; - } - - void MapControl::resize(const QSize newSize) - { - this->size = newSize; - screen_middle = QPoint(newSize.width()/2, newSize.height()/2); - - this->setMaximumSize(newSize.width()+1, newSize.height()+1); - layermanager->resize(newSize); - } -} diff --git a/lib/QMapControl/src/mapcontrol.h b/lib/QMapControl/src/mapcontrol.h deleted file mode 100644 index 7949c5971fc639461fce2e5f0cf832f05dc1824f..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/mapcontrol.h +++ /dev/null @@ -1,374 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef MAPCONTROL_H -#define MAPCONTROL_H - -#include - -#include "layermanager.h" -#include "layer.h" -#include "mapadapter.h" -#include "geometry.h" -#include "imagemanager.h" - -//! QMapControl namespace -namespace qmapcontrol -{ - class LayerManager; - class MapAdapter; - class Layer; - - //! The control element of the widget and also the widget itself - /*! - * This is the main widget. - * To this control layers can be added. - * A MapControl have to be instantiated with a QSize which sets the size the widget takes in a layout. - * The given size is also the size, which is asured to be filled with map images. - * - * @author Kai Winter - */ - class MapControl : public QWidget - { - Q_OBJECT - - public: - //! Declares what actions the mouse move has on the map - enum MouseMode - { - Panning, /*!< The map is moved */ - Dragging, /*!< A rectangular can be drawn */ - None, /*!< Mouse move events have no efect to the map */ - }; - - //! The constructor of MapControl - /*! - * The MapControl is the widget which displays the maps. - * The size describes the area, which gets filled with map data - * When you give no MouseMode, the mouse is moving the map. - * You can change the MouseMode on runtime, to e.g. Dragging, which lets the user drag a rectangular box. - * After the dragging a signal with the size of the box is emitted. - * The mousemode ´None´ can be used, to completely define the control of the map yourself. - * @param size the size which the widget should fill with map data - * @param mousemode the way mouseevents are handled - */ - MapControl ( QSize size, MouseMode mousemode = Panning ); - - ~MapControl(); - - //! adds a layer - /*! - * If multiple layers are added, they are painted in the added order. - * @param layer the layer which should be added - */ - void addLayer ( Layer* layer ); - - //! returns the layer with the given name - /*! - * @param layername name of the wanted layer - * @return the layer with the given name - */ - Layer* layer ( const QString& layername ) const; - - //! The factor the offscreen image is larger than the current viewport - float offscreenImageFactor(); - - //! returns the names of all layers - /*! - * @return returns a QList with the names of all layers - */ - QList layers() const; - - //! returns the number of existing layers - /*! - * @return returns the number of existing layers - */ - int numberOfLayers() const; - - //! returns the coordinate of the center of the map - /*! - * @return returns the coordinate of the middle of the screen - */ - QPointF currentCoordinate() const; - - //! returns the current zoom level - /*! - * @return returns the current zoom level - */ - int currentZoom() const; - - //! sets the middle of the map to the given coordinate - /*! - * @param coordinate the coordinate which the view´s middle should be set to - */ - void setView ( const QPointF& coordinate ) const; - - //! sets the view, so all coordinates are visible - /*! - * @param coordinates the Coorinates which should be visible - */ - void setView ( const QList coordinates ) const; - - //! sets the view and zooms in, so all coordinates are visible - /*! - * The code of setting the view to multiple coordinates is "brute force" and pretty slow. - * Have to be reworked. - * @param coordinates the Coorinates which should be visible - */ - void setViewAndZoomIn ( const QList coordinates ) const; - - //! sets the view to the given Point - /*! - * - * @param point the geometric point the view should be set to - */ - void setView ( const Point* point ) const; - - //! Keeps the center of the map on the Geometry, even when it moves - /*! - * To stop the following the method stopFollowing() have to be called - * @param geometry the Geometry which should stay centered. - */ - void followGeometry ( const Geometry* geometry ) const; - - //TODO: - // void followGeometry(const QList) const; - - //! Stops the following of a Geometry - /*! - * if the view is set to follow a Geometry this method stops the trace. - * See followGeometry(). - * @param geometry the Geometry which should not followed anymore - */ - void stopFollowing ( Geometry* geometry ); - - //! Smoothly moves the center of the view to the given Coordinate - /*! - * @param coordinate the Coordinate which the center of the view should moved to - */ - void moveTo ( QPointF coordinate ); - - //! sets the Mouse Mode of the MapControl - /*! - * There are three MouseModes declard by an enum. - * The MouesMode Dragging draws an rectangular in the map while the MouseButton is pressed. - * When the Button is released a boxDragged() signal is emitted. - * - * The second MouseMode (the default) is Panning, which allows to drag the map around. - * @param mousemode the MouseMode - */ - void setMouseMode ( MouseMode mousemode ); - - //! returns the current MouseMode - /*! - * For a explanation for the MouseModes see setMouseMode() - * @return the current MouseMode - */ - MapControl::MouseMode mouseMode(); - - //int rotation; - - //! Enable persistent caching of map tiles - /*! - * Call this method to allow the QMapControl widget to save map tiles - * persistent (also over application restarts). - * Tiles are stored in the subdirectory "QMapControl.cache" within the - * user's home directory. This can be changed by giving a path. - * @param path the path to the cache directory - */ - void enablePersistentCache ( const QDir& path=QDir::homePath() + "/QMapControl.cache" ); - - - //! Sets the proxy for HTTP connections - /*! - * This method sets the proxy for HTTP connections. - * This is not provided by the current Qtopia version! - * @param host the proxy´s hostname or ip - * @param port the proxy´s port - */ - void setProxy ( QString host, int port ); - - //! Displays the scale within the widget - /*! - * - * @param show true if the scale should be displayed - */ - void showScale ( bool show ); - - - //! Displays the Lat and Lon within the widget - /*! - * - * @param show true if Lat and Lon should be displayed - */ - void showCoord ( bool show ); - - //! Set the pen for overlay text - /*! - * - * @param pen The new QPen - */ - void setPen(QPen pen); - - private: - LayerManager* layermanager; - QPoint screen_middle; // middle of the widget (half size) - - QPoint pre_click_px; // used for scrolling (MouseMode Panning) - QPoint current_mouse_pos; // used for scrolling and dragging (MouseMode Panning/Dragging) - - QSize size; // size of the widget - - QPointF currentWorldCoordinate; // updated by mouseMove - - QList distanceList; - - bool mousepressed; - MouseMode mymousemode; - bool scaleVisible; - bool cursorPosVisible; - QPen mapPen; - - bool m_loadingFlag; - - QMutex moveMutex; // used for method moveTo() - QPointF target; // used for method moveTo() - int steps; // used for method moveTo() - - QPointF clickToWorldCoordinate ( QPoint click ); - MapControl& operator= ( const MapControl& rhs ); - MapControl ( const MapControl& old ); - - protected: - void paintEvent ( QPaintEvent* evnt ); - void mousePressEvent ( QMouseEvent* evnt ); - void mouseReleaseEvent ( QMouseEvent* evnt ); - void mouseMoveEvent ( QMouseEvent* evnt ); - - signals: - void mouseEvent(const QMouseEvent* evnt); - - //! Emitted AFTER a MouseEvent occured - /*! - * This signals allows to receive click events within the MapWidget together with the world coordinate. - * It is emitted on MousePressEvents and MouseReleaseEvents. - * The kind of the event can be obtained by checking the events type. - * @param evnt the QMouseEvent that occured - * @param coordinate the corresponding world coordinate - */ - void mouseEventCoordinate ( const QMouseEvent* evnt, const QPointF coordinate ); - - //! Emitted on mouse move generating - /*! - * This signals allows to receive the mouse position in the world coordinate. - * It is emitted on mouseMoveEvents. - * setMouseTracking must be set programatically to have this method work. - * @param coordinate the corresponding world coordinate - */ - void mouseMoveCoordinateEvent(const QPointF coordinate); - - //! Emitted, after a Rectangular is dragged. - /*! - * It is possible to select a rectangular area in the map, if the MouseMode is set to Dragging. - * The coordinates are in world coordinates - * @param QRectF the dragged Rect - */ - void boxDragged ( const QRectF ); - - //! This signal is emitted, when a Geometry is clicked - /*! - * @param geometry The clicked Geometry object - * @param coord_px The coordinate in pixel coordinates - */ - void geometryClicked ( Geometry* geometry, QPoint coord_px ); - - //! This signal is emitted, after the view have changed - /*! - * @param coordinate The current coordinate - * @param zoom The current zoom - */ - void viewChanged ( const QPointF &coordinate, int zoom ); - - public slots: - //! zooms in one step - void zoomIn(); - - //! zooms out one step - void zoomOut(); - - //! sets the given zoomlevel - /*! - * @param zoomlevel the zoomlevel - */ - void setZoom ( int zoomlevel ); - - //! scrolls the view to the left - void scrollLeft ( int pixel=10 ); - - //! scrolls the view to the right - void scrollRight ( int pixel=10 ); - - //! scrolls the view up - void scrollUp ( int pixel=10 ); - - //! scrolls the view down - void scrollDown ( int pixel=10 ); - - //! scrolls the view by the given point - void scroll ( const QPoint scroll ); - - //! updates the map for the given rect - /*! - * @param rect the area which should be repainted - */ - void updateRequest ( QRect rect ); - - void drawGeometries(); - - //! updates the hole map by creating a new offscreen image - /*! - * - */ - void updateRequestNew(); - - //! Resizes the map to the given size - /*! - * @param newSize The new size - */ - void resize(const QSize newSize); - - //! Open a popup to save the current offscreen image to disk - void openImageSaveDialog(); - - //! Sets the factor the offscreen image should be larger than the visible area */ - void setOffscreenImageFactor(double factor); - - private slots: - void tick(); - void loadingFinished(); - void positionChanged ( Geometry* geom ); - }; -} -#endif diff --git a/lib/QMapControl/src/maplayer.cpp b/lib/QMapControl/src/maplayer.cpp deleted file mode 100644 index f113364bd4bc24aa336ba0797471b60a15b8ab79..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/maplayer.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "maplayer.h" -namespace qmapcontrol -{ - MapLayer::MapLayer(QString layername, MapAdapter* mapadapter, bool takeevents) - : Layer(layername, mapadapter, Layer::MapLayer, takeevents) - { - } - - - MapLayer::~MapLayer() - { - } -} diff --git a/lib/QMapControl/src/maplayer.h b/lib/QMapControl/src/maplayer.h deleted file mode 100644 index 97b1701fb2affc6e23a62b48cc078878a9508094..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/maplayer.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef MAPLAYER_H -#define MAPLAYER_H - -#include "layer.h" - -namespace qmapcontrol -{ - //! MapLayer class - /*! - * There are two different layer types: - * - MapLayer: Displays Maps, but also Geometries. The configuration for displaying maps have to be done in the MapAdapter - * - GeometryLayer: Only displays Geometry objects. - * - * MapLayers also can display Geometry objects. The difference to the GeometryLayer is the repainting. Objects that are - * added to a MapLayer are "baken" on the map. This means, when you change it´s position for example the changes are - * not visible until a new offscreen image has been drawn. If you have "static" Geometries which won´t change their - * position this is fine. But if you want to change the objects position or pen you should use a GeometryLayer. Those - * are repainted immediately on changes. - * - * @author Kai Winter - */ - class MapLayer : public Layer - { - Q_OBJECT - - public: - //! MapLayer constructor - /*! - * This is used to construct a map layer. - * - * @param layername The name of the Layer - * @param mapadapter The MapAdapter which does coordinate translation and Query-String-Forming - * @param takeevents Should the Layer receive MouseEvents? This is set to true by default. Setting it to false could - * be something like a "speed up hint" - */ - MapLayer(QString layername, MapAdapter* mapadapter, bool takeevents=true); - virtual ~MapLayer(); - }; -} -#endif diff --git a/lib/QMapControl/src/mapnetwork.cpp b/lib/QMapControl/src/mapnetwork.cpp deleted file mode 100644 index de16b92df5607504536b86a8583bbe05810dfaed..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/mapnetwork.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "mapnetwork.h" -#include -namespace qmapcontrol -{ - MapNetwork::MapNetwork(ImageManager* parent) - :parent(parent), http(new QHttp(this)), loaded(0) - { - connect(http, SIGNAL(requestFinished(int, bool)), - this, SLOT(requestFinished(int, bool))); - } - - MapNetwork::~MapNetwork() - { - http->clearPendingRequests(); - delete http; - } - - - void MapNetwork::loadImage(const QString& host, const QString& url) - { - // qDebug() << "getting: " << QString(host).append(url); - // http->setHost(host); - // int getId = http->get(url); - - http->setHost(host); - QHttpRequestHeader header("GET", url); - header.setValue("User-Agent", "Mozilla"); - header.setValue("Host", host); - int getId = http->request(header); - - if (vectorMutex.tryLock()) - { - loadingMap[getId] = url; - vectorMutex.unlock(); - } - } - - void MapNetwork::requestFinished(int id, bool error) - { - // sleep(1); - qDebug() << "QMapControl: MapNetwork::requestFinished" << http->state() << ", id: " << id; - if (error) - { - qDebug() << "QMapControl: network error: " << http->errorString(); - //restart query - - } - else if (vectorMutex.tryLock()) - { - // check if id is in map? - if (loadingMap.contains(id)) - { - - QString url = loadingMap[id]; - loadingMap.remove(id); - vectorMutex.unlock(); - //qDebug() << "QMapControl: request finished for id: " << id << ", belongs to: " << notifier.url << endl; - QByteArray ax; - - if (http->bytesAvailable()>0) - { - QPixmap pm; - ax = http->readAll(); - - qDebug() << "QMapControl: Request consisted of " << ax.size() << "bytes"; - - if (pm.loadFromData(ax)) - { - loaded += pm.size().width()*pm.size().height()*pm.depth()/8/1024; - qDebug() << "QMapControl: Network loaded: " << (loaded); - parent->receivedImage(pm, url); - } - else if (pm.width() == 0 || pm.height() == 0) - { - // Silently ignore map request for a - // 0xn pixel map - qDebug() << "QMapControl: IGNORED 0x0 pixel map request, widthxheight:" << pm.width() << "x" << pm.height(); - // showing this html error message is horribly time consuming - //qDebug() << "QMapControl: HTML ERROR MESSAGE:" << ax << "at " << __FILE__ << __LINE__; - } - else - { - // QGC FIXME Error is currently undetected - // TODO Error is currently undetected - //qDebug() << "NETWORK_PIXMAP_ERROR: " << ax; - qDebug() << "QMapControl external library: ERROR loading map:" << "width:" << pm.width() << "heigh:" << pm.height() << "at " << __FILE__ << __LINE__; - // showing this html error message is horribly time consuming - //qDebug() << "QMapControl: HTML ERROR MESSAGE:" << ax << "at " << __FILE__ << __LINE__; - } - } - - } - else - vectorMutex.unlock(); - - } - if (loadingMap.size() == 0) - { - // qDebug () << "all loaded"; - parent->loadingQueueEmpty(); - } - } - - void MapNetwork::abortLoading() - { - http->clearPendingRequests(); - if (vectorMutex.tryLock()) - { - loadingMap.clear(); - vectorMutex.unlock(); - } - } - - bool MapNetwork::imageIsLoading(QString url) - { - return loadingMap.values().contains(url); - } - - void MapNetwork::setProxy(QString host, int port) - { -#ifndef Q_WS_QWS - // do not set proxy on qt/extended - http->setProxy(host, port); -#endif - } -} diff --git a/lib/QMapControl/src/mapnetwork.h b/lib/QMapControl/src/mapnetwork.h deleted file mode 100644 index ec418417077626c2135d593a3f1dae5672932245..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/mapnetwork.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef MAPNETWORK_H -#define MAPNETWORK_H - -#include -#include -#include -#include -#include -#include "imagemanager.h" -/** - @author Kai Winter - */ -namespace qmapcontrol -{ - class ImageManager; - class MapNetwork : QObject - { - Q_OBJECT - - public: - MapNetwork(ImageManager* parent); - ~MapNetwork(); - - void loadImage(const QString& host, const QString& url); - - /*! - * checks if the given url is already loading - * @param url the url of the image - * @return boolean, if the image is already loading - */ - bool imageIsLoading(QString url); - - /*! - * Aborts all current loading threads. - * This is useful when changing the zoom-factor, though newly needed images loads faster - */ - void abortLoading(); - void setProxy(QString host, int port); - - private: - ImageManager* parent; - QHttp* http; - QMap loadingMap; - qreal loaded; - QMutex vectorMutex; - MapNetwork& operator=(const MapNetwork& rhs); - MapNetwork(const MapNetwork& old); - - private slots: - void requestFinished(int id, bool error); - }; -} -#endif diff --git a/lib/QMapControl/src/openaerialmapadapter.cpp b/lib/QMapControl/src/openaerialmapadapter.cpp deleted file mode 100644 index d65e373707261ee67d22060fdca41607df5e0c94..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/openaerialmapadapter.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2009 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "openaerialmapadapter.h" -namespace qmapcontrol -{ - OpenAerialMapAdapter::OpenAerialMapAdapter() - : TileMapAdapter("tile.openaerialmap.org", "/tiles/1.0.0/openaerialmap-900913/%1/%2/%3.png", 256, 0, 17) - { - } - - OpenAerialMapAdapter::~OpenAerialMapAdapter() - { - } -} diff --git a/lib/QMapControl/src/openaerialmapadapter.h b/lib/QMapControl/src/openaerialmapadapter.h deleted file mode 100644 index d49029c4b5f50ce293fb0b32c781fc9acb69828e..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/openaerialmapadapter.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2009 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef OPENAERIALMAPADAPTER_H -#define OPENAERIALMAPADAPTER_H - -#include "tilemapadapter.h" -namespace qmapcontrol -{ - //! MapAdapter for OpenStreetMap - /*! - * This is a conveniece class, which extends and configures a TileMapAdapter. Source of maps is http://www.openaerialmap.org/ - * @author Kai Winter - */ - class OpenAerialMapAdapter : public TileMapAdapter - { - Q_OBJECT - public: - //! constructor - /*! - * This construct a OpenAerialMap Adapter - */ - OpenAerialMapAdapter(); - virtual ~OpenAerialMapAdapter(); - }; -} -#endif diff --git a/lib/QMapControl/src/osmmapadapter.cpp b/lib/QMapControl/src/osmmapadapter.cpp deleted file mode 100644 index f0d7af9a2a140eb62d8892ca713485994cb54d31..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/osmmapadapter.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "osmmapadapter.h" -namespace qmapcontrol -{ - OSMMapAdapter::OSMMapAdapter() - : TileMapAdapter("tile.openstreetmap.org", "/%1/%2/%3.png", 256, 0, 17) - { - } - - OSMMapAdapter::~OSMMapAdapter() - { - } -} diff --git a/lib/QMapControl/src/osmmapadapter.h b/lib/QMapControl/src/osmmapadapter.h deleted file mode 100644 index a139880baa2ade585988effd610d2696ae81d682..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/osmmapadapter.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef OSMMAPADAPTER_H -#define OSMMAPADAPTER_H - -#include "tilemapadapter.h" -namespace qmapcontrol -{ - //! MapAdapter for OpenStreetMap - /*! - * This is a conveniece class, which extends and configures a TileMapAdapter - * @author Kai Winter - */ - class OSMMapAdapter : public TileMapAdapter - { - Q_OBJECT - public: - //! constructor - /*! - * This construct a OpenStreetmap Adapter - */ - OSMMapAdapter(); - virtual ~OSMMapAdapter(); - }; -} -#endif diff --git a/lib/QMapControl/src/point.cpp b/lib/QMapControl/src/point.cpp deleted file mode 100644 index e15ca87cd4bd471bb1602a870577eb32d1e46541..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/point.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "point.h" -namespace qmapcontrol -{ - Point::Point() - {} - Point::Point(const Point& point) - :Geometry(point.name()), X(point.longitude()), Y(point.latitude()) - { - visible = point.isVisible(); - mywidget = 0; - mypixmap = 0; - mypen = point.mypen; - homelevel = -1; - minsize = QSize(-1,-1); - maxsize = QSize(-1,-1); - } - - Point::Point(qreal x, qreal y, QString name, enum Alignment alignment) - : Geometry(name), X(x), Y(y), myalignment(alignment) - { - GeometryType = "Point"; - mywidget = 0; - mypixmap = 0; - visible = true; - homelevel = -1; - minsize = QSize(-1,-1); - maxsize = QSize(-1,-1); - } - - Point::Point(qreal x, qreal y, QWidget* widget, QString name, enum Alignment alignment) - : Geometry(name), X(x), Y(y), mywidget(widget), myalignment(alignment) - { - // Point(x, y, name, alignment); - GeometryType = "Point"; - mypixmap = 0; - visible = true; - size = widget->size(); - homelevel = -1; - minsize = QSize(-1,-1); - maxsize = QSize(-1,-1); - mywidget->show(); - } - Point::Point(qreal x, qreal y, QPixmap* pixmap, QString name, enum Alignment alignment) - : Geometry(name), X(x), Y(y), mypixmap(pixmap), myalignment(alignment) - { - GeometryType = "Point"; - mywidget = 0; - visible = true; - size = pixmap->size(); - homelevel = -1; - minsize = QSize(-1,-1); - maxsize = QSize(-1,-1); - } - /* - Point& Point::operator=(const Point& rhs) - { - if (this == &rhs) - return *this; - else - { - X = rhs.X; - Y = rhs.Y; - size = rhs.size; - - mywidget = rhs.mywidget; - mypixmap = rhs.mypixmap; - alignment = rhs.alignment; - homelevel = rhs.homelevel; - minsize = rhs.minsize; - maxsize = rhs.maxsize; -} -} -*/ - Point::~Point() - { - delete mywidget; - delete mypixmap; - } - - void Point::setVisible(bool visible) - { - this->visible = visible; - if (mywidget !=0) - { - mywidget->setVisible(visible); - } - } - - QRectF Point::boundingBox() - { - //TODO: have to be calculated in relation to alignment... - return QRectF(QPointF(X, Y), displaysize); - } - - qreal Point::longitude() const - { - return X; - } - qreal Point::latitude() const - { - return Y; - } - QPointF Point::coordinate() const - { - return QPointF(X, Y); - } - - void Point::draw(QPainter* painter, const MapAdapter* mapadapter, const QRect &viewport, const QPoint offset) - { - if (!visible) - return; - - if (homelevel > 0) - { - - int currentzoom = mapadapter->maxZoom() < mapadapter->minZoom() ? mapadapter->minZoom() - mapadapter->currentZoom() : mapadapter->currentZoom(); - - // int currentzoom = mapadapter->getZoom(); - int diffzoom = homelevel-currentzoom; - int viewheight = size.height(); - int viewwidth = size.width(); - viewheight = int(viewheight / pow(2.0, diffzoom)); - viewwidth = int(viewwidth / pow(2.0, diffzoom)); - - if (minsize.height()!= -1 && viewheight < minsize.height()) - viewheight = minsize.height(); - else if (maxsize.height() != -1 && viewheight > maxsize.height()) - viewheight = maxsize.height(); - - - if (minsize.width()!= -1 && viewwidth < minsize.width()) - viewwidth = minsize.width(); - else if (maxsize.width() != -1 && viewwidth > maxsize.width()) - viewwidth = maxsize.width(); - - - displaysize = QSize(viewwidth, viewheight); - } - else - { - displaysize = size; - } - - - if (mypixmap !=0) - { - const QPointF c = QPointF(X, Y); - QPoint point = mapadapter->coordinateToDisplay(c); - - if (viewport.contains(point)) - { - QPoint alignedtopleft = alignedPoint(point); - painter->drawPixmap(alignedtopleft.x(), alignedtopleft.y(), displaysize.width(), displaysize.height(), *mypixmap); - } - - } - else if (mywidget!=0) - { - drawWidget(mapadapter, offset); - } - - } - - void Point::drawWidget(const MapAdapter* mapadapter, const QPoint offset) - { - const QPointF c = QPointF(X, Y); - QPoint point = mapadapter->coordinateToDisplay(c); - point -= offset; - - QPoint alignedtopleft = alignedPoint(point); - mywidget->setGeometry(alignedtopleft.x(), alignedtopleft.y(), displaysize.width(), displaysize.height()); - } - - QPoint Point::alignedPoint(const QPoint point) const - { - QPoint alignedtopleft; - if (myalignment == Middle) - { - alignedtopleft.setX(point.x()-displaysize.width()/2); - alignedtopleft.setY(point.y()-displaysize.height()/2); - } - else if (myalignment == TopLeft) - { - alignedtopleft.setX(point.x()); - alignedtopleft.setY(point.y()); - } - else if (myalignment == TopRight) - { - alignedtopleft.setX(point.x()-displaysize.width()); - alignedtopleft.setY(point.y()); - } - else if (myalignment == BottomLeft) - { - alignedtopleft.setX(point.x()); - alignedtopleft.setY(point.y()-displaysize.height()); - } - else if (myalignment == BottomRight) - { - alignedtopleft.setX(point.x()-displaysize.width()); - alignedtopleft.setY(point.y()-displaysize.height()); - } - return alignedtopleft; - } - - - bool Point::Touches(Point* p, const MapAdapter* mapadapter) - { - if (this->isVisible() == false) - return false; - if (mypixmap == 0) - return false; - - QPointF c = p->coordinate(); - // coordinate to pixel - QPoint pxOfPoint = mapadapter->coordinateToDisplay(c); - // size/2 Pixel toleranz aufaddieren - QPoint p1; - QPoint p2; - - switch (myalignment) - { - case Middle: - p1 = pxOfPoint - QPoint(displaysize.width()/2,displaysize.height()/2); - p2 = pxOfPoint + QPoint(displaysize.width()/2,displaysize.height()/2); - break; - case TopLeft: - p1 = pxOfPoint - QPoint(displaysize.width(),displaysize.height()); - p2 = pxOfPoint; - break; - case TopRight: - p1 = pxOfPoint - QPoint(0, displaysize.height()); - p2 = pxOfPoint + QPoint(displaysize.width(),0); - break; - case BottomLeft: - p1 = pxOfPoint - QPoint(displaysize.width(), 0); - p2 = pxOfPoint + QPoint(0, displaysize.height()); - break; - case BottomRight: - p1 = pxOfPoint; - p2 = pxOfPoint + QPoint(displaysize.width(), displaysize.height()); - break; - } - - // calculate "Bounding Box" in coordinates - QPointF c1 = mapadapter->displayToCoordinate(p1); - QPointF c2 = mapadapter->displayToCoordinate(p2); - - - if(this->longitude()>=c1.x() && this->longitude()<=c2.x()) - { - if (this->latitude()<=c1.y() && this->latitude()>=c2.y()) - { - emit(geometryClicked(this, QPoint(0,0))); - return true; - } - } - return false; - } - - void Point::setCoordinate(QPointF point) - { - // emit(updateRequest(this)); - // emit(updateRequest(QRectF(X, Y, size.width(), size.height()))); - X = point.x(); - Y = point.y(); - // emit(updateRequest(this)); - emit(updateRequest(QRectF(X, Y, size.width(), size.height()))); - - emit(positionChanged(this)); - } - QList& Point::points() - { - // FIXME TODO: THIS IS ABSOLUTELY WRONG IN THE ORIGINAL LIBRARY - // NEEDS AN INHERITANCE REWRITE!!!! - return m_points; - } - - QWidget* Point::widget() - { - return mywidget; - } - - QPixmap* Point::pixmap() - { - return mypixmap; - } - - void Point::setBaselevel(int zoomlevel) - { - homelevel = zoomlevel; - } - void Point::setMinsize(QSize minsize) - { - this->minsize = minsize; - } - void Point::setMaxsize(QSize maxsize) - { - this->maxsize = maxsize; - } - Point::Alignment Point::alignment() const - { - return myalignment; - } -} diff --git a/lib/QMapControl/src/point.h b/lib/QMapControl/src/point.h deleted file mode 100644 index 5ddadf7e157f7cc919eefa1fba973ce7c55a6e3b..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/point.h +++ /dev/null @@ -1,216 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef POINT_H -#define POINT_H -#include - -#include "geometry.h" - -namespace qmapcontrol -{ - //! A geometric point to draw objects into maps - /*! - * This class can be used to draw your custom QPixmap or other QWidgets into maps. - * You can instantiate a Point with any Pixmap you want. The objects cares about collision detection (for clickable objects) - * - * When drawing a pixmap, take care you are adding the point to a GeometryLayer. - * You can also add a point to a MapLayer, but this should only be done, if the point is not changing its position or color etc. - * (GeometryLayers are assured to be repainted on any changes at the point. MapLayers only gets repainted, if a new - * offscreenImage is painter. This is a performance issue.) - * - * Points emit click events, if the containing layer receives clickevents (the default) - * - * You can also add a widget into maps. But keep in mind, that widgets always are drawn on top of all layers. - * You also have to handle click events yourself. - * - * To create "zoomable objects" (objects that increases size on zooming), a base level have to be set. - * The base level is the zoom level on which the point´s pixmap gets displayed on full size. - * On lower zoom levels it gets displayed smaller and on higher zoom levels larger. - * A minimal size can be set as well as a maximum size. - * @see setBaselevel, setMinsize, setMaxsize - * - * @author Kai Winter - */ - class Point : public Geometry - { - Q_OBJECT - - public: - friend class Layer; - friend class LineString; - - //! sets where the point should be aligned - enum Alignment - { - TopLeft, /*!< Align on TopLeft*/ - TopRight, /*!< Align on TopRight*/ - BottomLeft, /*!< Align on BottomLeft*/ - BottomRight,/*!< Align on BottomRight*/ - Middle /*!< Align on Middle*/ - }; - - Point(); - explicit Point(const Point&); - //! Copy Constructor - /*! - * This constructor creates a Point with no image or widget. - * @param x longitude - * @param y latitude - * @param name name of the point - * @param alignment allignment of the point (Middle or TopLeft) - */ - Point(qreal x, qreal y, QString name = QString(), enum Alignment alignment=Middle); - - //! Constructor - /*! - * This constructor creates a point which will display the given widget. - * You can set an alignment on which corner the widget should be aligned to the coordinate. - * You have to set the size of the widget, before adding it to - * IMPORTANT: You have to set the QMapControl as parent for the widget! - * @param x longitude - * @param y latitude - * @param widget the widget which should be displayed by this point - * @param name name of the point - * @param alignment allignment of the point (Middle or TopLeft) - */ - Point(qreal x, qreal y, QWidget* widget, QString name = QString(), enum Alignment alignment = Middle); - - //! Constructor - /*! - * This constructor creates a point which will display the give pixmap. - * You can set an alignment on which corner the pixmap should be aligned to the coordinate. - * @param x longitude - * @param y latitude - * @param pixmap the pixmap which should be displayed by this point - * @param name name of the point - * @param alignment allignment of the point (Middle or TopLeft) - */ - Point(qreal x, qreal y, QPixmap* pixmap, QString name = QString(), enum Alignment alignment = Middle); - virtual ~Point(); - - //! returns the bounding box of the point - /*! - * The Bounding contains the coordinate of the point and its size. - * The size is set, if the point contains a pixmap or a widget - * @return the bounding box of the point - */ - virtual QRectF boundingBox(); - - //! returns the longitude of the point - /*! - * @return the longitude of the point - */ - qreal longitude() const; - - //! returns the latitude of the point - /*! - * @return the latitude of the point - */ - qreal latitude() const; - - //! returns the coordinate of the point - /*! - * The x component of the returned QPointF is the longitude value, - * the y component the latitude - * @return the coordinate of a point - */ - QPointF coordinate() const; - - virtual QList& points(); - - /*! \brief returns the widget of the point - @return the widget of the point - */ - QWidget* widget(); - - //! returns the pixmap of the point - /*! - * @return the pixmap of the point - */ - QPixmap* pixmap(); - - //! Sets the zoom level on which the point�s pixmap gets displayed on full size - /*! - * Use this method to set a zoom level on which the pixmap gets displayed with its real size. - * On zoomlevels below it will be displayed smaller, and on zoom levels thereover it will be displayed larger - * @see setMinsize, setMaxsize - * @param zoomlevel the zoomlevel on which the point will be displayed on full size - */ - void setBaselevel(int zoomlevel); - - //! sets a minimal size for the pixmap - /*! - * When the point's pixmap should change its size on zooming, this method sets the minimal size. - * @see setBaselevel - * @param minsize the minimal size which the pixmap should have - */ - void setMinsize(QSize minsize); - - //! sets a maximal size for the pixmap - /*! - * When the point´s pixmap should change its size on zooming, this method sets the maximal size. - * @see setBaselevel - * @param maxsize the maximal size which the pixmap should have - */ - void setMaxsize(QSize maxsize); - - Point::Alignment alignment() const; - - protected: - qreal X; - qreal Y; - QSize size; - - QWidget* mywidget; - QPixmap* mypixmap; - Alignment myalignment; - int homelevel; - QSize displaysize; - QSize minsize; - QSize maxsize; - QList m_points; - - - void drawWidget(const MapAdapter* mapadapter, const QPoint offset); - // void drawPixmap(QPainter* painter, const MapAdapter* mapadapter, const QRect &viewport, const QPoint versch); - virtual void draw(QPainter* painter, const MapAdapter* mapadapter, const QRect &viewport, const QPoint offset); - QPoint alignedPoint(const QPoint point) const; - - //! returns true if the given Point touches this Point - /*! - * The collision detection checks for the bounding rectangulars. - * @param geom the other point which should be tested on collision - * @param mapadapter the mapadapter which is used for calculations - * @return - */ - virtual bool Touches(Point* geom, const MapAdapter* mapadapter); - - public slots: - void setCoordinate(QPointF point); - virtual void setVisible(bool visible); - }; -} -#endif diff --git a/lib/QMapControl/src/tilemapadapter.cpp b/lib/QMapControl/src/tilemapadapter.cpp deleted file mode 100644 index 17d0e3b52ab19af9d0ea2af9f71bf5c6fec9277c..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/tilemapadapter.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "tilemapadapter.h" -namespace qmapcontrol -{ - TileMapAdapter::TileMapAdapter(const QString& host, const QString& serverPath, int tilesize, int minZoom, int maxZoom) - :MapAdapter(host, serverPath, tilesize, minZoom, maxZoom) - { - PI = acos(-1.0); - - /* - Initialize the "substring replace engine". First the string replacement - in getQuery was made by QString().arg() but this was very slow. So this - splits the servers path into substrings and when calling getQuery the - substrings get merged with the parameters of the URL. - Pretty complicated, but fast. - */ - param1 = serverPath.indexOf("%1"); - param2 = serverPath.indexOf("%2"); - param3 = serverPath.indexOf("%3"); - - int min = param1 < param2 ? param1 : param2; - min = param3 < min ? param3 : min; - - int max = param1 > param2 ? param1 : param2; - max = param3 > max ? param3 : max; - - int middle = param1+param2+param3-min-max; - - order[0][0] = min; - if (min == param1) - order[0][1] = 0; - else if (min == param2) - order[0][1] = 1; - else - order[0][1] = 2; - - order[1][0] = middle; - if (middle == param1) - order[1][1] = 0; - else if (middle == param2) - order[1][1] = 1; - else - order[1][1] = 2; - - order[2][0] = max; - if (max == param1) - order[2][1] = 0; - else if(max == param2) - order[2][1] = 1; - else - order[2][1] = 2; - - int zoom = max_zoom < min_zoom ? min_zoom - current_zoom : current_zoom; - numberOfTiles = tilesonzoomlevel(zoom); - loc.setNumberOptions(QLocale::OmitGroupSeparator); - } - - TileMapAdapter::~TileMapAdapter() - { - } - //TODO: pull out - void TileMapAdapter::zoom_in() - { - if (min_zoom > max_zoom) - { - //current_zoom = current_zoom-1; - current_zoom = current_zoom > max_zoom ? current_zoom-1 : max_zoom; - } - else if (min_zoom < max_zoom) - { - //current_zoom = current_zoom+1; - current_zoom = current_zoom < max_zoom ? current_zoom+1 : max_zoom; - } - - int zoom = max_zoom < min_zoom ? min_zoom - current_zoom : current_zoom; - numberOfTiles = tilesonzoomlevel(zoom); - - } - void TileMapAdapter::zoom_out() - { - if (min_zoom > max_zoom) - { - //current_zoom = current_zoom+1; - current_zoom = current_zoom < min_zoom ? current_zoom+1 : min_zoom; - } - else if (min_zoom < max_zoom) - { - //current_zoom = current_zoom-1; - current_zoom = current_zoom > min_zoom ? current_zoom-1 : min_zoom; - } - - int zoom = max_zoom < min_zoom ? min_zoom - current_zoom : current_zoom; - numberOfTiles = tilesonzoomlevel(zoom); - } - - qreal TileMapAdapter::deg_rad(qreal x) const - { - return x * (PI/180.0); - } - qreal TileMapAdapter::rad_deg(qreal x) const - { - return x * (180/PI); - } - - QString TileMapAdapter::query(int x, int y, int z) const - { - x = xoffset(x); - y = yoffset(y); - - int a[3] = {z, x, y}; - return QString(serverPath).replace(order[2][0],2, loc.toString(a[order[2][1]])) - .replace(order[1][0],2, loc.toString(a[order[1][1]])) - .replace(order[0][0],2, loc.toString(a[order[0][1]])); - - } - - QPoint TileMapAdapter::coordinateToDisplay(const QPointF& coordinate) const - { - qreal x = (coordinate.x()+180) * (numberOfTiles*mytilesize)/360.; // coord to pixel! - qreal y = (1-(log(tan(PI/4+deg_rad(coordinate.y())/2)) /PI)) /2 * (numberOfTiles*mytilesize); - - return QPoint(int(x), int(y)); - } - - QPointF TileMapAdapter::displayToCoordinate(const QPoint& point) const - { - qreal longitude = (point.x()*(360/(numberOfTiles*mytilesize)))-180; - qreal latitude = rad_deg(atan(sinh((1-point.y()*(2/(numberOfTiles*mytilesize)))*PI))); - - return QPointF(longitude, latitude); - - } - - bool TileMapAdapter::isValid(int x, int y, int z) const - { - if (max_zoom < min_zoom) - { - z= min_zoom - z; - } - - if (x<0 || x>pow(2.0,z)-1 || - y<0 || y>pow(2.0,z)-1) - { - return false; - } - return true; - - } - int TileMapAdapter::tilesonzoomlevel(int zoomlevel) const - { - return int(pow(2.0, zoomlevel)); - } - int TileMapAdapter::xoffset(int x) const - { - return x; - } - int TileMapAdapter::yoffset(int y) const - { - return y; - } -} diff --git a/lib/QMapControl/src/tilemapadapter.h b/lib/QMapControl/src/tilemapadapter.h deleted file mode 100644 index 15c44d3e174307e80448b7cb60b07516346050ea..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/tilemapadapter.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef TILEMAPADAPTER_H -#define TILEMAPADAPTER_H - -#include "mapadapter.h" - -namespace qmapcontrol -{ - //! MapAdapter for servers with image tiles - /*! - * Use this derived MapAdapter to display maps from OpenStreetMap - * @author Kai Winter - */ - class TileMapAdapter : public MapAdapter - { - Q_OBJECT - public: - //! constructor - /*! - * Sample of a correct initialization of a MapAdapter:
- * TileMapAdapter* ta = new TileMapAdapter("192.168.8.1", "/img/img_cache.php/%1/%2/%3.png", 256, 0,17);
- * The placeholders %1, %2, %3 stands for x, y, z
- * The minZoom is 0 (means the whole world is visible). The maxZoom is 17 (means it is zoomed in to the max) - * @param host The servers URL - * @param serverPath The path to the tiles with placeholders - * @param tilesize the size of the tiles - * @param minZoom the minimum zoom level - * @param maxZoom the maximum zoom level - */ - TileMapAdapter(const QString& host, const QString& serverPath, int tilesize, int minZoom = 0, int maxZoom = 17); - - virtual ~TileMapAdapter(); - - virtual QPoint coordinateToDisplay(const QPointF&) const; - virtual QPointF displayToCoordinate(const QPoint&) const; - - qreal PI; - - protected: - qreal rad_deg(qreal) const; - qreal deg_rad(qreal) const; - - virtual bool isValid(int x, int y, int z) const; - virtual void zoom_in(); - virtual void zoom_out(); - virtual QString query(int x, int y, int z) const; - virtual int tilesonzoomlevel(int zoomlevel) const; - virtual int xoffset(int x) const; - virtual int yoffset(int y) const; - }; -} -#endif diff --git a/lib/QMapControl/src/wmsmapadapter.cpp b/lib/QMapControl/src/wmsmapadapter.cpp deleted file mode 100644 index c6441a9bdb05f88bedd7a8374d4201786f4c37e6..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/wmsmapadapter.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "wmsmapadapter.h" -namespace qmapcontrol -{ - WMSMapAdapter::WMSMapAdapter(QString host, QString serverPath, int tilesize) - : MapAdapter(host, serverPath, tilesize, 0, 17) - { - // param1 = serverPath.indexOf("%1"); - // param2 = serverPath.indexOf("%2"); - // param3 = serverPath.indexOf("%3"); - // param4 = serverPath.indexOf("%4"); - // param5 = serverPath.indexOf("%5"); - // param6 = serverPath.lastIndexOf("%5"); - - // this->serverPath = serverPath.replace(param6, 2, QString().setNum(tilesize)).replace(param5, 2, QString().setNum(tilesize)); - - // sub1 = serverPath.mid(0, param1); - // sub2 = serverPath.mid(param1+2, param2-param1-2); - // sub3 = serverPath.mid(param2+2, param3-param2-2); - // sub4 = serverPath.mid(param3+2, param4-param3-2); - // sub5 = serverPath.mid(param4+2); - - this->serverPath.append("&WIDTH=").append(loc.toString(tilesize)) - .append("&HEIGHT=").append(loc.toString(tilesize)) - .append("&BBOX="); - numberOfTiles = pow(2.0, current_zoom); - coord_per_x_tile = 360. / numberOfTiles; - coord_per_y_tile = 180. / numberOfTiles; - } - - - WMSMapAdapter::~WMSMapAdapter() - { - } - - QPoint WMSMapAdapter::coordinateToDisplay(const QPointF& coordinate) const - { - qreal x = (coordinate.x()+180) * (numberOfTiles*mytilesize)/360.; // coord to pixel! - qreal y = -1*(coordinate.y()-90) * (numberOfTiles*mytilesize)/180.; // coord to pixel! - return QPoint(int(x), int(y)); - } - QPointF WMSMapAdapter::displayToCoordinate(const QPoint& point) const - { - qreal lon = (point.x()*(360./(numberOfTiles*mytilesize)))-180; - qreal lat = -(point.y()*(180./(numberOfTiles*mytilesize)))+90; - return QPointF(lon, lat); - } - void WMSMapAdapter::zoom_in() - { - current_zoom+=1; - numberOfTiles = pow(2.0, current_zoom); - coord_per_x_tile = 360. / numberOfTiles; - coord_per_y_tile = 180. / numberOfTiles; - } - void WMSMapAdapter::zoom_out() - { - current_zoom-=1; - numberOfTiles = pow(2.0, current_zoom); - coord_per_x_tile = 360. / numberOfTiles; - coord_per_y_tile = 180. / numberOfTiles; - } - - bool WMSMapAdapter::isValid(int /*x*/, int /*y*/, int /*z*/) const - { - // if (x>0 && y>0 && z>0) - { - return true; - } - // return false; - } - QString WMSMapAdapter::query(int i, int j, int /*z*/) const - { - return getQ(-180+i*coord_per_x_tile, - 90-(j+1)*coord_per_y_tile, - -180+i*coord_per_x_tile+coord_per_x_tile, - 90-(j+1)*coord_per_y_tile+coord_per_y_tile); - } - QString WMSMapAdapter::getQ(qreal ux, qreal uy, qreal ox, qreal oy) const - { - return QString().append(serverPath) - .append(loc.toString(ux)).append(",") - .append(loc.toString(uy)).append(",") - .append(loc.toString(ox)).append(",") - .append(loc.toString(oy)); - } -} diff --git a/lib/QMapControl/src/wmsmapadapter.h b/lib/QMapControl/src/wmsmapadapter.h deleted file mode 100644 index 42fd5fbaba6ef337f0dc63d40f5fb2cd77244b95..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/wmsmapadapter.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef WMSMAPADAPTER_H -#define WMSMAPADAPTER_H - -#include "mapadapter.h" - -namespace qmapcontrol -{ - //! MapAdapter for WMS servers - /*! - * Use this derived MapAdapter to display maps from WMS servers - * @author Kai Winter - */ - class WMSMapAdapter : public MapAdapter - { - public: - //! constructor - /*! - * Sample of a correct initialization of a MapAdapter:
- * MapAdapter* mapadapter = new WMSMapAdapter("www2.demis.nl", "/wms/wms.asp?wms=WorldMap[...]&BBOX=%1,%2,%3,%4&WIDTH=%5&HEIGHT=%5&TRANSPARENT=TRUE", 256);
- * The placeholders %1, %2, %3, %4 creates the bounding box, %5 is for the tilesize - * The minZoom is 0 (means the whole world is visible). The maxZoom is 17 (means it is zoomed in to the max) - * @param host The servers URL - * @param serverPath The path to the tiles with placeholders - * @param tilesize the size of the tiles - */ - WMSMapAdapter(QString host, QString serverPath, int tilesize = 256); - virtual ~WMSMapAdapter(); - - virtual QPoint coordinateToDisplay(const QPointF&) const; - virtual QPointF displayToCoordinate(const QPoint&) const; - - protected: - virtual void zoom_in(); - virtual void zoom_out(); - virtual QString query(int x, int y, int z) const; - virtual bool isValid(int x, int y, int z) const; - - private: - virtual QString getQ(qreal ux, qreal uy, qreal ox, qreal oy) const; - - qreal coord_per_x_tile; - qreal coord_per_y_tile; - }; -} -#endif diff --git a/lib/QMapControl/src/yahoomapadapter.cpp b/lib/QMapControl/src/yahoomapadapter.cpp deleted file mode 100644 index b264080552e2ab7832494322debbf8b8e6da351d..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/yahoomapadapter.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#include "yahoomapadapter.h" -namespace qmapcontrol -{ - YahooMapAdapter::YahooMapAdapter() - : TileMapAdapter("png.maps.yimg.com", "/png?v=3.1.0&x=%2&y=%3&z=%1", 256, 17,0) - { - int zoom = max_zoom < min_zoom ? min_zoom - current_zoom : current_zoom; - numberOfTiles = pow(2.0, zoom+1); - } - YahooMapAdapter::YahooMapAdapter(QString host, QString url) - : TileMapAdapter(host, url, 256, 17,0) - { - int zoom = max_zoom < min_zoom ? min_zoom - current_zoom : current_zoom; - numberOfTiles = pow(2.0, zoom+1); - } - YahooMapAdapter::~YahooMapAdapter() - { - } - - bool YahooMapAdapter::isValid(int /*x*/, int /*y*/, int /*z*/) const - { - return true; - } - - int YahooMapAdapter::tilesonzoomlevel(int zoomlevel) const - { - return int(pow(2.0, zoomlevel+1)); - } - - int YahooMapAdapter::yoffset(int y) const - { - int zoom = max_zoom < min_zoom ? min_zoom - current_zoom : current_zoom; - - int tiles = int(pow(2.0, zoom)); - y = y*(-1)+tiles-1; - return int(y); - } -} diff --git a/lib/QMapControl/src/yahoomapadapter.h b/lib/QMapControl/src/yahoomapadapter.h deleted file mode 100644 index ae03bba4d69d4d638c5dce8bf1dd42f9b47761ae..0000000000000000000000000000000000000000 --- a/lib/QMapControl/src/yahoomapadapter.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -* -* This file is part of QMapControl, -* an open-source cross-platform map widget -* -* Copyright (C) 2007 - 2008 Kai Winter -* -* This program 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 3 of the License, or -* (at your option) any later version. -* -* This program 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 QMapControl. If not, see . -* -* Contact e-mail: kaiwinter@gmx.de -* Program URL : http://qmapcontrol.sourceforge.net/ -* -*/ - -#ifndef YAHOOMAPADAPTER_H -#define YAHOOMAPADAPTER_H - -#include "tilemapadapter.h" - -namespace qmapcontrol -{ - //! MapAdapter for Yahoo Maps - /*! - * @author Kai Winter - */ - class YahooMapAdapter : public TileMapAdapter - { - Q_OBJECT - - public: - //! constructor - /*! - * This construct a Yahoo Adapter - */ - YahooMapAdapter(); - YahooMapAdapter(QString host, QString url); - virtual ~YahooMapAdapter(); - bool isValid(int x, int y, int z) const; - - protected: - virtual int tilesonzoomlevel(int zoomlevel) const; - virtual int yoffset(int y) const; - }; -} -#endif diff --git a/lib/openjaus/LICENSE b/lib/openjaus/LICENSE deleted file mode 100644 index 49d1c655442ad9d935324ac923e5ce4f5dd870cc..0000000000000000000000000000000000000000 --- a/lib/openjaus/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -OpenJAUS is distributed under the BSD license. -The full text of that license follows: - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of OpenJAUS.com nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/lib/openjaus/README.TXT b/lib/openjaus/README.TXT deleted file mode 100644 index f7e61177ba214101527197b53d478fdffb90fe44..0000000000000000000000000000000000000000 --- a/lib/openjaus/README.TXT +++ /dev/null @@ -1,205 +0,0 @@ -RELEASE NOTES: OpenJAUSv3.3 (07/10/08) -========================================== - -OpenJAUSv3.3 beta is an open source implementation of the JAUS Reference -Architecture Version 3.3. The latest code, documentation and support groups -are available at the OpenJAUS web site: http://www.openjaus.com/. - -This release contains the following projects: - -libjaus: A C99 compliant library that contains JAUS constructs, data - types and messages. -libopenJaus: A C/C++ library containing a runtime JAUS node manager library, - node manager communication interface, and component framework - library. -ojNodeManager: The OpenJAUS node manager executable with text interface -ojVehicleSim: A collection of JAUS components that work together to simulate - a JAUS ground vehicle subsystem. These components provide a set - of services that are commonly used in real ground vehicle - implementations. - -If you experience problems in compiling or developing with this code, please -read the tutorials and online FAQ before contacting the OpenJAUS development -group. Please attempt to locate where the problem exists and determine how the -problem can be replicated before seeking additional support. Code patches can be -uploaded at the OpenJAUS web site: http://www.openjaus.com. - - -Target Operating Environment: ------------------------------ - - This software is designed to be cross platform compatible. The code base has -been tested on a variety of operating systems and development environments including: -Linux (Ubuntu & Fedora Core) w/gnu toolchain, Mac OS X w/gnu toolchain, and Windows w/MS -Visual Studio. All test machines have been little endian byte order based. The libjaus -library is C99 compliant and should be compatible with any standard C compiler for any -processing platform. The libopenJaus library has some operating system dependent -abstractions, which may require different implementations for systems not using Linux -or Windows. The library was implemented with POSIX standard programming interfaces where -applicable, to provide a more standardized approach to multi-threading and mutex -implementation. - - -Installation (GNU Toolchain / Linux & Macintosh OS X): ------------------------------------------------------- - -Requirements: - make - gcc - g++ - -To build the library and executable code: - Execute the command: "make" in the root OpenJAUSv3.3.0 directory. The make -command will use the Makefile found in that directory to recursively make each -of the subprojects. Individual Makefiles are located in each subproject -directory to allow for building one project at a time if desired. - -Installation: - It is up to the individual developer to decide how to link their code with -the OpenJAUS libraries. Some developers may prefer to install the OpenJAUS -header files and libraries to globally accessible directories. For example, on a -Linux system: /usr/include/ and /usr/lib/. To minimize system invasiveness, -OpenJAUS does not install itself into system directories, rather, all code and -binaries remain in the folders included in the release download. - - To execute code developed with these libraries it is recommended that the -developer configure the dynamic linker runtime bindings to reference the -OpenJAUS library directories /libjaus/lib/ and /libopenJaus/lib/. This is done -by editing the systems ld.so.conf (most likely located at /etc/ld.so.conf) to -include these directories and then by running the command: "ldconfig". Another -option to this method would be to simply include the files libjaus.so and -libopenJaus.so in the executable's working directory. - - *Note: The default build of the libraries includes all symbols and debug -information within the shared object (.so) files. This is to facilitate -efficient development and use of a run-time debugger. To reduce the size of the -installed libraries, the information can be removed by using the "strip" -command. - - -Installation (Microsoft Visual Studio / Windows): ------------------------------------------------------- - -Requirements: - Microsoft Visual Studio - Pthreads-win32 (included in distribution) - pdcurses (included in distribution) - -To build the library and executable code: - -In the top level directory, open the Microsoft Visual Studio solution -file "OpenJAUSv3.3.0.sln." This solution contains 4 individual projects: -libjaus, libopenJaus, ojNodeManager and ojVehicleSim. These projects correspond -to the descriptions above. Once open, the solution should be able to be -built. Each project has the appropriate dependencies setup using relative paths, -therefore it should compile for the developer in any configuration. Also, project -references have been setup, so a referenced code base will be compiled prior to -the compilation of any child project. - -Once built, the ojNodeManager should run in a console window if it is set -as the default project. Ensure that the nodeManager.conf file is configured correctly. -The ojVehicleSim should run as well if it is set to the default project, however it -is important that the ojNodeManager be running first. - -The libraries libjaus and libopenJaus can be linked against other projects using -the .lib files. To run projects built against them, ensure the appropriate .dll -files are available either locally or globally on the system. - -*Note: Use of these libraries has only been tested in the Debug configuration -to date. This is due to the added value of retaining debug information for developers -of both the OpenJAUS code base and applications based upon that. The creation of release -targets, if desired, is left up to the individual developer. - - -Configuring and Running the Node Manager: ------------------------------------------ - - The node manager executable is currently designed to require manual -configuration. This means the user must edit the text file nodeManager.conf to -enter the appropriate JAUS identification numbers and names, and enter the -correct IP addresses for the intended hardware communication interfaces. The -user is also required to configure the node manager to enable or disable node -level and subsystem level communication. These configurations will vary -depending on the intended design of the JAUS system on which the node manager is -being used. Examples of different JAUS system setups are beyond the scope of -this document. The user is encouraged to read the JAUS reference architecture -and online OpenJAUS tutorials for a more detailed explanation. - -Format: - The nodeManager.conf file is made up of section tags and key - value pairs. -The tags are identified within straight braces, ex: "[SECTION]". The key value -pairs are delimited by a colon and a space character, ex: "key: value". - - To configure the JAUS node manager properties, edit the "SubsystemId" and -"NodeId" values found under the [JAUS] section tag. Each node manager on a -subsystem's node network should be configured with a unique NodeId number. -Likewise each subsystem on a network of JAUS subsystems should have a unique -SubsystemId number. Failure to make these values unique results in erratic and -undefined behavior when multiple node managers are running at the same time. -Only one node manager process should be run at any given time on a single node. - Set the "Subsystem_Identification" and "Node_Identification" values to any -text string that you would like for your particular system setup. These values -are not required to be unique, as they are only used for text description. - - To configure communication interface settings the user is only required to -edit the [Node_Communications] and [Subsystem_Communications] sections. By -default, component communications are always on and the configuration needs to -be kept fixed to use the loopback IP address 127.0.0.1. - Each communications section has one or more sets of transport interfaces -settings, for example "JAUS_UDP" and "OpenJAUS_UDP". This allows for multiple -transport interfaces to be used at a given communications level (component, -node, or subsystem). At present only the JAUS_UDP interface type is used at the -node and component level. However, this allows for other common transport types -such as TCP or Serial to be included in the future. - The user has the option to enable/disable a given transport interface, or -enable/disable an entire level of communication either node or subsystem. The -node manager will startup a transport interface if both it and its -communications level is enabled. To enable a communications level, simply set -the value of the "Enabled" key to "true". To disable a level, set the value to -"false". These values are case sensitive, ex: "TRUE" or "True" would not work. - When each JAUS_UDP interface starts, it attempts to open the network -interface specified with the user configured IP address. If such an interface -exists on the system, the node manager will open the JAUS port 3794 on that -interface. If not, the node manager will fail at startup and an error message -will appear. To configure each JAUS_UDP interface simply set the key -"JAUS_UDP_IP" value to the IP address of the network interface that you would -like it to use. The remaining key values should be left configured as in the -release download. Changing these values will lead to undefined behavior. They -are included only for completeness, and allow for future changes to be made if -necessary. - - -Further Information: --------------------- -Tutorials: http://www.openjaus.com/tutorials.html -Forums: http://www.openjaus.com/trac/openjaus/discussion -Support contracting: - -Known Issues: -------------- - -* There is no standalone API documentation, which describes all data - structures, functions, or default behavior. Please read the tutorials for - detailed information on how to perform common tasks. The header files are - organized by function breakdown and allow for easy access to data structure - definitions and function prototypes. Often the functions you seek can be - found quickly by browsing the include/ directories. - -* A "ToString" method for each JAUS message and data structure is lacking from - this implementation and thus makes displaying critical information to the - user more cumbersome. - - -Copyright Notices ------------------ - -Portions of the Windows distribution are based on pdcurses and Pthreads-win32. -These binaries packages have their own copyright. They are redistributed with the -OpenJAUS codebase as a convenience to developers. More information about these -packages can be found on their respective websites below: - -Pthreads-win32: http://sourceware.org/pthreads-win32/ -pdcurses: http://pdcurses.sourceforge.net/ - -The remainder of the code is copyright OpenJAUS.com and is distributed under the -BSD license. See the LICENSE file for details. diff --git a/lib/openjaus/libjaus/include/jaus.h b/lib/openjaus/libjaus/include/jaus.h deleted file mode 100644 index acf4b8739114b3835460a81fd7f11ec685494a09..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/jaus.h +++ /dev/null @@ -1,100 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jaus.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file is a wrapper for all other headers in jaus and will provide the user with access -// to the complete jaus library - -#ifndef JAUS_H -#define JAUS_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -#ifdef WIN32 - #define JAUS_EXPORT __declspec(dllexport) -#else - #define JAUS_EXPORT -#endif - -#define JAUS_LIBRARY_VERSION "3.3.0" - -typedef enum -{ - JAUS_FALSE = 0, - JAUS_TRUE = 1 -}JausBoolean; - -#define JAUS_IDENTIFICATION_LENGTH_BYTES 80 - -#define JAUS_PI 3.14159265358979323846 -#define JAUS_HALF_PI 1.570796326794897 -#define JAUS_DEG_PER_RAD 57.2957795131 -#define JAUS_RAD_PER_DEG 1.745329251994328e-2 - -// Define Target System Endianess Here -#if defined(__i386__) || defined(i386) || defined(_M_IX86) || defined(_X86_) || defined(__arm__) - #define JAUS_LITTLE_ENDIAN 1 -#elif defined(__ppc__) || defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) || defined(_M_PPC) - #define JAUS_BIG_ENDIAN 1 -#else - #error "Please define system endianess in jaus.h. #define either JAUS_LITTLE_ENDIAN or JAUS_BIG_ENDIAN" -#endif - -#include "jausArray.h" -#include "type/jausType.h" - -#include "jausAddress.h" -#include "jausState.h" -#include "jausSubsystem.h" -#include "jausNode.h" -#include "jausComponent.h" -#include "jausService.h" -#include "jausPayloadInterface.h" - -#include "message/jausMessageHeaders.h" - -#ifdef __cplusplus -} -#endif - -#endif // JAUS_H diff --git a/lib/openjaus/libjaus/include/jausAddress.h b/lib/openjaus/libjaus/include/jausAddress.h deleted file mode 100644 index bae103c6f4eec630e448fbca871af20abe2d9e4d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/jausAddress.h +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausAddress.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the basic JausAddress of each component - -#ifndef JAUS_ADDRESS_H -#define JAUS_ADDRESS_H - -#include "jaus.h" - -#define JAUS_INVALID_INSTANCE_ID 0 -#define JAUS_MINIMUM_INSTANCE_ID 1 -#define JAUS_MAXIMUM_INSTANCE_ID 254 -#define JAUS_BROADCAST_INSTANCE_ID 255 - -#define JAUS_INVALID_COMPONENT_ID 0 -#define JAUS_MINIMUM_COMPONENT_ID 1 -#define JAUS_MAXIMUM_COMPONENT_ID 254 -#define JAUS_BROADCAST_COMPONENT_ID 255 - -#define JAUS_INVALID_NODE_ID 0 -#define JAUS_MINIMUM_NODE_ID 1 -#define JAUS_MAXIMUM_NODE_ID 254 -#define JAUS_BROADCAST_NODE_ID 255 - -#define JAUS_INVALID_SUBSYSTEM_ID 0 -#define JAUS_MINIMUM_SUBSYSTEM_ID 1 -#define JAUS_MAXIMUM_SUBSYSTEM_ID 254 -#define JAUS_BROADCAST_SUBSYSTEM_ID 255 - -#define JAUS_NODE_MANAGER_COMPONENT 1 -#define JAUS_PRIMARY_NODE_MANAGER_NODE 1 - -#define JAUS_ADDRESS_WILDCARD_OCTET 0 - -struct JausAddressStruct -{ - JausByte instance; - JausByte component; - JausByte node; - JausByte subsystem; - - struct JausAddressStruct *next; -}; - -typedef struct JausAddressStruct *JausAddress; - -JAUS_EXPORT JausAddress jausAddressCreate(void); -JAUS_EXPORT void jausAddressDestroy(JausAddress); - -JAUS_EXPORT int jausAddressToString(JausAddress, char *); -JAUS_EXPORT JausAddress jausAddressClone(JausAddress src); -JAUS_EXPORT JausBoolean jausAddressCopy(JausAddress dst, JausAddress src); -JAUS_EXPORT JausBoolean jausAddressEqual(JausAddress, JausAddress); -JAUS_EXPORT JausBoolean jausAddressIsValid(JausAddress address); -JAUS_EXPORT int jausAddressHash(JausAddress address); - -#endif // JAUS_ADDRESS_H diff --git a/lib/openjaus/libjaus/include/jausArray.h b/lib/openjaus/libjaus/include/jausArray.h deleted file mode 100644 index 8721f124c27c8d8f6a8cc49f7f05d77c1dc5d668..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/jausArray.h +++ /dev/null @@ -1,65 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausArray.h -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) and Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a JausArray object - -#ifndef JAUS_ARRAY_H -#define JAUS_ARRAY_H - -typedef struct -{ - void **elementData; - int elementCount; - int capacity; - int capacityIncrement; -}JausArrayStruct; - -typedef JausArrayStruct * JausArray; - -JAUS_EXPORT JausArray jausArrayCreate(void); -JAUS_EXPORT void jausArrayDestroy(JausArray, void (*)(void *)); -JAUS_EXPORT void jausArrayAdd(JausArray, void *); -JAUS_EXPORT int jausArrayContains(JausArray, void *, int (*)(void *, void *)); -JAUS_EXPORT void *jausArrayRemove(JausArray, void *, int (*)(void *, void *)); -JAUS_EXPORT void *jausArrayRemoveAt(JausArray, int); -JAUS_EXPORT void jausArrayRemoveAll(JausArray jausArray, void (*elementDestroy)(void *)); - -#endif // JAUS_ARRAY_H diff --git a/lib/openjaus/libjaus/include/jausComponent.h b/lib/openjaus/libjaus/include/jausComponent.h deleted file mode 100644 index f6ea62478fb561f5ba4d32f5ff29b625b710a41e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/jausComponent.h +++ /dev/null @@ -1,123 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausComponent.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the attributes of a JausComponent and defines all -// pre-defined Jaus Component Ids according to RA 3.2 - -#ifndef JAUS_COMPONENT_H -#define JAUS_COMPONENT_H - -#include - -#include "jaus.h" - -#define JAUS_DEFAULT_AUTHORITY 0 - -// Jaus-Defined Component Ids: -#define JAUS_NODE_MANAGER 1 -#define JAUS_SUBSYSTEM_COMMANDER 32 -#define JAUS_PRIMITIVE_DRIVER 33 -#define JAUS_GLOBAL_VECTOR_DRIVER 34 -#define JAUS_COMMUNICATOR 35 -#define JAUS_MISSION_SPOOLER 36 -#define JAUS_VISUAL_SENSOR 37 -#define JAUS_GLOBAL_POSE_SENSOR 38 -#define JAUS_MISSION_PLANNER 39 -#define JAUS_SYSTEM_COMMANDER 40 -#define JAUS_LOCAL_POSE_SENSOR 41 -#define JAUS_VELOCITY_STATE_SENSOR 42 -#define JAUS_REFLEXIVE_DRIVER 43 -#define JAUS_LOCAL_VECTOR_DRIVER 44 -#define JAUS_GLOBAL_WAYPOINT_DRIVER 45 -#define JAUS_LOCAL_WAYPOINT_DRIVER 46 -#define JAUS_GLOBAL_PATH_SEGMENT_DRIVER 47 -#define JAUS_LOCAL_PATH_SEGMENT_DRIVER 48 -#define JAUS_PRIMITIVE_MANIPULATOR 49 -#define JAUS_RANGE_SENSOR 50 -#define JAUS_MANIPULATOR_JOINT_POSITION_SENSOR 51 -#define JAUS_MANIPULATOR_JOINT_VELOCITY_SENSOR 52 -#define JAUS_MANIPULATOR_JOINT_FORCE_TORQUE_SENSOR 53 -#define JAUS_MANIPULATOR_JOINT_POSITIONS_DRIVER 54 -#define JAUS_MANIPULATOR_END_EFFECTOR_DRIVER 55 -#define JAUS_MANIPULATOR_JOINT_VELOCITIES_DRIVER 56 -#define JAUS_MANIPULATOR_END_EFFECTOR_VELOCITY_STATE_DRIVER 57 -#define JAUS_MANIPULATOR_JOINT_MOVE_DRIVER 58 -#define JAUS_MANIPULATOR_END_EFFECTOR_DISCRETE_POSE_DRIVER 59 -#define JAUS_WORLD_MODEL_VECTOR_KNOWLEDGE_STORE 61 - -#define COMPONENT_TIMEOUT_SEC 3.0 - -typedef struct -{ - char *identification; - JausAddress address; - JausState state; - JausByte authority; - JausNode node; - JausArray services; - - struct - { - JausAddress address; - JausState state; - JausByte authority; - JausBoolean active; - }controller; - - time_t timeStampSec; -}JausComponentStruct; - -typedef JausComponentStruct *JausComponent; - -JAUS_EXPORT JausComponent jausComponentCreate(void); -JAUS_EXPORT void jausComponentDestroy(JausComponent cmpt); -JAUS_EXPORT JausComponent jausComponentClone(JausComponent cmpt); - -JAUS_EXPORT char *jausComponentGetTypeString(JausComponent cmpt); - -JAUS_EXPORT void jausComponentUpdateTimestamp(JausComponent cmpt); -JAUS_EXPORT JausBoolean jausComponentIsTimedOut(JausComponent cmpt); -JAUS_EXPORT JausBoolean jausComponentHasIdentification(JausComponent cmpt); -JAUS_EXPORT JausBoolean jausComponentHasServices(JausComponent cmpt); - -JAUS_EXPORT int jausComponentToString(JausComponent cmpt, char *buf); - -#endif // JAUS_COMPONENT_H diff --git a/lib/openjaus/libjaus/include/jausNode.h b/lib/openjaus/libjaus/include/jausNode.h deleted file mode 100644 index a136b455f5d7998a841df36757eaee6a61ea76ab..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/jausNode.h +++ /dev/null @@ -1,75 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausNode.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the attributes of a JausNode - -#ifndef JAUS_NODE_H -#define JAUS_NODE_H - -#define NODE_TIMEOUT_SEC 5.0 - -#include -#include "jaus.h" - -typedef struct -{ - char *identification; - JausByte id; - JausSubsystem subsystem; - JausArray components; - - time_t timeStampSec; -}JausNodeStruct; - -typedef JausNodeStruct *JausNode; - -JAUS_EXPORT JausNode jausNodeCreate(void); -JAUS_EXPORT void jausNodeDestroy(JausNode node); -JAUS_EXPORT JausNode jausNodeClone(JausNode node); -JAUS_EXPORT JausBoolean jausNodeHasIdentification(JausNode node); -JAUS_EXPORT JausBoolean jausNodeHasConfiguration(JausNode node); - -JAUS_EXPORT JausBoolean jausNodeFreeMemory(JausNode node); -JAUS_EXPORT void jausNodeUpdateTimestamp(JausNode node); -JAUS_EXPORT JausBoolean jausNodeIsTimedOut(JausNode node); -JAUS_EXPORT int jausNodeToString(JausNode node, char *buf); - -#endif //JAUS_NODE_H diff --git a/lib/openjaus/libjaus/include/jausPayloadInterface.h b/lib/openjaus/libjaus/include/jausPayloadInterface.h deleted file mode 100644 index 24c62ece5a66fe5151678ef8056b61129e029efe..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/jausPayloadInterface.h +++ /dev/null @@ -1,335 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausPayloadInterface.h -// -// Written By: Bob Touchton (btouch AT comcast DOT net) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportPayloadInterfaceMessage support functions - -#ifndef REPORT_PAYLOAD_INTERFACE_H -#define REPORT_PAYLOAD_INTERFACE_H - -#include "jaus.h" - -#define NO_ENUM 0 -#define NO_HMI 0 -//#define FAILURE -1 -#define SUCCESS 1 -#define FAILURE 0 - -// Type Codes -#define TYPE_CODE_SHORT 1 -#define TYPE_CODE_INTEGER 2 -#define TYPE_CODE_LONG 3 -#define TYPE_CODE_BYTE 4 -#define TYPE_CODE_U_SHORT 5 -#define TYPE_CODE_U_INTEGER 6 -#define TYPE_CODE_U_LONG 7 -#define TYPE_CODE_FLOAT 8 -#define TYPE_CODE_DOUBLE 9 - -#define TYPE_CODE_SCALED_U_BYTE 10 -#define TYPE_CODE_SCALED_SHORT 11 -#define TYPE_CODE_SCALED_U_SHORT 12 -#define TYPE_CODE_SCALED_INTEGER 13 -#define TYPE_CODE_SCALED_U_INTEGER 14 -#define TYPE_CODE_SCALED_LONG 15 -#define TYPE_CODE_SCALED_U_LONG 16 - -#define TYPE_CODE_ENUM 17 -#define TYPE_CODE_BOOLEAN 18 -#define TYPE_CODE_STRING 19 - -#define TYPE_CODE_U_BYTE_TUPLE 20 -#define TYPE_CODE_U_SHORT_TUPLE 21 -#define TYPE_CODE_U_INTEGER_TUPLE 22 - -// Presence Vector Bits -#ifndef JAUS_PAYLOAD_INTERFACE_PV -#define JAUS_PAYLOAD_INTERFACE_PV -#define JAUS_PAYLOAD_INTERFACE_PV_HMI_RECOMMENDATION_BIT 0 -#define JAUS_PAYLOAD_INTERFACE_PV_HMI_XPOS_BIT 1 -#define JAUS_PAYLOAD_INTERFACE_PV_HMI_YPOS_BIT 2 -#define JAUS_PAYLOAD_INTERFACE_PV_HMI_WIDTH_BIT 3 -#define JAUS_PAYLOAD_INTERFACE_PV_HMI_HEIGHT_BIT 4 -#endif - -// ************************************************************************************************************************************ -// Report PayloadInterface Support -// ************************************************************************************************************************************ - -typedef union -{ - JausShort shortValue; - JausInteger integerValue; - JausLong longValue; - JausByte byteValue; - JausUnsignedShort uShortValue; - JausUnsignedInteger uIntegerValue; - JausUnsignedLong uLongValue; - JausFloat floatValue; - JausDouble longFloatValue; - JausByte enumValue; - JausBoolean booleanValue; - struct - { - JausUnsignedShort length; - char * value; - }string; - struct - { - JausByte one; - JausByte two; - }byteTuple; - struct - { - JausUnsignedShort one; - JausUnsignedShort two; - }shortTuple; - struct - { - JausUnsignedInteger one; - JausUnsignedInteger two; - }integerTuple; -}JausTypeCode; - -typedef struct -{ - JausByte presenceVector; - JausArray jausCommandInterfaces; // Dynamic Array of command interfaces - JausArray jausInformationInterfaces; // Dynamic Array of information interfaces -}JausPayloadInterfaceStruct; -typedef JausPayloadInterfaceStruct *JausPayloadInterface; - -typedef struct -{ - char* commandIdentifier; // null-terminated string - JausByte typeCode; // per TYPE CODE table - JausByte units; // per UNITS table - JausByte blockingFlag; // 0 for blocking, 1 for non-blocking - JausTypeCode minValue; // minimum acceptable value - JausTypeCode defaultValue; // default value - JausTypeCode maxValue; // maximum acceptable value - JausUnsignedShort enumerationLength; // length = 0 means no enumeration field; includes NULL character - char* enumeration; // enumeration content, comma delimited, NULL terminated - JausByte hmiRecommendation; // per HMI table - JausUnsignedShort hmiRecommendedPositionXPixels; - JausUnsignedShort hmiRecommendedPositionYPixels; - JausUnsignedShort hmiRecommendedPositionWidthPixels; - JausUnsignedShort hmiRecommendedPositionHeightPixels; - JausTypeCode currentValue; // extra field to store the current data value -}JausCommandInterfaceStruct; -typedef JausCommandInterfaceStruct *JausCommandInterface; - -typedef struct -{ - char* informationIdentifier; // null-terminated string - JausByte commandInterfaceAssociation; // index number of the assoc. command interface, 0 if none - JausByte typeCode; // per TYPE CODE table - JausByte units; // per UNITS table - JausTypeCode minValue; // minimum acceptable value - JausTypeCode defaultValue; // default value - JausTypeCode maxValue; // maximum acceptable value - JausUnsignedShort enumerationLength; // length = 0 means no enumeration field; includes NULL character - char* enumeration; // enumeration content, comma delimited, NULL terminated - JausByte hmiRecommendation; // per HMI table - JausUnsignedShort hmiRecommendedPositionXPixels; - JausUnsignedShort hmiRecommendedPositionYPixels; - JausUnsignedShort hmiRecommendedPositionWidthPixels; - JausUnsignedShort hmiRecommendedPositionHeightPixels; - JausTypeCode currentValue; // extra field to store the current data value -}JausInformationInterfaceStruct; -typedef JausInformationInterfaceStruct *JausInformationInterface; - -// container to support multiple payload data element messages -typedef struct -{ - JausPayloadInterface payloadInterface; - //JausByte numberInformationInterfaces; - JausArray jausPayloadDataElements; // Dynamic Array of data elements -}JausPayloadDataElementsStruct; -typedef JausPayloadDataElementsStruct *JausPayloadDataElements; - -// container to provide a specific payload data element -typedef struct -{ - char* dataElementIdentifier; // null-terminated string - JausByte dataElementIndex; - JausTypeCode Value; -}JausPayloadDataElementStruct; -typedef JausPayloadDataElementStruct *JausPayloadDataElement; - - -// Command Interface Constructor -JAUS_EXPORT JausCommandInterface jausCommandInterfaceCreate(void); - -// Information Interface Constructor -JAUS_EXPORT JausInformationInterface jausInformationInterfaceCreate(void); - -// Command Interface Destructor -JAUS_EXPORT void jausCommandInterfaceDestroy(JausCommandInterface commandInterface); - -// Information Interface Destructor -JAUS_EXPORT void jausInformationInterfaceDestroy(JausInformationInterface informationInterface); - -// Interface Retrievers -JAUS_EXPORT JausCommandInterface jausCommandInterfaceRetrieve(JausPayloadInterface payloadInterface, char* identifier); - -JAUS_EXPORT JausInformationInterface jausInformationInterfaceRetrieve(JausPayloadInterface payloadInterface, char* identifier); - -// ************************************************************************************************************************************ -// Report PayloadInterface End User Functions -// ************************************************************************************************************************************ - -// Payload Interface Constructor -JAUS_EXPORT JausPayloadInterface jausPayloadInterfaceCreate(void); - -// Payload Interface Destructor -JAUS_EXPORT void jausPayloadInterfaceDestroy(JausPayloadInterface payloadInterface); - -// Interface Adders -JAUS_EXPORT JausCommandInterface jausAddNewCommandInterface(JausPayloadInterface payloadInterface, char* identifier, JausByte typeCode); -JAUS_EXPORT JausInformationInterface jausAddNewInformationInterface(JausPayloadInterface payloadInterface, char* identifier, JausByte typeCode); - -// Report Payload Interface Message Support Functions - -// NOTE: this function assumes end user is starting their index at 1, iaw the numbering scheme in the JAUS OPC ICD -JAUS_EXPORT char* jausGetCommandInterfaceIdentifierByIndex(JausPayloadInterface payloadInterface, int index, int* successFlag); - -JAUS_EXPORT char* jausGetInformationInterfaceIdentifierByIndex(JausPayloadInterface payloadInterface, int index, int* successFlag); - -JAUS_EXPORT JausByte jausGetCommandInterfaceTypeCode(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausByte jausGetInformationInterfaceTypeCode(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausBoolean jausSetCommandInterfaceUnits(JausPayloadInterface payloadInterface, char* identifier, JausByte units); - -JAUS_EXPORT JausByte jausGetCommandInterfaceUnits(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausBoolean jausSetCommandInterfaceBlockingFlag(JausPayloadInterface payloadInterface, char* identifier); - -JAUS_EXPORT JausBoolean jausClearCommandInterfaceBlockingFlag(JausPayloadInterface payloadInterface, char* identifier); - -JAUS_EXPORT JausBoolean jausGetCommandInterfaceBlockingFlag(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausBoolean jausSetCommandInterfaceMinMax(JausPayloadInterface payloadInterface, char* identifier, JausTypeCode minValue, JausTypeCode maxValue); - -JAUS_EXPORT JausTypeCode jausGetCommandInterfaceMin(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausTypeCode jausGetCommandInterfaceMax(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausBoolean jausSetCommandInterfaceDefault(JausPayloadInterface payloadInterface, char* identifier, JausTypeCode defaultValue); - -JAUS_EXPORT JausTypeCode jausGetCommandInterfaceDefault(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausBoolean jausSetCommandInterfaceEnumeration(JausPayloadInterface payloadInterface, char* identifier, char* enumeration); - -JAUS_EXPORT char* jausGetCommandInterfaceEnumeration(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausUnsignedShort jausGetCommandInterfaceEnumerationLength(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausBoolean jausSetCommandInterfaceHmiRecommendation(JausPayloadInterface payloadInterface, char* identifier, JausByte hmiRecommendation); - -JAUS_EXPORT JausByte jausGetCommandInterfaceHmiRecommendation(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -// NOTE: recommended HMI positioning must be set as a group -JAUS_EXPORT JausBoolean jausSetCommandInterfaceHmiParameters(JausPayloadInterface payloadInterface, char* identifier, JausUnsignedShort xPixels, JausUnsignedShort yPixels, JausUnsignedShort widthPixels, JausUnsignedShort heightPixels); - -JAUS_EXPORT JausUnsignedShort jausGetCommandInterfaceHmiXPositionPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausUnsignedShort jausGetCommandInterfaceHmiYPositionPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausUnsignedShort jausGetCommandInterfaceHmiWidthPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausUnsignedShort jausGetCommandInterfaceHmiHeightPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausBoolean jausSetInformationInterfaceUnits(JausPayloadInterface payloadInterface, char* identifier, JausByte units); - -JAUS_EXPORT JausByte jausGetInformationInterfaceUnits(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausBoolean jausSetInformationInterfaceCommandInterfaceAssoc(JausPayloadInterface payloadInterface, char* identifier, JausByte commandInterfaceAssociation); - -JAUS_EXPORT JausByte jausGetInformationInterfaceCommandInterfaceAssoc(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausBoolean jausSetInformationInterfaceMinMax(JausPayloadInterface payloadInterface, char* identifier, JausTypeCode minValue, JausTypeCode maxValue); - -JAUS_EXPORT JausTypeCode jausGetInformationInterfaceMin(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausTypeCode jausGetInformationInterfaceMax(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausBoolean jausSetInformationInterfaceDefault(JausPayloadInterface payloadInterface, char* identifier, JausTypeCode defaultValue); - -JAUS_EXPORT JausTypeCode jausGetInformationInterfaceDefault(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausBoolean jausSetInformationInterfaceEnumeration(JausPayloadInterface payloadInterface, char* identifier, char* enumeration); - -JAUS_EXPORT char* jausGetInformationInterfaceEnumeration(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausUnsignedShort jausGetInformationInterfaceEnumerationLength(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausBoolean jausSetInformationInterfaceHmiRecommendation(JausPayloadInterface payloadInterface, char* identifier, JausByte hmiRecommendation); - -JAUS_EXPORT JausByte jausGetInformationInterfaceHmiRecommendation(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -// NOTE: recommended HMI positioning must be set as a group -JAUS_EXPORT JausBoolean jausSetInformationInterfaceHmiParameters(JausPayloadInterface payloadInterface, char* identifier, JausUnsignedShort xPixels, JausUnsignedShort yPixels, JausUnsignedShort widthPixels, JausUnsignedShort heightPixels); - -JAUS_EXPORT JausUnsignedShort jausGetInformationInterfaceHmiXPositionPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausUnsignedShort jausGetInformationInterfaceHmiYPositionPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausUnsignedShort jausGetInformationInterfaceHmiWidthPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -JAUS_EXPORT JausUnsignedShort jausGetInformationInterfaceHmiHeightPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag); - -// decodes the Type Code value and returns the number of bytes required -JAUS_EXPORT int jausMinMaxDefaultSizeBytes(JausByte typeCodeEnum); -JAUS_EXPORT int jausCommandValueSizeBytes(JausCommandInterface commandInterface); -JAUS_EXPORT int jausInformationValueSizeBytes(JausInformationInterface informationInterface); - -// determines how to pack fields that have a JausTypeCode data type -JAUS_EXPORT int jausMinMaxDefaultToBuffer(JausTypeCode field, unsigned char* buffer, unsigned int bufferSizeBytes, JausByte typeCodeEnum); -JAUS_EXPORT int jausInformationValueToBuffer(JausInformationInterface informationInterface, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT int jausCommandValueToBuffer(JausCommandInterface commandInterface, unsigned char* buffer, unsigned int bufferSizeBytes); - -// determines how to unpack fields that have a JausTypeCode data type -JAUS_EXPORT JausBoolean jausMinMaxDefaultFromBuffer(JausTypeCode *field, unsigned char* buffer, unsigned int bufferSizeBytes, JausByte typeCodeEnum); -JAUS_EXPORT JausBoolean jausInformationValueFromBuffer(JausInformationInterface informationInterface, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean jausCommandValueFromBuffer(JausCommandInterface commandInterface, unsigned char* buffer, unsigned int bufferSizeBytes); - -#endif diff --git a/lib/openjaus/libjaus/include/jausService.h b/lib/openjaus/libjaus/include/jausService.h deleted file mode 100644 index 88ba4cfd7ec116dd332128c9ca85d1a3a625ee53..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/jausService.h +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausService.h -// -// Written By: Bob Touchton (btouch AT comcast DOT net), inspired by Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// This file defines the attributes of a ReportServicesMessage support functions - -#ifndef JAUS_SERVICE_H -#define JAUS_SERVICE_H - -#include "jaus.h" - -#define CORE_MESSAGE_SUPPORT 0 -#define NO_PRESENCE_VECTOR 0 -#define JAUS_SERVICE_INPUT_COMMAND 0 -#define JAUS_SERVICE_OUTPUT_COMMAND 1 - -// ************************************************************************************************************************************ -// Report Services Support -// ************************************************************************************************************************************ - -struct JausCommandStruct -{ - JausUnsignedShort commandCode; - JausUnsignedInteger presenceVector; - - struct JausCommandStruct *next; -}; - -typedef struct JausCommandStruct *JausCommand; - -struct JausServiceStruct -{ - JausUnsignedShort type; // Enumeration, same as Component ID from RA 3.2 - JausCommand inputCommandList; // List of input messages - JausByte inputCommandCount; - JausCommand outputCommandList; // List of output messages - JausByte outputCommandCount; - - struct JausServiceStruct *next; -}; - -typedef struct JausServiceStruct *JausService; - -// Services JausArray Constructor -JAUS_EXPORT JausArray jausServicesCreate(void); - -// Services JausArray Destructor -JAUS_EXPORT void jausServicesDestroy(JausArray jausServices); - -// Services Duplication -JAUS_EXPORT JausArray jausServicesClone(JausArray sourceServices); - -// Service Constructor -JAUS_EXPORT JausService jausServiceCreate(JausUnsignedShort type); - -// Command Constructor -JAUS_EXPORT JausCommand jausCommandCreate(void); - -// Service Destructor -JAUS_EXPORT void jausServiceDestroy(JausService service); - -// Command Destructor -JAUS_EXPORT void jausCommandDestroy(JausCommand command); - -// ************************************************************************************************************************************ -// Report Services End User Functions -// ************************************************************************************************************************************ - -JAUS_EXPORT JausBoolean jausServiceAddCoreServices(JausArray jausServices); - -JAUS_EXPORT JausService jausServiceCreateService(JausUnsignedShort serviceType); - -JAUS_EXPORT JausBoolean jausServiceAddInputCommand(JausService service, JausUnsignedShort commandCode, JausUnsignedInteger presenceVector); - -JAUS_EXPORT JausBoolean jausServiceAddOutputCommand(JausService service, JausUnsignedShort commandCode, JausUnsignedInteger presenceVector); - -JAUS_EXPORT JausBoolean jausServiceAddService(JausArray jausServices, JausService service); - -JAUS_EXPORT JausService jausServiceRetrieveService(JausArray jausServices, JausUnsignedShort serviceType); - -#endif - diff --git a/lib/openjaus/libjaus/include/jausState.h b/lib/openjaus/libjaus/include/jausState.h deleted file mode 100644 index 4f14838bbb504566c3234e8b3fa00fdac994b2e7..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/jausState.h +++ /dev/null @@ -1,63 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausState.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: Functionality associated with the possible states of a JAUS Component. - -#ifndef JAUS_STATE_H -#define JAUS_STATE_H - -typedef enum -{ - JAUS_UNDEFINED_STATE = -1, - JAUS_UNKNOWN_STATE = -1, - JAUS_INVALID_STATE = -1, - JAUS_INITIALIZE_STATE = 0, - JAUS_READY_STATE = 1, - JAUS_STANDBY_STATE = 2, - JAUS_SHUTDOWN_STATE = 3, - JAUS_FAILURE_STATE = 4, - JAUS_EMERGENCY_STATE = 5 -}JausState; - -JAUS_EXPORT int jausStateToString(JausState state, char *buf); -JAUS_EXPORT char *jausStateGetString(JausState state); - -#endif diff --git a/lib/openjaus/libjaus/include/jausSubsystem.h b/lib/openjaus/libjaus/include/jausSubsystem.h deleted file mode 100644 index bbc18d6c85ef209d0f308e6b629dcfbf1aa0b3bc..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/jausSubsystem.h +++ /dev/null @@ -1,77 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausSubsystem.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the attributes of a JausSubsystem - -#ifndef JAUS_SUBSYSTEM_H -#define JAUS_SUBSYSTEM_H - -#include -#include "jaus.h" - -#define SUBSYSTEM_TIMEOUT_SEC 5.0 - -typedef struct -{ - char *identification; - int id; - JausArray nodes; - time_t timeStampSec; -}JausSubsystemStruct; - -typedef JausSubsystemStruct *JausSubsystem; - -JAUS_EXPORT JausSubsystem jausSubsystemCreate(void); -JAUS_EXPORT void jausSubsystemDestroy(JausSubsystem subs); -JAUS_EXPORT JausSubsystem jausSubsystemClone(JausSubsystem subs); - -JAUS_EXPORT JausBoolean jausSubsystemFreeMemory(JausSubsystem subs); - -JAUS_EXPORT void jausSubsystemUpdateTimestamp(JausSubsystem subs); -JAUS_EXPORT JausBoolean jausSubsystemIsTimedOut(JausSubsystem subs); -JAUS_EXPORT JausBoolean jausSubsystemHasIdentification(JausSubsystem subs); -JAUS_EXPORT JausBoolean jausSubsystemHasConfiguration(JausSubsystem subs); - -JAUS_EXPORT int jausSubsystemToString(JausSubsystem subs, char *buf); -JAUS_EXPORT int jausSubsystemTableToString(JausSubsystem subs, char *buf); -JAUS_EXPORT int jausSubsystemTableToDetailedString(JausSubsystem subs, char *buf); - -#endif diff --git a/lib/openjaus/libjaus/include/message/command/communications/setDataLinkSelectMessage.h b/lib/openjaus/libjaus/include/message/command/communications/setDataLinkSelectMessage.h deleted file mode 100644 index 28942b88c9481209f24e33a221620559dfe94a2f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/communications/setDataLinkSelectMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setDataLinkSelectMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetDataLinkSelectMessage - -#ifndef SET_DATA_LINK_SELECT_MESSAGE_H -#define SET_DATA_LINK_SELECT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - - JausByte dataLinkId; - -}SetDataLinkSelectMessageStruct; - -typedef SetDataLinkSelectMessageStruct* SetDataLinkSelectMessage; - -JAUS_EXPORT SetDataLinkSelectMessage setDataLinkSelectMessageCreate(void); -JAUS_EXPORT void setDataLinkSelectMessageDestroy(SetDataLinkSelectMessage); - -JAUS_EXPORT JausBoolean setDataLinkSelectMessageFromBuffer(SetDataLinkSelectMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setDataLinkSelectMessageToBuffer(SetDataLinkSelectMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetDataLinkSelectMessage setDataLinkSelectMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setDataLinkSelectMessageToJausMessage(SetDataLinkSelectMessage message); - -JAUS_EXPORT unsigned int setDataLinkSelectMessageSize(SetDataLinkSelectMessage message); - -#endif // SET_DATA_LINK_SELECT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/communications/setDataLinkStatusMessage.h b/lib/openjaus/libjaus/include/message/command/communications/setDataLinkStatusMessage.h deleted file mode 100644 index a17edd1d16db3b88633692b991be58717125c753..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/communications/setDataLinkStatusMessage.h +++ /dev/null @@ -1,115 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setDataLinkStatusMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetDataLinkStatusMessage - -#ifndef SET_DATA_LINK_STATUS_MESSAGE_H -#define SET_DATA_LINK_STATUS_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_DATA_LINK_ENUM -#define JAUS_DATA_LINK_ENUM -typedef enum -{ - JAUS_DATA_LINK_OFF = 0, - JAUS_DATA_LINK_ON = 1, - JAUS_DATA_LINK_STANDBY = 2 -} JausDataLinkEnum; -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausDataLinkEnum state; - -}SetDataLinkStatusMessageStruct; - -typedef SetDataLinkStatusMessageStruct* SetDataLinkStatusMessage; - -JAUS_EXPORT SetDataLinkStatusMessage setDataLinkStatusMessageCreate(void); -JAUS_EXPORT void setDataLinkStatusMessageDestroy(SetDataLinkStatusMessage); - -JAUS_EXPORT JausBoolean setDataLinkStatusMessageFromBuffer(SetDataLinkStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setDataLinkStatusMessageToBuffer(SetDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetDataLinkStatusMessage setDataLinkStatusMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setDataLinkStatusMessageToJausMessage(SetDataLinkStatusMessage message); - -JAUS_EXPORT unsigned int setDataLinkStatusMessageSize(SetDataLinkStatusMessage message); - -#endif // SET_DATA_LINK_STATUS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/communications/setSelectedDataLinkStateMessage.h b/lib/openjaus/libjaus/include/message/command/communications/setSelectedDataLinkStateMessage.h deleted file mode 100644 index 88abe8675637a3a665150fd7a01d38c4e693a8c7..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/communications/setSelectedDataLinkStateMessage.h +++ /dev/null @@ -1,107 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setSelectedDataLinkStateMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetSelectedDataLinkStateMessage - -#ifndef SET_SELECTED_DATA_LINK_STATE_MESSAGE_H -#define SET_SELECTED_DATA_LINK_STATE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - - JausByte dataLinkId; - JausByte state; - -}SetSelectedDataLinkStateMessageStruct; - -typedef SetSelectedDataLinkStateMessageStruct* SetSelectedDataLinkStateMessage; - -JAUS_EXPORT SetSelectedDataLinkStateMessage setSelectedDataLinkStateMessageCreate(void); -JAUS_EXPORT void setSelectedDataLinkStateMessageDestroy(SetSelectedDataLinkStateMessage); - -JAUS_EXPORT JausBoolean setSelectedDataLinkStateMessageFromBuffer(SetSelectedDataLinkStateMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setSelectedDataLinkStateMessageToBuffer(SetSelectedDataLinkStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetSelectedDataLinkStateMessage setSelectedDataLinkStateMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setSelectedDataLinkStateMessageToJausMessage(SetSelectedDataLinkStateMessage message); - -JAUS_EXPORT unsigned int setSelectedDataLinkStateMessageSize(SetSelectedDataLinkStateMessage message); - -#endif // SET_SELECTED_DATA_LINK_STATE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/activateServiceConnectionMessage.h b/lib/openjaus/libjaus/include/message/command/core/activateServiceConnectionMessage.h deleted file mode 100644 index c768207948a58f8d177b4005fb0ff170d39028c7..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/activateServiceConnectionMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: activateServiceConnectionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ActivateServiceConnectionMessage - -#ifndef ACTIVATE_SERVICE_CONNECTION_MESSAGE_H -#define ACTIVATE_SERVICE_CONNECTION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort serviceConnectionCommandCode; - JausByte instanceId; - -}ActivateServiceConnectionMessageStruct; - -typedef ActivateServiceConnectionMessageStruct* ActivateServiceConnectionMessage; - -JAUS_EXPORT ActivateServiceConnectionMessage activateServiceConnectionMessageCreate(void); -JAUS_EXPORT void activateServiceConnectionMessageDestroy(ActivateServiceConnectionMessage); - -JAUS_EXPORT JausBoolean activateServiceConnectionMessageFromBuffer(ActivateServiceConnectionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean activateServiceConnectionMessageToBuffer(ActivateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ActivateServiceConnectionMessage activateServiceConnectionMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage activateServiceConnectionMessageToJausMessage(ActivateServiceConnectionMessage message); - -JAUS_EXPORT unsigned int activateServiceConnectionMessageSize(ActivateServiceConnectionMessage message); - - -#endif // ACTIVATE_SERVICE_CONNECTION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/clearEmergencyMessage.h b/lib/openjaus/libjaus/include/message/command/core/clearEmergencyMessage.h deleted file mode 100644 index d9de4ada97c01114292539d49067be6c4d71bd62..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/clearEmergencyMessage.h +++ /dev/null @@ -1,110 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: clearEmergencyMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ClearEmergencyMessage - -#ifndef CLEAR_EMERGENCY_MESSAGE_H -#define CLEAR_EMERGENCY_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_CLEAR_EMERGENCY_BF -#define JAUS_CLEAR_EMERGENCY_BF -#define JAUS_CLEAR_EMERGENCY_BF_CLEAR_EMERGENCY_BIT 0 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausBoolean clearEmergency; - -}ClearEmergencyMessageStruct; - -typedef ClearEmergencyMessageStruct* ClearEmergencyMessage; - -JAUS_EXPORT ClearEmergencyMessage clearEmergencyMessageCreate(void); -JAUS_EXPORT void clearEmergencyMessageDestroy(ClearEmergencyMessage); - -JAUS_EXPORT JausBoolean clearEmergencyMessageFromBuffer(ClearEmergencyMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean clearEmergencyMessageToBuffer(ClearEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ClearEmergencyMessage clearEmergencyMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage clearEmergencyMessageToJausMessage(ClearEmergencyMessage message); - -JAUS_EXPORT unsigned int clearEmergencyMessageSize(ClearEmergencyMessage message); - - -#endif // CLEAR_EMERGENCY_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/confirmComponentControlMessage.h b/lib/openjaus/libjaus/include/message/command/core/confirmComponentControlMessage.h deleted file mode 100644 index 0e756bc3b92f0f9f61086e1993c4f70ce2b16f5d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/confirmComponentControlMessage.h +++ /dev/null @@ -1,114 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: confirmComponentControlMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ConfirmComponentControlMessage - -#ifndef CONFIRM_COMPONENT_CONTROL_MESSAGE_H -#define CONFIRM_COMPONENT_CONTROL_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_CONTROL_RESPONSE_ENUM -#define JAUS_CONTROL_RESPONSE_ENUM -typedef enum -{ - JAUS_CONTROL_ACCEPTED = 0, - JAUS_CONTROL_NOT_SUPPORTED = 1, - JAUS_CONTROL_NOT_ACCEPTED = 2 -} JausControlResponseEnum; -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausControlResponseEnum responseCode; - -}ConfirmComponentControlMessageStruct; - -typedef ConfirmComponentControlMessageStruct* ConfirmComponentControlMessage; - -JAUS_EXPORT ConfirmComponentControlMessage confirmComponentControlMessageCreate(void); -JAUS_EXPORT void confirmComponentControlMessageDestroy(ConfirmComponentControlMessage); - -JAUS_EXPORT JausBoolean confirmComponentControlMessageFromBuffer(ConfirmComponentControlMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean confirmComponentControlMessageToBuffer(ConfirmComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ConfirmComponentControlMessage confirmComponentControlMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage confirmComponentControlMessageToJausMessage(ConfirmComponentControlMessage message); - -JAUS_EXPORT unsigned int confirmComponentControlMessageSize(ConfirmComponentControlMessage message); - -#endif // CONFIRM_COMPONENT_CONTROL_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/confirmServiceConnectionMessage.h b/lib/openjaus/libjaus/include/message/command/core/confirmServiceConnectionMessage.h deleted file mode 100644 index 452a4f1c57564acd558365881407253f7a984fe4..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/confirmServiceConnectionMessage.h +++ /dev/null @@ -1,113 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: confirmServiceConnectionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ConfirmServiceConnectionMessage - -#ifndef CONFIRM_SERVICE_CONNECTION_MESSAGE_H -#define CONFIRM_SERVICE_CONNECTION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort serviceConnectionCommandCode; - JausByte instanceId; - JausDouble confirmedPeriodicUpdateRateHertz; - enum { JAUS_SC_SUCCESSFUL = 0, - JAUS_SC_NODE_NOT_CAPABLE = 1, - JAUS_SC_COMPONENT_NOT_CAPABLE = 2, - JAUS_SC_INSUFFICIENT_AUTHORITY = 3, - JAUS_SC_CONNECTION_REFUSED = 4, - JAUS_SC_INVALID_PARAMETER = 5, - JAUS_SC_COMMAND_NOT_SUPPORTED = 6} responseCode; - -}ConfirmServiceConnectionMessageStruct; - -typedef ConfirmServiceConnectionMessageStruct* ConfirmServiceConnectionMessage; - -JAUS_EXPORT ConfirmServiceConnectionMessage confirmServiceConnectionMessageCreate(void); -JAUS_EXPORT void confirmServiceConnectionMessageDestroy(ConfirmServiceConnectionMessage); - -JAUS_EXPORT JausBoolean confirmServiceConnectionMessageFromBuffer(ConfirmServiceConnectionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean confirmServiceConnectionMessageToBuffer(ConfirmServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ConfirmServiceConnectionMessage confirmServiceConnectionMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage confirmServiceConnectionMessageToJausMessage(ConfirmServiceConnectionMessage message); - -JAUS_EXPORT unsigned int confirmServiceConnectionMessageSize(ConfirmServiceConnectionMessage message); - -#endif // CONFIRM_SERVICE_CONNECTION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/createServiceConnectionMessage.h b/lib/openjaus/libjaus/include/message/command/core/createServiceConnectionMessage.h deleted file mode 100644 index 1b4cc05d0555d0a7d963aa6c39be33f132fac72c..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/createServiceConnectionMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: createServiceConnectionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a CreateServiceConnectionMessage - -#ifndef CREATE_SERVICE_CONNECTION_MESSAGE_H -#define CREATE_SERVICE_CONNECTION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort serviceConnectionCommandCode; - JausDouble requestedPeriodicUpdateRateHertz; //scaled int Hertz - JausUnsignedInteger presenceVector; - -}CreateServiceConnectionMessageStruct; - -typedef CreateServiceConnectionMessageStruct* CreateServiceConnectionMessage; - -JAUS_EXPORT CreateServiceConnectionMessage createServiceConnectionMessageCreate(void); -JAUS_EXPORT void createServiceConnectionMessageDestroy(CreateServiceConnectionMessage); - -JAUS_EXPORT JausBoolean createServiceConnectionMessageFromBuffer(CreateServiceConnectionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean createServiceConnectionMessageToBuffer(CreateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT CreateServiceConnectionMessage createServiceConnectionMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage createServiceConnectionMessageToJausMessage(CreateServiceConnectionMessage message); - -JAUS_EXPORT unsigned int createServiceConnectionMessageSize(CreateServiceConnectionMessage message); - -#endif // CREATE_SERVICE_CONNECTION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/rejectComponentControlMessage.h b/lib/openjaus/libjaus/include/message/command/core/rejectComponentControlMessage.h deleted file mode 100644 index 0fb7154d851d96c31e445e56513e94d62088dc6e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/rejectComponentControlMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: rejectComponentControlMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a RejectComponentControlMessage - -#ifndef REJECT_COMPONENT_CONTROL_MESSAGE_H -#define REJECT_COMPONENT_CONTROL_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No data associated with message - -}RejectComponentControlMessageStruct; - -typedef RejectComponentControlMessageStruct* RejectComponentControlMessage; - -JAUS_EXPORT RejectComponentControlMessage rejectComponentControlMessageCreate(void); -JAUS_EXPORT void rejectComponentControlMessageDestroy(RejectComponentControlMessage); - -JAUS_EXPORT JausBoolean rejectComponentControlMessageFromBuffer(RejectComponentControlMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean rejectComponentControlMessageToBuffer(RejectComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT RejectComponentControlMessage rejectComponentControlMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage rejectComponentControlMessageToJausMessage(RejectComponentControlMessage message); - -JAUS_EXPORT unsigned int rejectComponentControlMessageSize(RejectComponentControlMessage message); - -#endif // REJECT_COMPONENT_CONTROL_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/releaseComponentControlMessage.h b/lib/openjaus/libjaus/include/message/command/core/releaseComponentControlMessage.h deleted file mode 100644 index 1f4f3863d3a28ff8d79452b970cb28b459684267..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/releaseComponentControlMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: releaseComponentControlMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReleaseComponentControlMessage - -#ifndef RELEASE_COMPONENT_CONTROL_MESSAGE_H -#define RELEASE_COMPONENT_CONTROL_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No Message Fields - -}ReleaseComponentControlMessageStruct; - -typedef ReleaseComponentControlMessageStruct* ReleaseComponentControlMessage; - -JAUS_EXPORT ReleaseComponentControlMessage releaseComponentControlMessageCreate(void); -JAUS_EXPORT void releaseComponentControlMessageDestroy(ReleaseComponentControlMessage); - -JAUS_EXPORT JausBoolean releaseComponentControlMessageFromBuffer(ReleaseComponentControlMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean releaseComponentControlMessageToBuffer(ReleaseComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReleaseComponentControlMessage releaseComponentControlMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage releaseComponentControlMessageToJausMessage(ReleaseComponentControlMessage message); - -JAUS_EXPORT unsigned int releaseComponentControlMessageSize(ReleaseComponentControlMessage message); - -#endif // RELEASE_COMPONENT_CONTROL_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/requestComponentControlMessage.h b/lib/openjaus/libjaus/include/message/command/core/requestComponentControlMessage.h deleted file mode 100644 index 84c5be5940dfa95253604188ce0854d879f4f6ff..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/requestComponentControlMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: requestComponentControlMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a RequestComponentControlMessage - -#ifndef REQUEST_COMPONENT_CONTROL_MESSAGE_H -#define REQUEST_COMPONENT_CONTROL_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte authorityCode; - -}RequestComponentControlMessageStruct; - -typedef RequestComponentControlMessageStruct* RequestComponentControlMessage; - -JAUS_EXPORT RequestComponentControlMessage requestComponentControlMessageCreate(void); -JAUS_EXPORT void requestComponentControlMessageDestroy(RequestComponentControlMessage); - -JAUS_EXPORT JausBoolean requestComponentControlMessageFromBuffer(RequestComponentControlMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean requestComponentControlMessageToBuffer(RequestComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT RequestComponentControlMessage requestComponentControlMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage requestComponentControlMessageToJausMessage(RequestComponentControlMessage message); - -JAUS_EXPORT unsigned int requestComponentControlMessageSize(RequestComponentControlMessage message); - -#endif // REQUEST_COMPONENT_CONTROL_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/resetMessage.h b/lib/openjaus/libjaus/include/message/command/core/resetMessage.h deleted file mode 100644 index 348c0d044aa69c4991d03922de4374927f13f764..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/resetMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: resetMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ResetMessage - -#ifndef RESET_MESSAGE_H -#define RESET_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No Message Fields - -}ResetMessageStruct; - -typedef ResetMessageStruct* ResetMessage; - -JAUS_EXPORT ResetMessage resetMessageCreate(void); -JAUS_EXPORT void resetMessageDestroy(ResetMessage); - -JAUS_EXPORT JausBoolean resetMessageFromBuffer(ResetMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean resetMessageToBuffer(ResetMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ResetMessage resetMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage resetMessageToJausMessage(ResetMessage message); - -JAUS_EXPORT unsigned int resetMessageSize(ResetMessage message); - -#endif // RESET_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/resumeMessage.h b/lib/openjaus/libjaus/include/message/command/core/resumeMessage.h deleted file mode 100644 index 0900895da446a069a7fa1ad893ca17f67f5e0f59..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/resumeMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: resumeMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ResumeMessage - -#ifndef RESUME_MESSAGE_H -#define RESUME_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No Message Fields - -}ResumeMessageStruct; - -typedef ResumeMessageStruct* ResumeMessage; - -JAUS_EXPORT ResumeMessage resumeMessageCreate(void); -JAUS_EXPORT void resumeMessageDestroy(ResumeMessage); - -JAUS_EXPORT JausBoolean resumeMessageFromBuffer(ResumeMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean resumeMessageToBuffer(ResumeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ResumeMessage resumeMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage resumeMessageToJausMessage(ResumeMessage message); - -JAUS_EXPORT unsigned int resumeMessageSize(ResumeMessage message); - -#endif // RESUME_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/setComponentAuthorityMessage.h b/lib/openjaus/libjaus/include/message/command/core/setComponentAuthorityMessage.h deleted file mode 100644 index 8fd990fd92cf805e5a0d95a732aaee18c1eb1659..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/setComponentAuthorityMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setComponentAuthorityMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetComponentAuthorityMessage - -#ifndef SET_COMPONENT_AUTHORITY_MESSAGE_H -#define SET_COMPONENT_AUTHORITY_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte authorityCode; - -}SetComponentAuthorityMessageStruct; - -typedef SetComponentAuthorityMessageStruct* SetComponentAuthorityMessage; - -JAUS_EXPORT SetComponentAuthorityMessage setComponentAuthorityMessageCreate(void); -JAUS_EXPORT void setComponentAuthorityMessageDestroy(SetComponentAuthorityMessage); - -JAUS_EXPORT JausBoolean setComponentAuthorityMessageFromBuffer(SetComponentAuthorityMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setComponentAuthorityMessageToBuffer(SetComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetComponentAuthorityMessage setComponentAuthorityMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setComponentAuthorityMessageToJausMessage(SetComponentAuthorityMessage message); - -JAUS_EXPORT unsigned int setComponentAuthorityMessageSize(SetComponentAuthorityMessage message); - -#endif // SET_COMPONENT_AUTHORITY_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/setEmergencyMessage.h b/lib/openjaus/libjaus/include/message/command/core/setEmergencyMessage.h deleted file mode 100644 index 5acd1b155cd72009bc66346b168723912525419e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/setEmergencyMessage.h +++ /dev/null @@ -1,110 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setEmergencyMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetEmergencyMessage - -#ifndef SET_EMERGENCY_MESSAGE_H -#define SET_EMERGENCY_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_SET_EMERGENCY_BF -#define JAUS_SET_EMERGENCY_BF -#define JAUS_SET_EMERGENCY_BF_TRANSITION_TO_EMERGENCY_BIT 0 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausBoolean transitionToEmergency; - -}SetEmergencyMessageStruct; - -typedef SetEmergencyMessageStruct* SetEmergencyMessage; - -JAUS_EXPORT SetEmergencyMessage setEmergencyMessageCreate(void); -JAUS_EXPORT void setEmergencyMessageDestroy(SetEmergencyMessage); - -JAUS_EXPORT JausBoolean setEmergencyMessageFromBuffer(SetEmergencyMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setEmergencyMessageToBuffer(SetEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetEmergencyMessage setEmergencyMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setEmergencyMessageToJausMessage(SetEmergencyMessage message); - -JAUS_EXPORT unsigned int setEmergencyMessageSize(SetEmergencyMessage message); - -#endif // SET_EMERGENCY_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/setTimeMessage.h b/lib/openjaus/libjaus/include/message/command/core/setTimeMessage.h deleted file mode 100644 index 297f586bc3529622ba9362b97513f74bafe1d711..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/setTimeMessage.h +++ /dev/null @@ -1,111 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setTimeMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetTimeMessage - -#ifndef SET_TIME_MESSAGE_H -#define SET_TIME_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_TIME_PV -#define JAUS_TIME_PV -#define JAUS_TIME_PV_TIME_STAMP_BIT 0 -#define JAUS_TIME_PV_DATE_STAMP_BIT 1 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausTime time; - -}SetTimeMessageStruct; - -typedef SetTimeMessageStruct* SetTimeMessage; - -JAUS_EXPORT SetTimeMessage setTimeMessageCreate(void); -JAUS_EXPORT void setTimeMessageDestroy(SetTimeMessage); - -JAUS_EXPORT JausBoolean setTimeMessageFromBuffer(SetTimeMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setTimeMessageToBuffer(SetTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetTimeMessage setTimeMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setTimeMessageToJausMessage(SetTimeMessage message); - -JAUS_EXPORT unsigned int setTimeMessageSize(SetTimeMessage message); - -#endif // SET_TIME_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/shutdownMessage.h b/lib/openjaus/libjaus/include/message/command/core/shutdownMessage.h deleted file mode 100644 index d6a545c40df484937379b46e508028555474375e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/shutdownMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: shutdownMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ShutdownMessage - -#ifndef SHUTDOWN_MESSAGE_H -#define SHUTDOWN_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No Message Fields - -}ShutdownMessageStruct; - -typedef ShutdownMessageStruct* ShutdownMessage; - -JAUS_EXPORT ShutdownMessage shutdownMessageCreate(void); -JAUS_EXPORT void shutdownMessageDestroy(ShutdownMessage); - -JAUS_EXPORT JausBoolean shutdownMessageFromBuffer(ShutdownMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean shutdownMessageToBuffer(ShutdownMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ShutdownMessage shutdownMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage shutdownMessageToJausMessage(ShutdownMessage message); - -JAUS_EXPORT unsigned int shutdownMessageSize(ShutdownMessage message); - -#endif // SHUTDOWN_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/standbyMessage.h b/lib/openjaus/libjaus/include/message/command/core/standbyMessage.h deleted file mode 100644 index 62bc37e3e61c6013ca399008013b0e32824bcbb2..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/standbyMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: standbyMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a StandbyMessage - -#ifndef STANDBY_MESSAGE_H -#define STANDBY_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - //No data for this message - -}StandbyMessageStruct; - -typedef StandbyMessageStruct* StandbyMessage; - -JAUS_EXPORT StandbyMessage standbyMessageCreate(void); -JAUS_EXPORT void standbyMessageDestroy(StandbyMessage); - -JAUS_EXPORT JausBoolean standbyMessageFromBuffer(StandbyMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean standbyMessageToBuffer(StandbyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT StandbyMessage standbyMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage standbyMessageToJausMessage(StandbyMessage message); - -JAUS_EXPORT unsigned int standbyMessageSize(StandbyMessage message); - -#endif // STANDBY_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/suspendServiceConnectionMessage.h b/lib/openjaus/libjaus/include/message/command/core/suspendServiceConnectionMessage.h deleted file mode 100644 index 4a425a8fd32531981d14ab21df198e83d5e4624d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/suspendServiceConnectionMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: suspendServiceConnectionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SuspendServiceConnectionMessage - -#ifndef SUSPEND_SERVICE_CONNECTION_MESSAGE_H -#define SUSPEND_SERVICE_CONNECTION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort serviceConnectionCommandCode; - JausByte instanceId; - -}SuspendServiceConnectionMessageStruct; - -typedef SuspendServiceConnectionMessageStruct* SuspendServiceConnectionMessage; - -JAUS_EXPORT SuspendServiceConnectionMessage suspendServiceConnectionMessageCreate(void); -JAUS_EXPORT void suspendServiceConnectionMessageDestroy(SuspendServiceConnectionMessage); - -JAUS_EXPORT JausBoolean suspendServiceConnectionMessageFromBuffer(SuspendServiceConnectionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean suspendServiceConnectionMessageToBuffer(SuspendServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SuspendServiceConnectionMessage suspendServiceConnectionMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage suspendServiceConnectionMessageToJausMessage(SuspendServiceConnectionMessage message); - -JAUS_EXPORT unsigned int suspendServiceConnectionMessageSize(SuspendServiceConnectionMessage message); - -#endif // SUSPEND_SERVICE_CONNECTION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/core/terminateServiceConnectionMessage.h b/lib/openjaus/libjaus/include/message/command/core/terminateServiceConnectionMessage.h deleted file mode 100644 index 3963ba34b2d9b3be228bda96c69b711e886c0c2b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/core/terminateServiceConnectionMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: terminateServiceConnectionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a TerminateServiceConnectionMessage - -#ifndef TERMINATE_SERVICE_CONNECTION_MESSAGE_H -#define TERMINATE_SERVICE_CONNECTION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort serviceConnectionCommandCode; - JausByte instanceId; - -}TerminateServiceConnectionMessageStruct; - -typedef TerminateServiceConnectionMessageStruct* TerminateServiceConnectionMessage; - -JAUS_EXPORT TerminateServiceConnectionMessage terminateServiceConnectionMessageCreate(void); -JAUS_EXPORT void terminateServiceConnectionMessageDestroy(TerminateServiceConnectionMessage); - -JAUS_EXPORT JausBoolean terminateServiceConnectionMessageFromBuffer(TerminateServiceConnectionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean terminateServiceConnectionMessageToBuffer(TerminateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT TerminateServiceConnectionMessage terminateServiceConnectionMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage terminateServiceConnectionMessageToJausMessage(TerminateServiceConnectionMessage message); - -JAUS_EXPORT unsigned int terminateServiceConnectionMessageSize(TerminateServiceConnectionMessage message); - -#endif // TERMINATE_SERVICE_CONNECTION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/environment/selectCameraMessage.h b/lib/openjaus/libjaus/include/message/command/environment/selectCameraMessage.h deleted file mode 100644 index 6f3fba086b355b6cef1065e0898c8e497287c0a4..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/environment/selectCameraMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: selectCameraMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SelectCameraMessage - -#ifndef SELECT_CAMERA_MESSAGE_H -#define SELECT_CAMERA_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - - JausByte cameraID; - -}SelectCameraMessageStruct; - -typedef SelectCameraMessageStruct* SelectCameraMessage; - -JAUS_EXPORT SelectCameraMessage selectCameraMessageCreate(void); -JAUS_EXPORT void selectCameraMessageDestroy(SelectCameraMessage); - -JAUS_EXPORT JausBoolean selectCameraMessageFromBuffer(SelectCameraMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean selectCameraMessageToBuffer(SelectCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SelectCameraMessage selectCameraMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage selectCameraMessageToJausMessage(SelectCameraMessage message); - -JAUS_EXPORT unsigned int selectCameraMessageSize(SelectCameraMessage message); - -#endif // SELECT_CAMERA_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/environment/setCameraCapabilitiesMessage.h b/lib/openjaus/libjaus/include/message/command/environment/setCameraCapabilitiesMessage.h deleted file mode 100644 index e7e8ff8beb9361fe64e7fbf067d4afa50478b32f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/environment/setCameraCapabilitiesMessage.h +++ /dev/null @@ -1,176 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setCameraCapabilitiesMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetCameraCapabilitiesMessage - -#ifndef SET_CAMERA_CAPABILITIES_MESSAGE_H -#define SET_CAMERA_CAPABILITIES_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_SET_CAMERA_CAPABILITIES_PV -#define JAUS_SET_CAMERA_CAPABILITIES_PV -#define JAUS_SET_CAMERA_CAPABILITIES_PV_HORIZONTAL_FOV_BIT 0 -#define JAUS_SET_CAMERA_CAPABILITIES_PV_VERTICAL_FOV_BIT 1 -#define JAUS_SET_CAMERA_CAPABILITIES_PV_HORIZONTAL_RESOLUTION_BIT 2 -#define JAUS_SET_CAMERA_CAPABILITIES_PV_VERTICAL_RESOLUTION_BIT 3 -#define JAUS_SET_CAMERA_CAPABILITIES_PV_FOCUS_BIT 4 -#define JAUS_SET_CAMERA_CAPABILITIES_PV_IRIS_BIT 5 -#define JAUS_SET_CAMERA_CAPABILITIES_PV_GAIN_BIT 6 -#define JAUS_SET_CAMERA_CAPABILITIES_PV_FRAME_RATE_BIT 7 -#define JAUS_SET_CAMERA_CAPABILITIES_PV_SHUTTER_SPEED_BIT 8 -#define JAUS_SET_CAMERA_CAPABILITIES_PV_IMAGE_CONTROL_BIT 9 -#define JAUS_SET_CAMERA_CAPABILITIES_PV_AUDIO_CONTROL_BIT 10 -#endif - -#ifndef JAUS_CAMERA_IMAGE_CONTROL_BF -#define JAUS_CAMERA_IMAGE_CONTROL_BF -#define JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_FOCUS_BIT 0 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_IRIS_BIT 1 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_IMAGE_STABILIZATION_BIT 2 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_WHITE_BALANCE_BIT 3 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_SYNC_FLASH_BIT 4 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_RED_EYE_BIT 5 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_SHUTTER_BIT 6 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_GAIN_BIT 7 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_INTERLACED_BIT 8 -#endif - -#ifndef JAUS_CAMERA_AUDIO_CONTROL_BF -#define JAUS_CAMERA_AUDIO_CONTROL_BF -#define JAUS_CAMERA_AUDIO_CONTROL_BF_AUDIO_BIT 0 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_AUTO_GAIN_BIT 1 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_STEREO_BIT 2 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_DIRECTIONAL_BIT 3 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_FRONT_MICROPHONE_BIT 4 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_REAR_MICROPHONE_BIT 5 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_LEFT_MICROPHONE_BIT 6 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_RIGHT_MICROPHONE_BIT 7 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausUnsignedShort presenceVector; - JausByte cameraID; - JausDouble horizontalFovRadians; // Scaled UShort (0, JAUS_PI) - JausDouble verticalFovRadians; // Scaled UShort (0, JAUS_PI) - JausUnsignedShort horizontalResolution; - JausUnsignedShort verticalResolution; - JausDouble focusPercent; // Scaled Byte (0, 100) - JausDouble irisPercent; // Scaled Byte (0, 100) - JausDouble gainPercent; // Scaled Byte (0, 100) - JausUnsignedShort frameRate; - JausUnsignedShort shutterSpeed; - - // Image Control - JausBoolean autoFocus; - JausBoolean autoIris; - JausBoolean imageStabilization; - JausBoolean whiteBalance; - JausBoolean syncFlash; - JausBoolean redEye; - JausBoolean autoShutter; - JausBoolean videoAutoGain; - JausBoolean interlacedVideo; - - // Audio Control - JausBoolean audioEnabled; - JausBoolean audioAutoGain; - JausBoolean stereoAudio; - JausBoolean directionalAudio; - JausBoolean frontMicrophone; - JausBoolean rearMicrophone; - JausBoolean leftMicrophone; - JausBoolean rightMicrophone; - -}SetCameraCapabilitiesMessageStruct; - -typedef SetCameraCapabilitiesMessageStruct* SetCameraCapabilitiesMessage; - -JAUS_EXPORT SetCameraCapabilitiesMessage setCameraCapabilitiesMessageCreate(void); -JAUS_EXPORT void setCameraCapabilitiesMessageDestroy(SetCameraCapabilitiesMessage); - -JAUS_EXPORT JausBoolean setCameraCapabilitiesMessageFromBuffer(SetCameraCapabilitiesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setCameraCapabilitiesMessageToBuffer(SetCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetCameraCapabilitiesMessage setCameraCapabilitiesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setCameraCapabilitiesMessageToJausMessage(SetCameraCapabilitiesMessage message); - -JAUS_EXPORT unsigned int setCameraCapabilitiesMessageSize(SetCameraCapabilitiesMessage message); - -#endif // SET_CAMERA_CAPABILITIES_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/environment/setCameraFormatOptionsMessage.h b/lib/openjaus/libjaus/include/message/command/environment/setCameraFormatOptionsMessage.h deleted file mode 100644 index aaf1847b60d09aa7e89ca478c020d9dd86ccee2a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/environment/setCameraFormatOptionsMessage.h +++ /dev/null @@ -1,156 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setCameraFormatOptionsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 03/20/08 -// -// Description: This file defines the attributes of a SetCameraFormatOptionsMessage - -#ifndef SET_CAMERA_FORMAT_OPTIONS_MESSAGE_H -#define SET_CAMERA_FORMAT_OPTIONS_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_CAMERA_FORMAT_OPTIONS_PV -#define JAUS_CAMERA_FORMAT_OPTIONS_PV -#define JAUS_CAMERA_FORMAT_OPTIONS_PV_AUDIO_FORMAT_BIT 0 -#define JAUS_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_BIT 1 -#define JAUS_CAMERA_FORMAT_OPTIONS_PV_FORMAT_OPTION_BIT 2 -#endif - -#ifndef JAUS_AUDIO_FORMAT_ENUM -#define JAUS_AUDIO_FORMAT_ENUM -typedef enum -{ - UnusedAudioFormat=0, - RAW_AUDIO=1, - PCM=2, - AU=3, - WAV=4, - MID=5, - MP3=6, - MP2=7, - ASF=8 -}JausAudioFormatEnum; -#endif - -#ifndef JAUS_IMAGE_FORMAT_ENUM -#define JAUS_IMAGE_FORMAT_ENUM -typedef enum -{ - UnusedImageFormat=0, - MPEG2=1, - MPEG4=2, - MJPEG=3, - NTSC=4, - PAL=5, - TIFF=6, - JPEG=7, - GIF=8, - H263=9, - H264=10, - PNG=11, - BMP=12, - RAW_IMAGE=13, - PPM=14, - PGM=15, - PNM=16 -} JausImageFormatEnum; -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; - JausByte cameraID; - JausUnsignedInteger formatOption; - JausAudioFormatEnum audioFormat; - JausImageFormatEnum imageFormat; - -}SetCameraFormatOptionsMessageStruct; - -typedef SetCameraFormatOptionsMessageStruct* SetCameraFormatOptionsMessage; - -JAUS_EXPORT SetCameraFormatOptionsMessage setCameraFormatOptionsMessageCreate(void); -JAUS_EXPORT void setCameraFormatOptionsMessageDestroy(SetCameraFormatOptionsMessage); - -JAUS_EXPORT JausBoolean setCameraFormatOptionsMessageFromBuffer(SetCameraFormatOptionsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setCameraFormatOptionsMessageToBuffer(SetCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetCameraFormatOptionsMessage setCameraFormatOptionsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setCameraFormatOptionsMessageToJausMessage(SetCameraFormatOptionsMessage message); - -JAUS_EXPORT unsigned int setCameraFormatOptionsMessageSize(SetCameraFormatOptionsMessage message); - -#endif // SET_CAMERA_FORMAT_OPTIONS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/environment/setCameraPoseMessage.h b/lib/openjaus/libjaus/include/message/command/environment/setCameraPoseMessage.h deleted file mode 100644 index f1bfbd7c6a85d44ca90e0d54513b59419ffab56b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/environment/setCameraPoseMessage.h +++ /dev/null @@ -1,147 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setCameraPoseMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetCameraPoseMessage - -#ifndef SET_CAMERA_POSE_MESSAGE_H -#define SET_CAMERA_POSE_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_CAMERA_POSE_PV -#define JAUS_CAMERA_POSE_PV -#define JAUS_CAMERA_POSE_PV_X_LINEAR_BIT 0 -#define JAUS_CAMERA_POSE_PV_Y_LINEAR_BIT 1 -#define JAUS_CAMERA_POSE_PV_Z_LINEAR_BIT 2 -#define JAUS_CAMERA_POSE_PV_X_ANGULAR_BIT 3 -#define JAUS_CAMERA_POSE_PV_Y_ANGULAR_BIT 4 -#define JAUS_CAMERA_POSE_PV_Z_ANGULAR_BIT 5 -#endif - -#ifndef JAUS_CAMERA_POSE_MODE_BF -#define JAUS_CAMERA_POSE_MODE_BF -#define JAUS_CAMERA_POSE_MODE_BF_X_LINEAR_BIT 0 -#define JAUS_CAMERA_POSE_MODE_BF_Y_LINEAR_BIT 1 -#define JAUS_CAMERA_POSE_MODE_BF_Z_LINEAR_BIT 2 -#define JAUS_CAMERA_POSE_MODE_BF_X_ANGULAR_BIT 3 -#define JAUS_CAMERA_POSE_MODE_BF_Y_ANGULAR_BIT 4 -#define JAUS_CAMERA_POSE_MODE_BF_Z_ANGULAR_BIT 5 -#endif - -#ifndef JAUS_CAMERA_POSE_MODE_ENUM -#define JAUS_CAMERA_POSE_MODE_ENUM -typedef enum -{ - RATE_MODE = 1, - POSITION_MODE = 0 -} JausCameraPoseModeEnum; -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; - JausByte cameraID; - JausCameraPoseModeEnum xLinearMode; - JausCameraPoseModeEnum yLinearMode; - JausCameraPoseModeEnum zLinearMode; - JausCameraPoseModeEnum xAngularMode; - JausCameraPoseModeEnum yAngularMode; - JausCameraPoseModeEnum zAngularMode; - JausDouble xLinearPositionOrRatePercent; // Scaled Short (-100, 100) - JausDouble yLinearPositionOrRatePercent; // Scaled Short (-100, 100) - JausDouble zLinearPositionOrRatePercent; // Scaled Short (-100, 100) - JausDouble xAngularPositionOrRatePercent; // Scaled Short (-100, 100) - JausDouble yAngularPositionOrRatePercent; // Scaled Short (-100, 100) - JausDouble zAngularPositionOrRatePercent; // Scaled Short (-100, 100) - -}SetCameraPoseMessageStruct; - -typedef SetCameraPoseMessageStruct* SetCameraPoseMessage; - -JAUS_EXPORT SetCameraPoseMessage setCameraPoseMessageCreate(void); -JAUS_EXPORT void setCameraPoseMessageDestroy(SetCameraPoseMessage); - -JAUS_EXPORT JausBoolean setCameraPoseMessageFromBuffer(SetCameraPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setCameraPoseMessageToBuffer(SetCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetCameraPoseMessage setCameraPoseMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setCameraPoseMessageToJausMessage(SetCameraPoseMessage message); - -JAUS_EXPORT unsigned int setCameraPoseMessageSize(SetCameraPoseMessage message); - -#endif // SET_CAMERA_POSE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/event/cancelEventMessage.h b/lib/openjaus/libjaus/include/message/command/event/cancelEventMessage.h deleted file mode 100644 index 1442e7bf62967005e98442179261597debf6d49d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/event/cancelEventMessage.h +++ /dev/null @@ -1,115 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: cancelEventMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a CancelEventMessage - -#ifndef CANCEL_EVENT_MESSAGE_H -#define CANCEL_EVENT_MESSAGE_H - -#include "jaus.h" - -#ifndef CANCEL_EVENT_PV -#define CANCEL_EVENT_PV_MESSAGE_CODE_BIT 0 // Field 3 -#define CANCEL_EVENT_PV_EVENT_ID_BIT 1 // Field 4 -#endif - - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; - JausByte requestId; - JausUnsignedShort messageCode; - JausByte eventId; - -}CancelEventMessageStruct; - -typedef CancelEventMessageStruct* CancelEventMessage; - -JAUS_EXPORT CancelEventMessage cancelEventMessageCreate(void); -JAUS_EXPORT void cancelEventMessageDestroy(CancelEventMessage); - -JAUS_EXPORT JausBoolean cancelEventMessageFromBuffer(CancelEventMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean cancelEventMessageToBuffer(CancelEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT CancelEventMessage cancelEventMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage cancelEventMessageToJausMessage(CancelEventMessage message); - -unsigned int cancelEventMessageSize(CancelEventMessage message); - - -#endif // CANCEL_EVENT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/event/confirmEventRequestMessage.h b/lib/openjaus/libjaus/include/message/command/event/confirmEventRequestMessage.h deleted file mode 100644 index f5aa927659e31090da5cdea2b8dd6fdbaa227075..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/event/confirmEventRequestMessage.h +++ /dev/null @@ -1,127 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: confirmEventRequestMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ConfirmEventRequestMessage - -#ifndef CONFIRM_EVENT_REQUEST_MESSAGE_H -#define CONFIRM_EVENT_REQUEST_MESSAGE_H - -#include "jaus.h" - -// PV as defined in Events Document v1.8 -#ifndef CONFIRM_EVENT_REQUEST_PV -#define CONFIRM_EVENT_REQUEST_PV -#define CONFIRM_EVENT_REQUEST_PV_PERIODIC_RATE_BIT 0 -#endif - -// Response Codes as defined in Events Document v1.8 -#ifndef EVENT_REQUEST_RESPONSE_CODES -#define EVENT_REQUEST_RESPONSE_CODES -#define SUCCESSFUL_RESPONSE 0 -#define PERIODIC_UNSUPPORTED_RESPONSE 1 -#define CHANGE_BASED_UNSUPPORTED_RESPONSE 2 -#define CONNECTION_REFUSED_RESPONSE 3 -#define INVALID_EVENT_RESPONSE 4 -#define MESSAGE_UNSUPPORTED_RESPONSE 5 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; // 1: Presence Vector - JausByte requestId; - JausUnsignedShort messageCode; // 2: Command Code of message sent in case of event occurance - JausByte eventId; // 3: Event Id - JausDouble confirmedUpdateRate; // 4: For Periodic Events, Scaled UnsignedShort (0, 1092) - JausByte responseCode; // 5: Enumeration of Response Types (see above) - -}ConfirmEventRequestMessageStruct; - -typedef ConfirmEventRequestMessageStruct* ConfirmEventRequestMessage; - -JAUS_EXPORT ConfirmEventRequestMessage confirmEventRequestMessageCreate(void); -JAUS_EXPORT void confirmEventRequestMessageDestroy(ConfirmEventRequestMessage); - -JAUS_EXPORT JausBoolean confirmEventRequestMessageFromBuffer(ConfirmEventRequestMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean confirmEventRequestMessageToBuffer(ConfirmEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ConfirmEventRequestMessage confirmEventRequestMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage confirmEventRequestMessageToJausMessage(ConfirmEventRequestMessage message); - -JAUS_EXPORT unsigned int confirmEventRequestMessageSize(ConfirmEventRequestMessage message); - -#endif // CONFIRM_EVENT_REQUEST_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/event/createEventMessage.h b/lib/openjaus/libjaus/include/message/command/event/createEventMessage.h deleted file mode 100644 index e6ea9657179c4502d1a8e9c239a510d1da36472e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/event/createEventMessage.h +++ /dev/null @@ -1,153 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: createEventMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 11/2/05 -// -// This file defines the attributes of a CreateEventMessage - -#ifndef CREATE_EVENT_MESSAGE_H -#define CREATE_EVENT_MESSAGE_H - -#include "jaus.h" - -// PV as defined in v3.3 -#ifndef CREATE_EVENT_PV -#define CREATE_EVENT_PV_BOUNDARY_BIT 0 // Field 5 -#define CREATE_EVENT_PV_DATA_FIELD_BIT 1 // Field 6 -#define CREATE_EVENT_PV_LOWER_LIMIT_BIT 2 // Field 7/8 -#define CREATE_EVENT_PV_UPPER_LIMIT_BIT 3 // Field 9/10 -#define CREATE_EVENT_PV_STATE_LIMIT_BIT 4 // Field 11/12 -#define CREATE_EVENT_PV_MINIMUM_RATE_BIT 5 // Field 13 -#define CREATE_EVENT_PV_REQUESTED_RATE_BIT 6 // Field 14 -#define CREATE_EVENT_PV_QUERY_MESSAGE_BIT 7 // Field 15/16 -#endif - -// Event Types -#ifndef EVENT_TYPES -#define EVENT_TYPES -#define EVENT_PERIODIC_TYPE 0 -#define EVENT_EVERY_CHANGE_TYPE 1 -#define EVENT_FIRST_CHANGE_TYPE 2 -#define EVENT_FIRST_CHANGE_IN_AND_OUT_TYPE 3 -#define EVENT_PERIODIC_NO_REPEAT_TYPE 4 -#define EVENT_ONE_TIME_ON_DEMAND_TYPE 5 -#endif - -// Event Boundaries -#ifndef EVENT_BOUNDARIES -#define EVENT_BOUNDARIES -#define EQUAL_BOUNDARY 0 -#define NOT_EQUAL_BOUNDARY 1 -#define INSIDE_INCLUSIVE_BOUNDARY 2 -#define INSIDE_EXCLUSIVE_BOUNDARY 3 -#define OUTSIDE_INCLUSIVE_BOUNDARY 4 -#define OUTSIDE_EXCLUSIVE_BOUNDARY 5 -#define GREATER_THAN_OR_EQUAL_BOUNDARY 6 -#define GREATER_THAN_BOUNDARY 7 -#define LESS_THAN_OR_EQUAL_BOUNDARY 8 -#define LESS_THAN_BOUNDARY 9 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; // Presence Vector - JausByte requestId; // Local request ID for use in confirm event - JausUnsignedShort reportMessageCode; // Command Code of the resulting report message - JausByte eventType; // Enumeration of Event types - JausByte eventBoundary; // Enumeration of Event Boundary Conditions - JausByte limitDataField; // Field from Report for Limit Trigger - JausEventLimit lowerLimit; // Lower Event Limit - JausEventLimit upperLimit; // Upper Event Limit - JausEventLimit stateLimit; // State Event Limit used for Equal Boundary - JausDouble requestedMinimumRate; // For Periodic Events for unchanging value, Scaled UnsignedShort (0, 1092) - JausDouble requestedUpdateRate; // For Periodic Events, Scaled UnsignedShort (0, 1092) - JausMessage queryMessage; // Query Message Body (not including header) to use for response -}CreateEventMessageStruct; - -typedef CreateEventMessageStruct* CreateEventMessage; - -JAUS_EXPORT CreateEventMessage createEventMessageCreate(void); -JAUS_EXPORT void createEventMessageDestroy(CreateEventMessage); - -JAUS_EXPORT JausBoolean createEventMessageFromBuffer(CreateEventMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean createEventMessageToBuffer(CreateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT CreateEventMessage createEventMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage createEventMessageToJausMessage(CreateEventMessage message); - -JAUS_EXPORT unsigned int createEventMessageSize(CreateEventMessage message); - -#endif // CREATE_EVENT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/event/rejectEventRequestMessage.h b/lib/openjaus/libjaus/include/message/command/event/rejectEventRequestMessage.h deleted file mode 100644 index c6a37679e6263af4c623660f4169c5fa8ee46fe6..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/event/rejectEventRequestMessage.h +++ /dev/null @@ -1,126 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: rejectEventRequestMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a RejectEventRequestMessage - -#ifndef REJECT_EVENT_REQUEST_MESSAGE_H -#define REJECT_EVENT_REQUEST_MESSAGE_H - -#include "jaus.h" - -// PV as defined in Events Document v1.8 -#ifndef REJECT_EVENT_REQUEST_PV -#define REJECT_EVENT_REQUEST_PV -#define REJECT_EVENT_REQUEST_PV_ERROR_MESSAGE_BIT 0 -#endif - -// Response Codes as defined in Events Document v1.8 -#ifndef EVENT_REQUEST_RESPONSE_CODES -#define EVENT_REQUEST_RESPONSE_CODES -#define SUCCESSFUL_RESPONSE 0 -#define PERIODIC_UNSUPPORTED_RESPONSE 1 -#define CHANGE_BASED_UNSUPPORTED_RESPONSE 2 -#define CONNECTION_REFUSED_RESPONSE 3 -#define INVALID_EVENT_RESPONSE 4 -#define MESSAGE_UNSUPPORTED_RESPONSE 5 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; // 1: Presence Vector - JausByte requestId; - JausByte responseCode; // 5: Enumeration of Response Types (see above) - - char *errorMessage; - -}RejectEventRequestMessageStruct; - -typedef RejectEventRequestMessageStruct* RejectEventRequestMessage; - -JAUS_EXPORT RejectEventRequestMessage rejectEventRequestMessageCreate(void); -JAUS_EXPORT void rejectEventRequestMessageDestroy(RejectEventRequestMessage); - -JAUS_EXPORT JausBoolean rejectEventRequestMessageFromBuffer(RejectEventRequestMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean rejectEventRequestMessageToBuffer(RejectEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT RejectEventRequestMessage rejectEventRequestMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage rejectEventRequestMessageToJausMessage(RejectEventRequestMessage message); - -JAUS_EXPORT unsigned int rejectEventRequestMessageSize(RejectEventRequestMessage message); - -#endif // REJECT_EVENT_REQUEST_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/event/updateEventMessage.h b/lib/openjaus/libjaus/include/message/command/event/updateEventMessage.h deleted file mode 100644 index a32f730776d69a0b5e186462febd47097dc7791c..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/event/updateEventMessage.h +++ /dev/null @@ -1,155 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: updateEventMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 11/2/05 -// -// This file defines the attributes of a UpdateEventMessage - -#ifndef UPDATE_EVENT_MESSAGE_H -#define UPDATE_EVENT_MESSAGE_H - -#include "jaus.h" - -// PV as defined in v3.3 -#ifndef UPDATE_EVENT_PV -#define UPDATE_EVENT_PV_BOUNDARY_BIT 0 // Field 5 -#define UPDATE_EVENT_PV_DATA_FIELD_BIT 1 // Field 6 -#define UPDATE_EVENT_PV_LOWER_LIMIT_BIT 2 // Field 7/8 -#define UPDATE_EVENT_PV_UPPER_LIMIT_BIT 3 // Field 9/10 -#define UPDATE_EVENT_PV_STATE_LIMIT_BIT 4 // Field 11/12 -#define UPDATE_EVENT_PV_MINIMUM_RATE_BIT 5 // Field 13 -#define UPDATE_EVENT_PV_REQUESTED_RATE_BIT 6 // Field 14 -#define UPDATE_EVENT_PV_QUERY_MESSAGE_BIT 7 // Field 15/16 - -#endif - -// Event Types -#ifndef EVENT_TYPES -#define EVENT_TYPES -#define EVENT_PERIODIC_TYPE 0 -#define EVENT_EVERY_CHANGE_TYPE 1 -#define EVENT_FIRST_CHANGE_TYPE 2 -#define EVENT_FIRST_CHANGE_IN_AND_OUT_TYPE 3 -#define EVENT_PERIODIC_NO_REPEAT_TYPE 4 -#define EVENT_ONE_TIME_ON_DEMAND_TYPE 5 -#endif - -// Event Boundaries -#ifndef EVENT_BOUNDARIES -#define EVENT_BOUNDARIES -#define EQUAL_BOUNDARY 0 -#define NOT_EQUAL_BOUNDARY 1 -#define INSIDE_INCLUSIVE_BOUNDARY 2 -#define INSIDE_EXCLUSIVE_BOUNDARY 3 -#define OUTSIDE_INCLUSIVE_BOUNDARY 4 -#define OUTSIDE_EXCLUSIVE_BOUNDARY 5 -#define GREATER_THAN_OR_EQUAL_BOUNDARY 6 -#define GREATER_THAN_BOUNDARY 7 -#define LESS_THAN_OR_EQUAL_BOUNDARY 8 -#define LESS_THAN_BOUNDARY 9 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; // Presence Vector - JausByte requestId; // Local request ID for use in confirm event - JausUnsignedShort reportMessageCode; // Command Code of the resulting report - JausByte eventType; // Enumeration of Event types - JausByte eventBoundary; // Enumeration of Event Boundary Conditions - JausByte limitDataField; // Field from Report for Limit Trigger - JausEventLimit lowerLimit; // Lower Event Limit - JausEventLimit upperLimit; // Upper Event Limit - JausEventLimit stateLimit; // State Event Limit used for Equal Boundary - JausDouble requestedMinimumRate; // For Periodic Events for unchanging value, Scaled UnsignedShort (0, 1092) - JausDouble requestedUpdateRate; // For Periodic Events, Scaled UnsignedShort (0, 1092) - JausByte eventId; // ID of event to be updated - JausMessage queryMessage; // Query Message (including header) to use for response -}UpdateEventMessageStruct; - -typedef UpdateEventMessageStruct* UpdateEventMessage; - -JAUS_EXPORT UpdateEventMessage updateEventMessageCreate(void); -JAUS_EXPORT void updateEventMessageDestroy(UpdateEventMessage); - -JAUS_EXPORT JausBoolean updateEventMessageFromBuffer(UpdateEventMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean updateEventMessageToBuffer(UpdateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT UpdateEventMessage updateEventMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage updateEventMessageToJausMessage(UpdateEventMessage message); - -JAUS_EXPORT unsigned int updateEventMessageSize(UpdateEventMessage message); - -#endif // UPDATE_EVENT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/manipulator/setEndEffectorPathMotionMessage.h b/lib/openjaus/libjaus/include/message/command/manipulator/setEndEffectorPathMotionMessage.h deleted file mode 100644 index d8ae1b89bffaf265694e522bbadc0bd7fd176be5..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/manipulator/setEndEffectorPathMotionMessage.h +++ /dev/null @@ -1,112 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setEndEffectorPathMotionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetEndEffectorPathMotionMessage - -#ifndef SET_END_EFFECTOR_PATH_MOTION_MESSAGE_H -#define SET_END_EFFECTOR_PATH_MOTION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte numPoses; - JausDouble *poseTime; - JausDouble *x; - JausDouble *y; - JausDouble *z; - JausDouble *a; - JausDouble *b; - JausDouble *c; - JausDouble *d; - -}SetEndEffectorPathMotionMessageStruct; - -typedef SetEndEffectorPathMotionMessageStruct* SetEndEffectorPathMotionMessage; - -JAUS_EXPORT SetEndEffectorPathMotionMessage setEndEffectorPathMotionMessageCreate(void); -JAUS_EXPORT void setEndEffectorPathMotionMessageDestroy(SetEndEffectorPathMotionMessage); - -JAUS_EXPORT JausBoolean setEndEffectorPathMotionMessageFromBuffer(SetEndEffectorPathMotionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setEndEffectorPathMotionMessageToBuffer(SetEndEffectorPathMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetEndEffectorPathMotionMessage setEndEffectorPathMotionMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setEndEffectorPathMotionMessageToJausMessage(SetEndEffectorPathMotionMessage message); - -JAUS_EXPORT unsigned int setEndEffectorPathMotionMessageSize(SetEndEffectorPathMotionMessage message); - -#endif // SET_END_EFFECTOR_PATH_MOTION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/manipulator/setEndEffectorPoseMessage.h b/lib/openjaus/libjaus/include/message/command/manipulator/setEndEffectorPoseMessage.h deleted file mode 100644 index a04849dfe82e201f1c1362f6f18073bd1a4d8a18..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/manipulator/setEndEffectorPoseMessage.h +++ /dev/null @@ -1,111 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setEndEffectorPoseMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetEndEffectorPoseMessage - -#ifndef SET_END_EFFECTOR_POSE_MESSAGE_H -#define SET_END_EFFECTOR_POSE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausDouble x; - JausDouble y; - JausDouble z; - - JausDouble a; - JausDouble b; - JausDouble c; - JausDouble d; - -}SetEndEffectorPoseMessageStruct; - -typedef SetEndEffectorPoseMessageStruct* SetEndEffectorPoseMessage; - -JAUS_EXPORT SetEndEffectorPoseMessage setEndEffectorPoseMessageCreate(void); -JAUS_EXPORT void setEndEffectorPoseMessageDestroy(SetEndEffectorPoseMessage); - -JAUS_EXPORT JausBoolean setEndEffectorPoseMessageFromBuffer(SetEndEffectorPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setEndEffectorPoseMessageToBuffer(SetEndEffectorPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetEndEffectorPoseMessage setEndEffectorPoseMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setEndEffectorPoseMessageToJausMessage(SetEndEffectorPoseMessage message); - -JAUS_EXPORT unsigned int setEndEffectorPoseMessageSize(SetEndEffectorPoseMessage message); - -#endif // SET_END_EFFECTOR_POSE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/manipulator/setEndEffectorVelocityStateMessage.h b/lib/openjaus/libjaus/include/message/command/manipulator/setEndEffectorVelocityStateMessage.h deleted file mode 100644 index 116abe4e42e22040b8763542f6bd8624606461ec..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/manipulator/setEndEffectorVelocityStateMessage.h +++ /dev/null @@ -1,112 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURVELOCITY_STATE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setEndEffectorVelocityStateMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetEndEffectorVelocityStateMessage - -#ifndef SET_END_EFFECTOR_VELOCITY_STATE_MESSAGE_H -#define SET_END_EFFECTOR_VELOCITY_STATE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte coordinateSystem; - - JausDouble xAngular; - JausDouble yAngular; - JausDouble zAngular; - - JausDouble xLinear; - JausDouble yLinear; - JausDouble zLinear; - -}SetEndEffectorVelocityStateMessageStruct; - -typedef SetEndEffectorVelocityStateMessageStruct* SetEndEffectorVelocityStateMessage; - -JAUS_EXPORT SetEndEffectorVelocityStateMessage setEndEffectorVelocityStateMessageCreate(void); -JAUS_EXPORT void setEndEffectorVelocityStateMessageDestroy(SetEndEffectorVelocityStateMessage); - -JAUS_EXPORT JausBoolean setEndEffectorVelocityStateMessageFromBuffer(SetEndEffectorVelocityStateMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setEndEffectorVelocityStateMessageToBuffer(SetEndEffectorVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetEndEffectorVelocityStateMessage setEndEffectorVelocityStateMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setEndEffectorVelocityStateMessageToJausMessage(SetEndEffectorVelocityStateMessage message); - -JAUS_EXPORT unsigned int setEndEffectorVelocityStateMessageSize(SetEndEffectorVelocityStateMessage message); - -#endif // SET_END_EFFECTOR_VELOCITY_STATE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/manipulator/setJointEffortsMessage.h b/lib/openjaus/libjaus/include/message/command/manipulator/setJointEffortsMessage.h deleted file mode 100644 index 7cae7de56cd0c3b17574119e7556a74117b5810a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/manipulator/setJointEffortsMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setJointEffortsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetJointEffortsMessage - -#ifndef SET_JOINT_EFFORTS_MESSAGE_H -#define SET_JOINT_EFFORTS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte numJoints; - - JausDouble *jointEffort; - -}SetJointEffortsMessageStruct; - -typedef SetJointEffortsMessageStruct* SetJointEffortsMessage; - -JAUS_EXPORT SetJointEffortsMessage setJointEffortsMessageCreate(void); -JAUS_EXPORT void setJointEffortsMessageDestroy(SetJointEffortsMessage); - -JAUS_EXPORT JausBoolean setJointEffortsMessageFromBuffer(SetJointEffortsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setJointEffortsMessageToBuffer(SetJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetJointEffortsMessage setJointEffortsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setJointEffortsMessageToJausMessage(SetJointEffortsMessage message); - -JAUS_EXPORT unsigned int setJointEffortsMessageSize(SetJointEffortsMessage message); - -#endif // SET_JOINT_EFFORTS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/manipulator/setJointMotionMessage.h b/lib/openjaus/libjaus/include/message/command/manipulator/setJointMotionMessage.h deleted file mode 100644 index 158d1f5b0019cc007bfb5a4023f443dedf7e0284..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/manipulator/setJointMotionMessage.h +++ /dev/null @@ -1,112 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setJointMotionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetJointMotionMessage - -#ifndef SET_JOINT_MOTION_MESSAGE_H -#define SET_JOINT_MOTION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte numJoints; - JausByte numPoses; - - JausDouble *poseTime; - - JausDouble **position; - JausDouble **maxVelocity; - JausDouble **maxAcceleration; - JausDouble **maxDeceleration; - -}SetJointMotionMessageStruct; - -typedef SetJointMotionMessageStruct* SetJointMotionMessage; - -JAUS_EXPORT SetJointMotionMessage setJointMotionMessageCreate(void); -JAUS_EXPORT void setJointMotionMessageDestroy(SetJointMotionMessage); - -JAUS_EXPORT JausBoolean setJointMotionMessageFromBuffer(SetJointMotionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setJointMotionMessageToBuffer(SetJointMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetJointMotionMessage setJointMotionMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setJointMotionMessageToJausMessage(SetJointMotionMessage message); - -JAUS_EXPORT unsigned int setJointMotionMessageSize(SetJointMotionMessage message); - -#endif // SET_JOINT_MOTION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/manipulator/setJointPositionsMessage.h b/lib/openjaus/libjaus/include/message/command/manipulator/setJointPositionsMessage.h deleted file mode 100644 index 488415ca1b9665142c65d6f3298b55db5cd74dac..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/manipulator/setJointPositionsMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setJointPositionsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetJointPositionsMessage - -#ifndef SET_JOINT_POSITIONS_MESSAGE_H -#define SET_JOINT_POSITIONS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte numJoints; - - JausDouble *jointPosition; - -}SetJointPositionsMessageStruct; - -typedef SetJointPositionsMessageStruct* SetJointPositionsMessage; - -JAUS_EXPORT SetJointPositionsMessage setJointPositionsMessageCreate(void); -JAUS_EXPORT void setJointPositionsMessageDestroy(SetJointPositionsMessage); - -JAUS_EXPORT JausBoolean setJointPositionsMessageFromBuffer(SetJointPositionsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setJointPositionsMessageToBuffer(SetJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetJointPositionsMessage setJointPositionsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setJointPositionsMessageToJausMessage(SetJointPositionsMessage message); - -JAUS_EXPORT unsigned int setJointPositionsMessageSize(SetJointPositionsMessage message); - -#endif // SET_JOINT_POSITIONS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/manipulator/setJointVelocitiesMessage.h b/lib/openjaus/libjaus/include/message/command/manipulator/setJointVelocitiesMessage.h deleted file mode 100644 index e0fbca988eac9c76f06b9128ca0d7cb8513b487a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/manipulator/setJointVelocitiesMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setJointVelocitiesMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetJointVelocitiesMessage - -#ifndef SET_JOINT_VELOCITIES_MESSAGE_H -#define SET_JOINT_VELOCITIES_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte numJoints; - - JausDouble *jointVelocity; - -}SetJointVelocitiesMessageStruct; - -typedef SetJointVelocitiesMessageStruct* SetJointVelocitiesMessage; - -JAUS_EXPORT SetJointVelocitiesMessage setJointVelocitiesMessageCreate(void); -JAUS_EXPORT void setJointVelocitiesMessageDestroy(SetJointVelocitiesMessage); - -JAUS_EXPORT JausBoolean setJointVelocitiesMessageFromBuffer(SetJointVelocitiesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setJointVelocitiesMessageToBuffer(SetJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetJointVelocitiesMessage setJointVelocitiesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setJointVelocitiesMessageToJausMessage(SetJointVelocitiesMessage message); - -JAUS_EXPORT unsigned int setJointVelocitiesMessageSize(SetJointVelocitiesMessage message); - -#endif // SET_JOINT_VELOCITIES_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/manipulator/setToolPointMessage.h b/lib/openjaus/libjaus/include/message/command/manipulator/setToolPointMessage.h deleted file mode 100644 index 04cac5d4d037e44371a2578eb42991b35bf1e6e1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/manipulator/setToolPointMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setToolPointMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetToolPointMessage - -#ifndef SET_TOOL_POINT_MESSAGE_H -#define SET_TOOL_POINT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausDouble x; - JausDouble y; - JausDouble z; - -}SetToolPointMessageStruct; - -typedef SetToolPointMessageStruct* SetToolPointMessage; - -JAUS_EXPORT SetToolPointMessage setToolPointMessageCreate(void); -JAUS_EXPORT void setToolPointMessageDestroy(SetToolPointMessage); - -JAUS_EXPORT JausBoolean setToolPointMessageFromBuffer(SetToolPointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setToolPointMessageToBuffer(SetToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetToolPointMessage setToolPointMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setToolPointMessageToJausMessage(SetToolPointMessage message); - -JAUS_EXPORT unsigned int setToolPointMessageSize(SetToolPointMessage message); - -#endif // SET_TOOL_POINT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/payload/setPayloadDataElementMessage.h b/lib/openjaus/libjaus/include/message/command/payload/setPayloadDataElementMessage.h deleted file mode 100644 index 24d99426c1d49c9e59274a483b87a54490291f50..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/payload/setPayloadDataElementMessage.h +++ /dev/null @@ -1,111 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setPayloadDataElementMessage.h -// -// Written By: Bob Touchton -// -// Version: 3.3.0a -// -// Date: 3/27/06 -// -// This file defines the attributes of a setPayloadDataElementMessage -// NOTE WELL: this message will also be used for general purpose information exchange - -#ifndef SET_PAYLOAD_DATA_ELEMENT_MESSAGE_H -#define SET_PAYLOAD_DATA_ELEMENT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - //message-specific fields - JausPayloadInterface jausPayloadInterface; - int numberInterfaces; - int* indexes; - -}SetPayloadDataElementMessageStruct; - -typedef SetPayloadDataElementMessageStruct* SetPayloadDataElementMessage; - -JAUS_EXPORT SetPayloadDataElementMessage setPayloadDataElementMessageCreate(void); -JAUS_EXPORT void setPayloadDataElementMessageDestroy(SetPayloadDataElementMessage); - -JAUS_EXPORT JausBoolean setPayloadDataElementMessageFromBuffer(SetPayloadDataElementMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setPayloadDataElementMessageToBuffer(SetPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetPayloadDataElementMessage setPayloadDataElementMessageFromJausMessage(JausMessage jausMessage, JausPayloadInterface pI); -JAUS_EXPORT JausMessage setPayloadDataElementMessageToJausMessage(SetPayloadDataElementMessage message); - -JAUS_EXPORT unsigned int setPayloadDataElementMessageSize(SetPayloadDataElementMessage message); - -#endif - - - - diff --git a/lib/openjaus/libjaus/include/message/command/planning/abortMissionMessage.h b/lib/openjaus/libjaus/include/message/command/planning/abortMissionMessage.h deleted file mode 100644 index 8a7b3fcfae8c71c08611de4d48641affacad85cc..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/planning/abortMissionMessage.h +++ /dev/null @@ -1,118 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: abortMissionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a AbortMissionMessage -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS. - - -#ifndef ABORT_MISSION_MESSAGE_H -#define ABORT_MISSION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - //MESSAGE DATA MEMBERS - JausUnsignedShort missionId; //unique Mission ID to be aborted - JausUnsignedShort taskId; //unique Task ID to be aborted. If = 0 then - //abort entire Mission. - -}AbortMissionMessageStruct; - -typedef AbortMissionMessageStruct* AbortMissionMessage; - -JAUS_EXPORT AbortMissionMessage abortMissionMessageCreate(void); -JAUS_EXPORT void abortMissionMessageDestroy(AbortMissionMessage); - -JAUS_EXPORT JausBoolean abortMissionMessageFromBuffer - (AbortMissionMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean abortMissionMessageToBuffer - (AbortMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); - -JAUS_EXPORT AbortMissionMessage abortMissionMessageFromJausMessage - (JausMessage jausMessage); -JAUS_EXPORT JausMessage abortMissionMessageToJausMessage - (AbortMissionMessage message); - -JAUS_EXPORT unsigned int abortMissionMessageSize(AbortMissionMessage message); - -#endif // ABORT_MISSION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/planning/pauseMissionMessage.h b/lib/openjaus/libjaus/include/message/command/planning/pauseMissionMessage.h deleted file mode 100644 index f13f80e838901194bbf0129be8d5e4b369b62cc6..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/planning/pauseMissionMessage.h +++ /dev/null @@ -1,120 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: pauseMissionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a PauseMissionMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/09/08 - -#ifndef PAUSE_MISSION_MESSAGE_H -#define PAUSE_MISSION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - - //MESSAGE DATA MEMBERS - JausUnsignedShort missionId; //unique Mission ID to be aborted - JausUnsignedShort taskId; //unique Task ID to be aborted. If = 0 then - //abort entire Mission. - - -}PauseMissionMessageStruct; - -typedef PauseMissionMessageStruct* PauseMissionMessage; - -JAUS_EXPORT PauseMissionMessage pauseMissionMessageCreate(void); -JAUS_EXPORT void pauseMissionMessageDestroy(PauseMissionMessage); - -JAUS_EXPORT JausBoolean pauseMissionMessageFromBuffer - (PauseMissionMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean pauseMissionMessageToBuffer - (PauseMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); - -JAUS_EXPORT PauseMissionMessage pauseMissionMessageFromJausMessage - (JausMessage jausMessage); -JAUS_EXPORT JausMessage pauseMissionMessageToJausMessage - (PauseMissionMessage message); - -JAUS_EXPORT unsigned int pauseMissionMessageSize(PauseMissionMessage message); - -#endif // PAUSE_MISSION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/planning/removeMessagesMessage.h b/lib/openjaus/libjaus/include/message/command/planning/removeMessagesMessage.h deleted file mode 100644 index 6bc146ad9e20eb71713a0f26064010902d410b1d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/planning/removeMessagesMessage.h +++ /dev/null @@ -1,122 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: removeMessagesMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a RemoveMessagesMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/09/08 - -#ifndef REMOVE_MESSAGE_H -#define REMOVE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - - //MESSAGE DATA MEMBERS - JausUnsignedShort missionId; //unique Mission ID that includes the - //message(s) to be removed. - JausUnsignedShort taskId; //unique Task ID that includes the messages(s) - //to be removed. - JausUnsignedShort numMsgs; //number of message(s) to remove - JausUnsignedShort * uid; //Dynamic array of unique message IDs - //specific to a Mission to be removed - -}RemoveMessagesMessageStruct; - -typedef RemoveMessagesMessageStruct* RemoveMessagesMessage; - -JAUS_EXPORT RemoveMessagesMessage removeMessagesMessageCreate(void); -JAUS_EXPORT void removeMessagesMessageDestroy(RemoveMessagesMessage); - -JAUS_EXPORT JausBoolean removeMessagesMessageFromBuffer - (RemoveMessagesMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean removeMessagesMessageToBuffer - (RemoveMessagesMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); - -JAUS_EXPORT RemoveMessagesMessage removeMessagesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage removeMessagesMessageToJausMessage - (RemoveMessagesMessage message); - -JAUS_EXPORT unsigned int removeMessagesMessageSize(RemoveMessagesMessage message); - -#endif // REMOVE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/planning/replaceMessagesMessage.h b/lib/openjaus/libjaus/include/message/command/planning/replaceMessagesMessage.h deleted file mode 100644 index 85249b559368b299a71739d85f3001a333703129..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/planning/replaceMessagesMessage.h +++ /dev/null @@ -1,118 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: replaceMessagesMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReplaceMessagesMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/13/08 - -#ifndef REPLACE_MESSAGE_H -#define REPLACE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - //MESSAGE DATA MEMBERS - JausUnsignedShort missionId; //unique Mission ID that includes the - //message(s) to be replaced. - JausUnsignedShort taskId; //unique Task ID that that includes the - //message(s) to be replaced. - JausUnsignedShort numMsgsToRemove; //number of message(s) to remove - JausUnsignedShort * uid; //Dynamic array of unique message IDs - //specific to a Mission to be replaced. - JausArray command; //Dynamc array of JausMissionCommand - //structures. Each task ends up having - //1 to N messages each with a uid and - //blocking flag. - -}ReplaceMessageStruct; - -typedef ReplaceMessageStruct* ReplaceMessagesMessage; - -JAUS_EXPORT ReplaceMessagesMessage replaceMessagesMessageCreate(void); -JAUS_EXPORT void replaceMessagesMessageDestroy(ReplaceMessagesMessage); - -JAUS_EXPORT JausBoolean replaceMessagesMessageFromBuffer(ReplaceMessagesMessage message,unsigned char* buffer,unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean replaceMessagesMessageToBuffer(ReplaceMessagesMessage message, unsigned char *buffer,unsigned int bufferSizeBytes); - -JAUS_EXPORT ReplaceMessagesMessage replaceMessagesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage replaceMessagesMessageToJausMessage(ReplaceMessagesMessage message); - -JAUS_EXPORT unsigned int replaceMessagesMessageSize(ReplaceMessagesMessage message); - -#endif // REPLACE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/planning/resumeMissionMessage.h b/lib/openjaus/libjaus/include/message/command/planning/resumeMissionMessage.h deleted file mode 100644 index 110608cef35f8b78d3646d8c4f5cba76b56e72be..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/planning/resumeMissionMessage.h +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: resumeMissionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ResumeMissionMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/09/08 - -#ifndef RESUME_MISSION_MESSAGE_H -#define RESUME_MISSION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - //MESSAGE DATA MEMBERS - JausUnsignedShort missionId; //unique Mission ID to be aborted - JausUnsignedShort taskId; //unique Task ID to be resumed. If = 0 then - //resume entire Mission. - - -}ResumeMissionMessageStruct; - -typedef ResumeMissionMessageStruct* ResumeMissionMessage; - -JAUS_EXPORT ResumeMissionMessage resumeMissionMessageCreate(void); -JAUS_EXPORT void resumeMissionMessageDestroy(ResumeMissionMessage); - -JAUS_EXPORT JausBoolean resumeMissionMessageFromBuffer - (ResumeMissionMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean resumeMissionMessageToBuffer - (ResumeMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); - -JAUS_EXPORT ResumeMissionMessage resumeMissionMessageFromJausMessage - (JausMessage jausMessage); -JAUS_EXPORT JausMessage resumeMissionMessageToJausMessage - (ResumeMissionMessage message); - -JAUS_EXPORT unsigned int resumeMissionMessageSize(ResumeMissionMessage message); - -#endif // RESUME_MISSION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/planning/runMissionMessage.h b/lib/openjaus/libjaus/include/message/command/planning/runMissionMessage.h deleted file mode 100644 index be018c6915e0f9e25ba80cde7f3601f9dfe5d34a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/planning/runMissionMessage.h +++ /dev/null @@ -1,117 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: runMissionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a RunMissionMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/08/08 - - -#ifndef RUN_MISSION_MESSAGE_H -#define RUN_MISSION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - //MESSAGE DATA MEMBERS - JausUnsignedShort missionId; //unique Mission ID to be run - -}RunMissionMessageStruct; - -typedef RunMissionMessageStruct* RunMissionMessage; - -JAUS_EXPORT RunMissionMessage runMissionMessageCreate(void); -JAUS_EXPORT void runMissionMessageDestroy(RunMissionMessage); - -JAUS_EXPORT JausBoolean runMissionMessageFromBuffer - (RunMissionMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean runMissionMessageToBuffer - (RunMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); - -JAUS_EXPORT RunMissionMessage runMissionMessageFromJausMessage - (JausMessage jausMessage); -JAUS_EXPORT JausMessage runMissionMessageToJausMessage - (RunMissionMessage message); - -JAUS_EXPORT unsigned int runMissionMessageSize(RunMissionMessage message); - -#endif // RUN_MISSION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/planning/spoolMissionMessage.h b/lib/openjaus/libjaus/include/message/command/planning/spoolMissionMessage.h deleted file mode 100644 index 420a4dc75920b1fc0990181020b0500d5b7eb05a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/planning/spoolMissionMessage.h +++ /dev/null @@ -1,146 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: spoolMissionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SpoolMissionMessage - -#ifndef SPOOL_MISSION_MESSAGE_H -#define SPOOL_MISSION_MESSAGE_H - -#include "jaus.h" -#include "type/jausMissionTask.h" - - -// Mission Proc Types: non-redundant declaration -#ifndef JAUS_MISSION_BLOCKING_TYPES -#define JAUS_MISSION_BLOCKING_TYPES -#define JAUS_NON_BLOCKING 0 -#define JAUS_BLOCKING 1 -#endif -// Mission Proc Types: non-redundant declaration -#ifndef JAUS_MISSION_SPOOLING_AND_MANIP_TYPES -#define JAUS_MISSION_SPOOLING_AND_MANIP_TYPES -#define JAUS_REPLACE_CURRENT_MISSION_WITH_NEW_MISSION 0 -#define JAUS_APPEND_NEW_MISSION_TO_CURRENT_MISSION 1 -#endif - - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - - //MESSAGE DATA MEMBERS - JausUnsignedShort missionId; //Field 1: identifies the unique - //Mission to be spooled or manipulated. - JausByte appendFlag; //Field 2: 0 = replace current mission with - //new mission. 1= Append new mission to - //current mission. - JausMissionTask naryTree; //Fields [3 to 8+n+3n] are dynamcially allocated - //as required to form the tree levels where level - //zero consists of only one task. Tree levels - //grow down from a task as children. - //Each task ends up having a unique taskId and: - // * 1 to N messages each with a uid and - // blocking flag. - // * 1 to M Children (tasks) each with unique - // taskId and messages of their own. - //NOTE: Field 4 (number of Children) is stored - //in the JausArray for JausMissionTaskStruct - //element children. - //NOTE: Field 4+n (child indexs) are not stored - //in a structure. For offsets to task - //children data in the spool mission message - //see the jausMissionTask.cpp functions. - //NOTE: Field 5+n (number of messages in task) - //is stored in the JausArray for - //JausMissionTaskStruct element commands. Also - //see JausMissionCommand. - -}SpoolMissionMessageStruct; - -typedef SpoolMissionMessageStruct* SpoolMissionMessage; - -JAUS_EXPORT SpoolMissionMessage spoolMissionMessageCreate(void); -JAUS_EXPORT void spoolMissionMessageDestroy(SpoolMissionMessage); - -JAUS_EXPORT JausBoolean spoolMissionMessageFromBuffer(SpoolMissionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean spoolMissionMessageToBuffer(SpoolMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SpoolMissionMessage spoolMissionMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage spoolMissionMessageToJausMessage(SpoolMissionMessage message); - -JAUS_EXPORT unsigned int spoolMissionMessageSize(SpoolMissionMessage message); - -#endif // SPOOL_MISSION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/platform/setDiscreteDevicesMessage.h b/lib/openjaus/libjaus/include/message/command/platform/setDiscreteDevicesMessage.h deleted file mode 100644 index 54ed022255235d7b0349d4e5c9b0575e43a33613..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/platform/setDiscreteDevicesMessage.h +++ /dev/null @@ -1,146 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setDiscreteDevicesMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetDiscreteDevicesMessage - -#ifndef SET_DISCRETE_DEVICES_MESSAGE_H -#define SET_DISCRETE_DEVICES_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_DEVICES_PV -#define JAUS_DEVICES_PV -#define JAUS_DEVICES_PV_PROPULSION_BIT 0 -#define JAUS_DEVICES_PV_PARKING_BIT 1 -#define JAUS_DEVICES_PV_GEAR_BIT 2 -#define JAUS_DEVICES_PV_TRANSFER_BIT 3 -#endif - -#ifndef JAUS_DEVICES_PROPULSION_BF -#define JAUS_DEVICES_PROPULSION_BF -#define JAUS_DEVICES_PROPULSION_BF_MAIN_POWER_BIT 0 -#define JAUS_DEVICES_PROPULSION_BF_MAIN_FUEL_BIT 1 -#define JAUS_DEVICES_PROPULSION_BF_AUXILARY_FUEL_BIT 2 -#define JAUS_DEVICES_PROPULSION_BF_AUXILARY_POWER_BIT 3 -#define JAUS_DEVICES_PROPULSION_BF_STARTING_DEVICE_BIT 4 -#define JAUS_DEVICES_PROPULSION_BF_COLD_START_BIT 5 -#define JAUS_DEVICES_PROPULSION_BF_AUTO_START_BIT 6 -#define JAUS_DEVICES_PROPULSION_BF_AUTO_SHUTDOWN_BIT 7 -#endif - -#ifndef JAUS_DEVICES_OTHER_BF -#define JAUS_DEVICES_OTHER_BF -#define JAUS_DEVICES_OTHER_BF_PARKING_BRAKE_BIT 0 -#define JAUS_DEVICES_OTHER_BF_HORN_BIT 1 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausByte gear; - JausByte transferCase; - - // Main Propulsion - JausBoolean mainPropulsion; - JausBoolean mainFuelSupply; - JausBoolean auxFuelSupply; - JausBoolean powerAuxDevices; - JausBoolean startingDevice; - JausBoolean coldStart; - JausBoolean automaticStart; - JausBoolean automaticStop; - - // Parking, Brake and Horn - JausBoolean parkingBrake; - JausBoolean horn; - -}SetDiscreteDevicesMessageStruct; - -typedef SetDiscreteDevicesMessageStruct* SetDiscreteDevicesMessage; - -JAUS_EXPORT SetDiscreteDevicesMessage setDiscreteDevicesMessageCreate(void); -JAUS_EXPORT void setDiscreteDevicesMessageDestroy(SetDiscreteDevicesMessage); - -JAUS_EXPORT JausBoolean setDiscreteDevicesMessageFromBuffer(SetDiscreteDevicesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setDiscreteDevicesMessageToBuffer(SetDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetDiscreteDevicesMessage setDiscreteDevicesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setDiscreteDevicesMessageToJausMessage(SetDiscreteDevicesMessage message); - -JAUS_EXPORT unsigned int setDiscreteDevicesMessageSize(SetDiscreteDevicesMessage message); - -#endif // SET_DISCRETE_DEVICES_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/platform/setGlobalPathSegmentMessage.h b/lib/openjaus/libjaus/include/message/command/platform/setGlobalPathSegmentMessage.h deleted file mode 100644 index 583d00bf08ca78f27f979a804efcd49c96aa47fa..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/platform/setGlobalPathSegmentMessage.h +++ /dev/null @@ -1,118 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setGlobalPathSegmentMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetGlobalPathSegmentMessage - -#ifndef SET_GLOBAL_PATH_SEGMENT_MESSAGE_H -#define SET_GLOBAL_PATH_SEGMENT_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_PATH_SEGMENT_PV -#define JAUS_PATH_SEGMENT_PV -#define JAUS_PATH_SEGMENT_PV_P1_ALTITUDE_BIT 0 -#define JAUS_PATH_SEGMENT_PV_P2_ALTITUDE_BIT 1 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausUnsignedShort pathSegmentNumber; - JausDouble p1LatitudeDeg; // Scaled Integer (-90, 90) - JausDouble p1LongitudeDeg; // Scaled Integer (-180, 180) - JausDouble p1AltitudeM; // Scaled Integer (-10000, 35000) - JausDouble p2LatitudeDeg; // Scaled Integer (-90, 90) - JausDouble p2LongitudeDeg; // Scaled Integer (-180, 180) - JausDouble p2AltitudeM; // Scaled Integer (-10000, 35000) - JausDouble weightingFactor; // Scaled Unsigned Short (0, 500) - -}SetGlobalPathSegmentMessageStruct; - -typedef SetGlobalPathSegmentMessageStruct* SetGlobalPathSegmentMessage; - -JAUS_EXPORT SetGlobalPathSegmentMessage setGlobalPathSegmentMessageCreate(void); -JAUS_EXPORT void setGlobalPathSegmentMessageDestroy(SetGlobalPathSegmentMessage); - -JAUS_EXPORT JausBoolean setGlobalPathSegmentMessageFromBuffer(SetGlobalPathSegmentMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setGlobalPathSegmentMessageToBuffer(SetGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetGlobalPathSegmentMessage setGlobalPathSegmentMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setGlobalPathSegmentMessageToJausMessage(SetGlobalPathSegmentMessage message); - -JAUS_EXPORT unsigned int setGlobalPathSegmentMessageSize(SetGlobalPathSegmentMessage message); - -#endif // SET_GLOBAL_PATH_SEGMENT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/platform/setGlobalVectorMessage.h b/lib/openjaus/libjaus/include/message/command/platform/setGlobalVectorMessage.h deleted file mode 100644 index 4ff9d054170846c1c90e14cd067343bdea61f9a4..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/platform/setGlobalVectorMessage.h +++ /dev/null @@ -1,118 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setGlobalVectorMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetGlobalVectorMessage - -#ifndef SET_GLOBAL_VECTOR_MESSAGE_H -#define SET_GLOBAL_VECTOR_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_VECTOR_PV -#define JAUS_VECTOR_PV -#define JAUS_VECTOR_PV_SPEED_BIT 0 -#define JAUS_VECTOR_PV_ALTITUDE_BIT 1 -#define JAUS_VECTOR_PV_HEADING_BIT 2 -#define JAUS_VECTOR_PV_ROLL_BIT 3 -#define JAUS_VECTOR_PV_PITCH_BIT 4 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausDouble speedMps; // Scaled Unsigned Short (0, 10000) Mps = Meters Per Second - JausDouble altitudeMeters; // Scaled Integer (-10000, 35000) - JausDouble headingRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble rollRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - -}SetGlobalVectorMessageStruct; - -typedef SetGlobalVectorMessageStruct* SetGlobalVectorMessage; - -JAUS_EXPORT SetGlobalVectorMessage setGlobalVectorMessageCreate(void); -JAUS_EXPORT void setGlobalVectorMessageDestroy(SetGlobalVectorMessage); - -JAUS_EXPORT JausBoolean setGlobalVectorMessageFromBuffer(SetGlobalVectorMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setGlobalVectorMessageToBuffer(SetGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetGlobalVectorMessage setGlobalVectorMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setGlobalVectorMessageToJausMessage(SetGlobalVectorMessage message); - -JAUS_EXPORT unsigned int setGlobalVectorMessageSize(SetGlobalVectorMessage message); - -#endif // SET_GLOBAL_VECTOR_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/platform/setGlobalWaypointMessage.h b/lib/openjaus/libjaus/include/message/command/platform/setGlobalWaypointMessage.h deleted file mode 100644 index 9c1b4624ac0c863b5129aa583f039eb0601f67ed..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/platform/setGlobalWaypointMessage.h +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setGlobalWaypointMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetGlobalWaypointMessage - -#ifndef SET_GLOBAL_WAYPOINT_MESSAGE_H -#define SET_GLOBAL_WAYPOINT_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_WAYPOINT_PV -#define JAUS_WAYPOINT_PV -#define JAUS_WAYPOINT_PV_ELEVATION_BIT 0 -#define JAUS_WAYPOINT_PV_ROLL_BIT 1 -#define JAUS_WAYPOINT_PV_PITCH_BIT 2 -#define JAUS_WAYPOINT_PV_YAW_BIT 3 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausUnsignedShort waypointNumber; - JausDouble latitudeDegrees; // Scaled Integer (-90, 90) - JausDouble longitudeDegrees; // Scaled Integer (-180, 180) - JausDouble elevationMeters; // Scaled Integer (-10000, 35000) - JausDouble rollRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - -}SetGlobalWaypointMessageStruct; - -typedef SetGlobalWaypointMessageStruct* SetGlobalWaypointMessage; - -JAUS_EXPORT SetGlobalWaypointMessage setGlobalWaypointMessageCreate(void); -JAUS_EXPORT void setGlobalWaypointMessageDestroy(SetGlobalWaypointMessage); - -JAUS_EXPORT JausBoolean setGlobalWaypointMessageFromBuffer(SetGlobalWaypointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setGlobalWaypointMessageToBuffer(SetGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetGlobalWaypointMessage setGlobalWaypointMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setGlobalWaypointMessageToJausMessage(SetGlobalWaypointMessage message); - -JAUS_EXPORT unsigned int setGlobalWaypointMessageSize(SetGlobalWaypointMessage message); - -#endif // SET_GLOBAL_WAYPOINT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/platform/setLocalPathSegmentMessage.h b/lib/openjaus/libjaus/include/message/command/platform/setLocalPathSegmentMessage.h deleted file mode 100644 index 72566be5a0a82416c88f65bf698c71fdc2d07f85..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/platform/setLocalPathSegmentMessage.h +++ /dev/null @@ -1,118 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setLocalPathSegmentMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetLocalPathSegmentMessage - -#ifndef SET_LOCAL_PATH_SEGMENT_MESSAGE_H -#define SET_LOCAL_PATH_SEGMENT_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_LOCAL_PATH_SEGMENT_PV -#define JAUS_LOCAL_PATH_SEGMENT_PV -#define JAUS_LOCAL_PATH_SEGMENT_PV_P1_Z_BIT 0 -#define JAUS_LOCAL_PATH_SEGMENT_PV_P2_Z_BIT 1 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausUnsignedShort pathSegmentNumber; - JausDouble p1XM; // Scaled Integer (-100000, 100000) - JausDouble p1YM; // Scaled Integer (-100000, 100000) - JausDouble p1ZM; // Scaled Integer (-10000, 35000) - JausDouble p2XM; // Scaled Integer (-100000, 100000) - JausDouble p2YM; // Scaled Integer (-100000, 100000) - JausDouble p2ZM; // Scaled Integer (-10000, 35000) - JausDouble weightingFactor; // Scaled Unsigned Short (0, 500) - -}SetLocalPathSegmentMessageStruct; - -typedef SetLocalPathSegmentMessageStruct* SetLocalPathSegmentMessage; - -JAUS_EXPORT SetLocalPathSegmentMessage setLocalPathSegmentMessageCreate(void); -JAUS_EXPORT void setLocalPathSegmentMessageDestroy(SetLocalPathSegmentMessage); - -JAUS_EXPORT JausBoolean setLocalPathSegmentMessageFromBuffer(SetLocalPathSegmentMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setLocalPathSegmentMessageToBuffer(SetLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetLocalPathSegmentMessage setLocalPathSegmentMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setLocalPathSegmentMessageToJausMessage(SetLocalPathSegmentMessage message); - -JAUS_EXPORT unsigned int setLocalPathSegmentMessageSize(SetLocalPathSegmentMessage message); - -#endif // SET_LOCAL_PATH_SEGMENT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/platform/setLocalVectorMessage.h b/lib/openjaus/libjaus/include/message/command/platform/setLocalVectorMessage.h deleted file mode 100644 index 1d31a612ed297dfa7a25ba4625fef052e254c200..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/platform/setLocalVectorMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setLocalVectorMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetLocalVectorMessage - -#ifndef SET_LOCAL_VECTOR_MESSAGE_H -#define SET_LOCAL_VECTOR_MESSAGE_H - -#include "jaus.h" - - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausDouble speedMps; // Scaled Unsigned Int (0, 10000) Mps = Meters Per Second - JausDouble headingRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - -}SetLocalVectorMessageStruct; - -typedef SetLocalVectorMessageStruct* SetLocalVectorMessage; - -JAUS_EXPORT SetLocalVectorMessage setLocalVectorMessageCreate(void); -JAUS_EXPORT void setLocalVectorMessageDestroy(SetLocalVectorMessage); - -JAUS_EXPORT JausBoolean setLocalVectorMessageFromBuffer(SetLocalVectorMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setLocalVectorMessageToBuffer(SetLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetLocalVectorMessage setLocalVectorMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setLocalVectorMessageToJausMessage(SetLocalVectorMessage message); - -JAUS_EXPORT unsigned int setLocalVectorMessageSize(SetLocalVectorMessage message); - -#endif // SET_LOCAL_VECTOR_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/platform/setLocalWaypointMessage.h b/lib/openjaus/libjaus/include/message/command/platform/setLocalWaypointMessage.h deleted file mode 100644 index 8d3d887693f1b79b7c65aef52c629b1f390cd01b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/platform/setLocalWaypointMessage.h +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setLocalWaypointMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetLocalWaypointMessage - -#ifndef SET_LOCAL_WAYPOINT_MESSAGE_H -#define SET_LOCAL_WAYPOINT_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_LOCAL_WAYPOINT_PV -#define JAUS_LOCAL_WAYPOINT_PV -#define JAUS_LOCAL_WAYPOINT_PV_Z_BIT 0 -#define JAUS_LOCAL_WAYPOINT_PV_ROLL_BIT 1 -#define JAUS_LOCAL_WAYPOINT_PV_PITCH_BIT 2 -#define JAUS_LOCAL_WAYPOINT_PV_YAW_BIT 3 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausUnsignedShort waypointNumber; - JausDouble xM; // Scaled Integer (-100000, 100000) - JausDouble yM; // Scaled Integer (-100000, 100000) - JausDouble zM; // Scaled Integer (-10000, 35000) - JausDouble rollRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - -}SetLocalWaypointMessageStruct; - -typedef SetLocalWaypointMessageStruct* SetLocalWaypointMessage; - -JAUS_EXPORT SetLocalWaypointMessage setLocalWaypointMessageCreate(void); -JAUS_EXPORT void setLocalWaypointMessageDestroy(SetLocalWaypointMessage); - -JAUS_EXPORT JausBoolean setLocalWaypointMessageFromBuffer(SetLocalWaypointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setLocalWaypointMessageToBuffer(SetLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetLocalWaypointMessage setLocalWaypointMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setLocalWaypointMessageToJausMessage(SetLocalWaypointMessage message); - -JAUS_EXPORT unsigned int setLocalWaypointMessageSize(SetLocalWaypointMessage message); - -#endif // SET_LOCAL_WAYPOINT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/platform/setTravelSpeedMessage.h b/lib/openjaus/libjaus/include/message/command/platform/setTravelSpeedMessage.h deleted file mode 100644 index 2f65f1044d1efa008cdda75b089be88b8f5d37c6..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/platform/setTravelSpeedMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setTravelSpeedMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetTravelSpeedMessage - -#ifndef SET_TRAVEL_SPEED_MESSAGE_H -#define SET_TRAVEL_SPEED_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausDouble speedMps; //Scaled Unsigned Short (0, 10000) Mps = Meters Per Second - -}SetTravelSpeedMessageStruct; - -typedef SetTravelSpeedMessageStruct* SetTravelSpeedMessage; - -JAUS_EXPORT SetTravelSpeedMessage setTravelSpeedMessageCreate(void); -JAUS_EXPORT void setTravelSpeedMessageDestroy(SetTravelSpeedMessage); - -JAUS_EXPORT JausBoolean setTravelSpeedMessageFromBuffer(SetTravelSpeedMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setTravelSpeedMessageToBuffer(SetTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetTravelSpeedMessage setTravelSpeedMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setTravelSpeedMessageToJausMessage(SetTravelSpeedMessage message); - -JAUS_EXPORT unsigned int setTravelSpeedMessageSize(SetTravelSpeedMessage message); - -#endif // SET_TRAVEL_SPEED_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/platform/setVelocityStateMessage.h b/lib/openjaus/libjaus/include/message/command/platform/setVelocityStateMessage.h deleted file mode 100644 index ab811ce26559161da1d5a753db4b4637032b1fdd..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/platform/setVelocityStateMessage.h +++ /dev/null @@ -1,126 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setVelocityStateMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetVelocityStateMessage - -#ifndef SET_VELOCITY_STATE_MESSAGE_H -#define SET_VELOCITY_STATE_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_VELOCITY_PV -#define JAUS_VELOCITY_PV -#define JAUS_VELOCITY_PV_VELOCITY_X_BIT 0 -#define JAUS_VELOCITY_PV_VELOCITY_Y_BIT 1 -#define JAUS_VELOCITY_PV_VELOCITY_Z_BIT 2 -#define JAUS_VELOCITY_PV_VELOCITY_RMS_BIT 3 -#define JAUS_VELOCITY_PV_ROLL_RATE_BIT 4 -#define JAUS_VELOCITY_PV_PITCH_RATE_BIT 5 -#define JAUS_VELOCITY_PV_YAW_RATE_BIT 6 -#define JAUS_VELOCITY_PV_RATE_RMS_BIT 7 -#define JAUS_VELOCITY_PV_TIME_STAMP_BIT 8 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort presenceVector; - JausDouble velocityXMps; // Scaled Int (-65.534, 65.534) Mps = Meters per Second - JausDouble velocityYMps; // Scaled Int (-65.534, 65.534) Mps = Meters per Second - JausDouble velocityZMps; // Scaled Int (-65.534, 65.534) Mps = Meters per Secon - JausDouble velocityRmsMps; // Scaled UInt (0, 100) Mps = Meters per Second - JausDouble rollRateRps; // Scaled Short (-32.767, 32.767) Rps = Radians per Second - JausDouble pitchRateRps; // Scaled Short (-32.767, 32.767) Rps = Radians per Second - JausDouble yawRateRps; // Scaled Short (-32.767, 32.767) Rps = Radians per Second - JausDouble rateRmsRps; // Scaled UShort (0, JAUS_PI) Rps = Radians per Second - JausUnsignedInteger timeStamp; - -}SetVelocityStateMessageStruct; - -typedef SetVelocityStateMessageStruct* SetVelocityStateMessage; - -JAUS_EXPORT SetVelocityStateMessage setVelocityStateMessageCreate(void); -JAUS_EXPORT void setVelocityStateMessageDestroy(SetVelocityStateMessage); - -JAUS_EXPORT JausBoolean setVelocityStateMessageFromBuffer(SetVelocityStateMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setVelocityStateMessageToBuffer(SetVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetVelocityStateMessage setVelocityStateMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setVelocityStateMessageToJausMessage(SetVelocityStateMessage message); - -JAUS_EXPORT unsigned int setVelocityStateMessageSize(SetVelocityStateMessage message); - -#endif // SET_VELOCITY_STATE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/platform/setWrenchEffortMessage.h b/lib/openjaus/libjaus/include/message/command/platform/setWrenchEffortMessage.h deleted file mode 100644 index 5645a4d99bbe88e33ab4909746e284e268495084..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/platform/setWrenchEffortMessage.h +++ /dev/null @@ -1,133 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setWrenchEffortMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetWrenchEffortMessage - -#ifndef SET_WRENCH_EFFORT_MESSAGE_H -#define SET_WRENCH_EFFORT_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_WRENCH_PV -#define JAUS_WRENCH_PV -#define JAUS_WRENCH_PV_PROPULSIVE_LINEAR_X_BIT 0 -#define JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Y_BIT 1 -#define JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Z_BIT 2 -#define JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_X_BIT 3 -#define JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Y_BIT 4 -#define JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Z_BIT 5 -#define JAUS_WRENCH_PV_RESISTIVE_LINEAR_X_BIT 6 -#define JAUS_WRENCH_PV_RESISTIVE_LINEAR_Y_BIT 7 -#define JAUS_WRENCH_PV_RESISTIVE_LINEAR_Z_BIT 8 -#define JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_X_BIT 9 -#define JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Y_BIT 10 -#define JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Z_BIT 11 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // Message Fields: - JausUnsignedShort presenceVector; - JausDouble propulsiveLinearEffortXPercent; // Scaled Short (-100, 100) - JausDouble propulsiveLinearEffortYPercent; // Scaled Short (-100, 100) - JausDouble propulsiveLinearEffortZPercent; // Scaled Short (-100, 100) - JausDouble propulsiveRotationalEffortXPercent; // Scaled Short (-100, 100) - JausDouble propulsiveRotationalEffortYPercent; // Scaled Short (-100, 100) - JausDouble propulsiveRotationalEffortZPercent; // Scaled Short (-100, 100) - JausDouble resistiveLinearEffortXPercent; // Scaled Byte (0, 100) - JausDouble resistiveLinearEffortYPercent; // Scaled Byte (0, 100) - JausDouble resistiveLinearEffortZPercent; // Scaled Byte (0, 100) - JausDouble resistiveRotationalEffortXPercent; // Scaled Byte (0, 100) - JausDouble resistiveRotationalEffortZPercent; // Scaled Byte (0, 100) - JausDouble resistiveRotationalEffortYPercent; // Scaled Byte (0, 100) - -}SetWrenchEffortMessageStruct; - -typedef SetWrenchEffortMessageStruct* SetWrenchEffortMessage; - -JAUS_EXPORT SetWrenchEffortMessage setWrenchEffortMessageCreate(void); -JAUS_EXPORT void setWrenchEffortMessageDestroy(SetWrenchEffortMessage); - -JAUS_EXPORT JausBoolean setWrenchEffortMessageFromBuffer(SetWrenchEffortMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setWrenchEffortMessageToBuffer(SetWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetWrenchEffortMessage setWrenchEffortMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setWrenchEffortMessageToJausMessage(SetWrenchEffortMessage message); - -JAUS_EXPORT unsigned int setWrenchEffortMessageSize(SetWrenchEffortMessage message); - -#endif // SET_WRENCH_EFFORT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/worldModel/createVksObjectsMessage.h b/lib/openjaus/libjaus/include/message/command/worldModel/createVksObjectsMessage.h deleted file mode 100644 index b82fd7697b7b529f5b7a8fecb18d525ef34bfa95..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/worldModel/createVksObjectsMessage.h +++ /dev/null @@ -1,115 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: createVksObjectsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a CreateVksObjectsMessage - -#ifndef CREATE_VKS_OBJECTS_MESSAGE_H -#define CREATE_VKS_OBJECTS_MESSAGE_H - -#include "jaus.h" - -#ifndef VKS_PV_CREATE -#define VKS_PV_CREATE_BUFFERED_BIT 0 -#endif - -#ifndef VKS_CREATE_PROPERTIES -#define VKS_CREATE_PROPERTIES_CONFIRMATION_BIT 0 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; // presenceVector - JausByte messageProperties; // Bit Field, use Presence Vector for ease - JausByte requestId; // Local Request ID - JausArray vectorObjects; // Dynamic Array of Vector Objects -}CreateVksObjectsMessageStruct; - -typedef CreateVksObjectsMessageStruct* CreateVksObjectsMessage; - -JAUS_EXPORT CreateVksObjectsMessage createVksObjectsMessageCreate(void); -JAUS_EXPORT void createVksObjectsMessageDestroy(CreateVksObjectsMessage); - -JAUS_EXPORT JausBoolean createVksObjectsMessageFromBuffer(CreateVksObjectsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean createVksObjectsMessageToBuffer(CreateVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT CreateVksObjectsMessage createVksObjectsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage createVksObjectsMessageToJausMessage(CreateVksObjectsMessage message); - -JAUS_EXPORT unsigned int createVksObjectsMessageSize(CreateVksObjectsMessage message); - -#endif // CREATE_VKS_OBJECTS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/worldModel/deleteVksObjectsMessage.h b/lib/openjaus/libjaus/include/message/command/worldModel/deleteVksObjectsMessage.h deleted file mode 100644 index 284fbc93e861659abf58f75ff47f5b71122b30af..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/worldModel/deleteVksObjectsMessage.h +++ /dev/null @@ -1,126 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: deleteVksObjectsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a DeleteVksObjectsMessage - -#ifndef DELETE_VKS_OBJECTS_MESSAGE_H -#define DELETE_VKS_OBJECTS_MESSAGE_H - -#include "jaus.h" - -// Note: The PV for this message is a bit over-defined -// If the VKS_PV_DELETE_OBJECTS_REGION_BIT is set, then the VKS_PV_DELETE_OBJECTS_POINT_COUNT_BIT is required -// The VKS_PV_DELETE_OBJECTS_BUFFER_BIT cannot be set without the VKS_PV_DELETE_OBJECTS_REGION_BIT -// -// If the VKS_PV_DELETE_OBJECTS_FEATURE_CLASS_BIT is set or the VKS_PV_DELETE_OBJECTS_ATTRIBUTE_BIT is set, -// then the VKS_PV_DELETE_OBJECTS_FC_COUNT_BIT is required -#ifndef VKS_PV_DELETE_OBJECTS -#define VKS_PV_DELETE_OBJECTS -#define VKS_PV_DELETE_OBJECTS_ID_BIT 0 -#define VKS_PV_DELETE_OBJECTS_REGION_BIT 1 -#define VKS_PV_DELETE_OBJECTS_BUFFER_BIT 2 -#define VKS_PV_DELETE_OBJECTS_FC_COUNT_BIT 3 -#define VKS_PV_DELETE_OBJECTS_FEATURE_CLASS_BIT 4 -#define VKS_PV_DELETE_OBJECTS_ATTRIBUTE_BIT 5 -#define VKS_PV_DELETE_OBJECTS_POINT_COUNT_BIT 6 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; // 1: Presence Vector - JausByte requestId; // 2: Id to respond to this message with - JausUnsignedShort objectCount; // 3: Count of specific object ids to delete - JausUnsignedInteger *objectIds; // 4: Array of specific object ids - JausWorldModelVectorObject deletionRegion; // 5: Deletion region with associated FCs and attributes - -}DeleteVksObjectsMessageStruct; - -typedef DeleteVksObjectsMessageStruct* DeleteVksObjectsMessage; - -JAUS_EXPORT DeleteVksObjectsMessage deleteVksObjectsMessageCreate(void); -JAUS_EXPORT void deleteVksObjectsMessageDestroy(DeleteVksObjectsMessage); - -JAUS_EXPORT JausBoolean deleteVksObjectsMessageFromBuffer(DeleteVksObjectsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean deleteVksObjectsMessageToBuffer(DeleteVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT DeleteVksObjectsMessage deleteVksObjectsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage deleteVksObjectsMessageToJausMessage(DeleteVksObjectsMessage message); - -JAUS_EXPORT unsigned int deleteVksObjectsMessageSize(DeleteVksObjectsMessage message); - -#endif // DELETE_VKS_OBJECTS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/worldModel/setVksFeatureClassMetadataMessage.h b/lib/openjaus/libjaus/include/message/command/worldModel/setVksFeatureClassMetadataMessage.h deleted file mode 100644 index a58dc1d2b90077a65be3b922bc1f8cd2c21a6a23..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/worldModel/setVksFeatureClassMetadataMessage.h +++ /dev/null @@ -1,118 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setVksFeatureClassMetadataMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a SetVksFeatureClassMetadataMessage - -#ifndef SET_VKS_FEATURE_CLASS_METADATA_MESSAGE_H -#define SET_VKS_FEATURE_CLASS_METADATA_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_METADATA_OPTIONS_ENUM -#define JAUS_METADATA_OPTIONS_ENUM -typedef enum -{ - JAUS_METADATA_APPEND = 0, - JAUS_METADATA_PREPEND = 1, - JAUS_METADATA_OVERWRITE = 2, - JAUS_METADATA_ERASE = 255 -} JausMetadataOptionsEnum; -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausMetadataOptionsEnum metadataOptions; - JausUnsignedShort featureClassID; - char *featureClassMetadataString; - -}SetVksFeatureClassMetadataMessageStruct; - -typedef SetVksFeatureClassMetadataMessageStruct* SetVksFeatureClassMetadataMessage; - -JAUS_EXPORT SetVksFeatureClassMetadataMessage setVksFeatureClassMetadataMessageCreate(void); -JAUS_EXPORT void setVksFeatureClassMetadataMessageDestroy(SetVksFeatureClassMetadataMessage); - -JAUS_EXPORT JausBoolean setVksFeatureClassMetadataMessageFromBuffer(SetVksFeatureClassMetadataMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean setVksFeatureClassMetadataMessageToBuffer(SetVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT SetVksFeatureClassMetadataMessage setVksFeatureClassMetadataMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage setVksFeatureClassMetadataMessageToJausMessage(SetVksFeatureClassMetadataMessage message); - -JAUS_EXPORT unsigned int setVksFeatureClassMetadataMessageSize(SetVksFeatureClassMetadataMessage message); - -#endif // SET_VKS_FEATURE_CLASS_METADATA_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/command/worldModel/terminateVksDataTransferMessage.h b/lib/openjaus/libjaus/include/message/command/worldModel/terminateVksDataTransferMessage.h deleted file mode 100644 index 635df20748765bd201841fb5cb3b9db101f09426..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/command/worldModel/terminateVksDataTransferMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: terminateVksDataTransferMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a TerminateVksDataTransferMessage - -#ifndef TERMINATE_VKS_DATA_TRANSFER_MESSAGE_H -#define TERMINATE_VKS_DATA_TRANSFER_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No Data Members - -}TerminateVksDataTransferMessageStruct; - -typedef TerminateVksDataTransferMessageStruct* TerminateVksDataTransferMessage; - -JAUS_EXPORT TerminateVksDataTransferMessage terminateVksDataTransferMessageCreate(void); -JAUS_EXPORT void terminateVksDataTransferMessageDestroy(TerminateVksDataTransferMessage); - -JAUS_EXPORT JausBoolean terminateVksDataTransferMessageFromBuffer(TerminateVksDataTransferMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean terminateVksDataTransferMessageToBuffer(TerminateVksDataTransferMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT TerminateVksDataTransferMessage terminateVksDataTransferMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage terminateVksDataTransferMessageToJausMessage(TerminateVksDataTransferMessage message); - -JAUS_EXPORT unsigned int terminateVksDataTransferMessageSize(TerminateVksDataTransferMessage message); - -#endif // TERMINATE_VKS_DATA_TRANSFER_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/communications/reportDataLinkStatusMessage.h b/lib/openjaus/libjaus/include/message/inform/communications/reportDataLinkStatusMessage.h deleted file mode 100644 index c208c43d8971e243981072b6229070eab6db0d7f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/communications/reportDataLinkStatusMessage.h +++ /dev/null @@ -1,117 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportDataLinkStatusMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportDataLinkStatusMessage - -#ifndef REPORT_DATA_LINK_STATUS_MESSAGE_H -#define REPORT_DATA_LINK_STATUS_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_DATA_LINK_ENUM -#define JAUS_DATA_LINK_ENUM -typedef enum -{ - JAUS_DATA_LINK_OFF = 0, - JAUS_DATA_LINK_ON = 1, - JAUS_DATA_LINK_STANDBY = 2 -} JausDataLinkEnum; -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - - JausByte dataLinkId; - JausDataLinkEnum dataLinkState; - -}ReportDataLinkStatusMessageStruct; - -typedef ReportDataLinkStatusMessageStruct* ReportDataLinkStatusMessage; - -JAUS_EXPORT ReportDataLinkStatusMessage reportDataLinkStatusMessageCreate(void); -JAUS_EXPORT void reportDataLinkStatusMessageDestroy(ReportDataLinkStatusMessage); - -JAUS_EXPORT JausBoolean reportDataLinkStatusMessageFromBuffer(ReportDataLinkStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportDataLinkStatusMessageToBuffer(ReportDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportDataLinkStatusMessage reportDataLinkStatusMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportDataLinkStatusMessageToJausMessage(ReportDataLinkStatusMessage message); - -JAUS_EXPORT unsigned int reportDataLinkStatusMessageSize(ReportDataLinkStatusMessage message); - -#endif // REPORT_DATA_LINK_STATUS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/communications/reportHeartbeatPulseMessage.h b/lib/openjaus/libjaus/include/message/inform/communications/reportHeartbeatPulseMessage.h deleted file mode 100644 index 869147ce4e907da128c9dae10beacb1be0a495f5..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/communications/reportHeartbeatPulseMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportHeartbeatPulseMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportHeartbeatPulseMessage - -#ifndef REPORT_HEARTBEAT_PULSE_MESSAGE_H -#define REPORT_HEARTBEAT_PULSE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - -}ReportHeartbeatPulseMessageStruct; - -typedef ReportHeartbeatPulseMessageStruct* ReportHeartbeatPulseMessage; - -JAUS_EXPORT ReportHeartbeatPulseMessage reportHeartbeatPulseMessageCreate(void); -JAUS_EXPORT void reportHeartbeatPulseMessageDestroy(ReportHeartbeatPulseMessage); - -JAUS_EXPORT JausBoolean reportHeartbeatPulseMessageFromBuffer(ReportHeartbeatPulseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportHeartbeatPulseMessageToBuffer(ReportHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportHeartbeatPulseMessage reportHeartbeatPulseMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportHeartbeatPulseMessageToJausMessage(ReportHeartbeatPulseMessage message); - -JAUS_EXPORT unsigned int reportHeartbeatPulseMessageSize(ReportHeartbeatPulseMessage message); - -#endif // REPORT_HEARTBEAT_PULSE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/communications/reportSelectedDataLinkStatusMessage.h b/lib/openjaus/libjaus/include/message/inform/communications/reportSelectedDataLinkStatusMessage.h deleted file mode 100644 index 9caca656ea8305c705da549c8c37d5da46142e09..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/communications/reportSelectedDataLinkStatusMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportSelectedDataLinkStatusMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportSelectedDataLinkStatusMessage - -#ifndef REPORT_SELECTED_DATA_LINK_STATUS_MESSAGE_H -#define REPORT_SELECTED_DATA_LINK_STATUS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - - JausByte dataLinkId; - -}ReportSelectedDataLinkStatusMessageStruct; - -typedef ReportSelectedDataLinkStatusMessageStruct* ReportSelectedDataLinkStatusMessage; - -JAUS_EXPORT ReportSelectedDataLinkStatusMessage reportSelectedDataLinkStatusMessageCreate(void); -JAUS_EXPORT void reportSelectedDataLinkStatusMessageDestroy(ReportSelectedDataLinkStatusMessage); - -JAUS_EXPORT JausBoolean reportSelectedDataLinkStatusMessageFromBuffer(ReportSelectedDataLinkStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportSelectedDataLinkStatusMessageToBuffer(ReportSelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportSelectedDataLinkStatusMessage reportSelectedDataLinkStatusMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportSelectedDataLinkStatusMessageToJausMessage(ReportSelectedDataLinkStatusMessage message); - -JAUS_EXPORT unsigned int reportSelectedDataLinkStatusMessageSize(ReportSelectedDataLinkStatusMessage message); - -#endif // REPORT_SELECTED_DATA_LINK_STATUS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/core/reportComponentAuthorityMessage.h b/lib/openjaus/libjaus/include/message/inform/core/reportComponentAuthorityMessage.h deleted file mode 100644 index c502b1c88e105a1bcb960e17b5fcf98a5fcddfde..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/core/reportComponentAuthorityMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportComponentAuthorityMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportComponentAuthorityMessage - -#ifndef REPORT_COMPONENT_AUTHORITY_MESSAGE_H -#define REPORT_COMPONENT_AUTHORITY_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte authorityCode; - -}ReportComponentAuthorityMessageStruct; - -typedef ReportComponentAuthorityMessageStruct* ReportComponentAuthorityMessage; - -JAUS_EXPORT ReportComponentAuthorityMessage reportComponentAuthorityMessageCreate(void); -JAUS_EXPORT void reportComponentAuthorityMessageDestroy(ReportComponentAuthorityMessage); - -JAUS_EXPORT JausBoolean reportComponentAuthorityMessageFromBuffer(ReportComponentAuthorityMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportComponentAuthorityMessageToBuffer(ReportComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportComponentAuthorityMessage reportComponentAuthorityMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportComponentAuthorityMessageToJausMessage(ReportComponentAuthorityMessage message); - -JAUS_EXPORT unsigned int reportComponentAuthorityMessageSize(ReportComponentAuthorityMessage message); - -#endif // REPORT_COMPONENT_AUTHORITY_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/core/reportComponentControlMessage.h b/lib/openjaus/libjaus/include/message/inform/core/reportComponentControlMessage.h deleted file mode 100644 index 04b7435964834b80806f6f555c64e21654ae0e47..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/core/reportComponentControlMessage.h +++ /dev/null @@ -1,109 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportComponentControlMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportComponentControlMessage - -#ifndef REPORT_COMPONENT_CONTROL_MESSAGE_H -#define REPORT_COMPONENT_CONTROL_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte subsystemId; - JausByte nodeId; - JausByte componentId; - JausByte instanceId; - JausByte authorityCode; - -}ReportComponentControlMessageStruct; - -typedef ReportComponentControlMessageStruct* ReportComponentControlMessage; - -JAUS_EXPORT ReportComponentControlMessage reportComponentControlMessageCreate(void); -JAUS_EXPORT void reportComponentControlMessageDestroy(ReportComponentControlMessage); - -JAUS_EXPORT JausBoolean reportComponentControlMessageFromBuffer(ReportComponentControlMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportComponentControlMessageToBuffer(ReportComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportComponentControlMessage reportComponentControlMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportComponentControlMessageToJausMessage(ReportComponentControlMessage message); - -JAUS_EXPORT unsigned int reportComponentControlMessageSize(ReportComponentControlMessage message); - -#endif // REPORT_COMPONENT_CONTROL_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/core/reportComponentStatusMessage.h b/lib/openjaus/libjaus/include/message/inform/core/reportComponentStatusMessage.h deleted file mode 100644 index 3d7e79472c75e57e780f9cc48571a99b8bf6e03b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/core/reportComponentStatusMessage.h +++ /dev/null @@ -1,111 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportComponentStatusMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportComponentStatusMessage - -#ifndef REPORT_COMPONENT_STATUS_MESSAGE_H -#define REPORT_COMPONENT_STATUS_MESSAGE_H - -#define JAUS_STATUS_INITIALIZE 0 -#define JAUS_STATUS_READY 1 -#define JAUS_STATUS_STANDBY 2 -#define JAUS_STATUS_SHUTDOWN 3 -#define JAUS_STATUS_FAILURE 4 -#define JAUS_STATUS_EMERGENCY 5 - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausState primaryStatusCode; - JausUnsignedInteger secondaryStatusCode; - -}ReportComponentStatusMessageStruct; - -typedef ReportComponentStatusMessageStruct* ReportComponentStatusMessage; - -JAUS_EXPORT ReportComponentStatusMessage reportComponentStatusMessageCreate(void); -JAUS_EXPORT void reportComponentStatusMessageDestroy(ReportComponentStatusMessage); - -JAUS_EXPORT JausBoolean reportComponentStatusMessageFromBuffer(ReportComponentStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportComponentStatusMessageToBuffer(ReportComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportComponentStatusMessage reportComponentStatusMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportComponentStatusMessageToJausMessage(ReportComponentStatusMessage message); - -JAUS_EXPORT unsigned int reportComponentStatusMessageSize(ReportComponentStatusMessage message); - -#endif // REPORT_COMPONENT_STATUS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/core/reportTimeMessage.h b/lib/openjaus/libjaus/include/message/inform/core/reportTimeMessage.h deleted file mode 100644 index a82fcd634186a74ae850bd577ba63986c8ce0bcd..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/core/reportTimeMessage.h +++ /dev/null @@ -1,112 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportTimeMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportTimeMessage - -#ifndef REPORT_TIME_MESSAGE_H -#define REPORT_TIME_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_TIME_PV -#define JAUS_TIME_PV -#define JAUS_TIME_PV_TIME_STAMP_BIT 0 -#define JAUS_TIME_PV_DATE_STAMP_BIT 1 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; - JausTime time; - -}ReportTimeMessageStruct; - -typedef ReportTimeMessageStruct* ReportTimeMessage; - -JAUS_EXPORT ReportTimeMessage reportTimeMessageCreate(void); -JAUS_EXPORT void reportTimeMessageDestroy(ReportTimeMessage); - -JAUS_EXPORT JausBoolean reportTimeMessageFromBuffer(ReportTimeMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportTimeMessageToBuffer(ReportTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportTimeMessage reportTimeMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportTimeMessageToJausMessage(ReportTimeMessage message); - -JAUS_EXPORT unsigned int reportTimeMessageSize(ReportTimeMessage message); - -#endif // REPORT_TIME_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/dynamicConfiguration/reportConfigurationMessage.h b/lib/openjaus/libjaus/include/message/inform/dynamicConfiguration/reportConfigurationMessage.h deleted file mode 100644 index f5edbd72844c54d83f53b73aac031c8542dbd23c..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/dynamicConfiguration/reportConfigurationMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportConfigurationMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportConfigurationMessage - -#ifndef REPORT_CONFIGURATION_MESSAGE_H -#define REPORT_CONFIGURATION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausSubsystem subsystem; - -}ReportConfigurationMessageStruct; - -typedef ReportConfigurationMessageStruct* ReportConfigurationMessage; - -JAUS_EXPORT ReportConfigurationMessage reportConfigurationMessageCreate(void); -JAUS_EXPORT void reportConfigurationMessageDestroy(ReportConfigurationMessage); - -JAUS_EXPORT JausBoolean reportConfigurationMessageFromBuffer(ReportConfigurationMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportConfigurationMessageToBuffer(ReportConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportConfigurationMessage reportConfigurationMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportConfigurationMessageToJausMessage(ReportConfigurationMessage message); - -JAUS_EXPORT unsigned int reportConfigurationMessageSize(ReportConfigurationMessage message); - -#endif // REPORT_CONFIGURATION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/dynamicConfiguration/reportIdentificationMessage.h b/lib/openjaus/libjaus/include/message/inform/dynamicConfiguration/reportIdentificationMessage.h deleted file mode 100644 index 62bad5372cfdc3d43a6ececdf5cadd35de15d258..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/dynamicConfiguration/reportIdentificationMessage.h +++ /dev/null @@ -1,116 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportIdentificationMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportIdentificationMessage - -#ifndef REPORT_IDENTIFICATION_MESSAGE_H -#define REPORT_IDENTIFICATION_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_IDENTIFICATION_TYPE -#define JAUS_IDENTIFICATION_TYPE -#define JAUS_QUERY_FIELD_RESERVED 0 -#define JAUS_QUERY_FIELD_SYSTEM_IDENTITY 1 -#define JAUS_QUERY_FIELD_SS_IDENTITY 2 -#define JAUS_QUERY_FIELD_NODE_IDENTITY 3 -#define JAUS_QUERY_FIELD_COMPONENT_IDENTITY 4 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte queryType; - JausByte authority; - JausUnsignedShort type; - char identification[JAUS_IDENTIFICATION_LENGTH_BYTES]; - -}ReportIdentificationMessageStruct; - -typedef ReportIdentificationMessageStruct* ReportIdentificationMessage; - -JAUS_EXPORT ReportIdentificationMessage reportIdentificationMessageCreate(void); -JAUS_EXPORT void reportIdentificationMessageDestroy(ReportIdentificationMessage); - -JAUS_EXPORT JausBoolean reportIdentificationMessageFromBuffer(ReportIdentificationMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportIdentificationMessageToBuffer(ReportIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportIdentificationMessage reportIdentificationMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportIdentificationMessageToJausMessage(ReportIdentificationMessage message); - -JAUS_EXPORT unsigned int reportIdentificationMessageSize(ReportIdentificationMessage message); - -#endif // REPORT_IDENTIFICATION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/dynamicConfiguration/reportServicesMessage.h b/lib/openjaus/libjaus/include/message/inform/dynamicConfiguration/reportServicesMessage.h deleted file mode 100644 index 2ed9a97962bd6ad890af128590d85f1a2880e308..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/dynamicConfiguration/reportServicesMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportServicesMessage.h -// -// Written By: Bob Touchton, inspired by Danny Kent -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// This file defines the attributes of a ReportServicesMessage - -#ifndef REPORT_SERVICES_MESSAGE_H -#define REPORT_SERVICES_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - //message-specific fields - JausArray jausServices; - -}ReportServicesMessageStruct; - -typedef ReportServicesMessageStruct* ReportServicesMessage; - -JAUS_EXPORT ReportServicesMessage reportServicesMessageCreate(void); -JAUS_EXPORT void reportServicesMessageDestroy(ReportServicesMessage); - -JAUS_EXPORT JausBoolean reportServicesMessageFromBuffer(ReportServicesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportServicesMessageToBuffer(ReportServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportServicesMessage reportServicesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportServicesMessageToJausMessage(ReportServicesMessage message); - -JAUS_EXPORT unsigned int reportServicesMessageSize(ReportServicesMessage message); - -#endif diff --git a/lib/openjaus/libjaus/include/message/inform/dynamicConfiguration/reportSubsystemListMessage.h b/lib/openjaus/libjaus/include/message/inform/dynamicConfiguration/reportSubsystemListMessage.h deleted file mode 100644 index 58d35b279a70c0c98b71c129f43a22d4750d2534..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/dynamicConfiguration/reportSubsystemListMessage.h +++ /dev/null @@ -1,107 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportSubsystemListMessage.h -// -// Written By: Bob Touchton, inspired by Danny Kent -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// This file defines the attributes of a ReportSubsystemListMessage - -#ifndef REPORT_SUBSYSTEM_LIST_MESSAGE_H -#define REPORT_SUBSYSTEM_LIST_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - //message-specific fields - JausByte subsystemCount; - JausByte *subsystemId; - JausByte *nodeId; - JausByte *componentId; - JausByte *instanceId; -}ReportSubsystemListMessageStruct; - -typedef ReportSubsystemListMessageStruct* ReportSubsystemListMessage; - -JAUS_EXPORT ReportSubsystemListMessage reportSubsystemListMessageCreate(void); -JAUS_EXPORT void reportSubsystemListMessageDestroy(ReportSubsystemListMessage); - -JAUS_EXPORT JausBoolean reportSubsystemListMessageFromBuffer(ReportSubsystemListMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportSubsystemListMessageToBuffer(ReportSubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportSubsystemListMessage reportSubsystemListMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportSubsystemListMessageToJausMessage(ReportSubsystemListMessage message); - -JAUS_EXPORT unsigned int reportSubsystemListMessageSize(ReportSubsystemListMessage message); - -#endif diff --git a/lib/openjaus/libjaus/include/message/inform/environment/reportCameraCapabilitiesMessage.h b/lib/openjaus/libjaus/include/message/inform/environment/reportCameraCapabilitiesMessage.h deleted file mode 100644 index b05016da2b85d1e836531cf26621d25e1b6d4658..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/environment/reportCameraCapabilitiesMessage.h +++ /dev/null @@ -1,186 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportCameraCapabilitiesMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportCameraCapabilitiesMessage - -#ifndef REPORT_CAMERA_CAPABILITIES_MESSAGE_H -#define REPORT_CAMERA_CAPABILITIES_MESSAGE_H - -#include "jaus.h" - -#define JAUS_CAMERA_DESCRIPTION_LENGTH_BYTES 50 - -#ifndef JAUS_REPORT_CAMERA_CAPABILITIES_PV -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_DESCRIPTION_BIT 0 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_HORIZONTAL_FOV_BIT 1 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_HORIZONTAL_FOV_BIT 2 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_VERTICAL_FOV_BIT 3 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_VERTICAL_FOV_BIT 4 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_HORIZONTAL_RESOLUTION_BIT 5 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_HORIZONTAL_RESOLUTION_BIT 6 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_VERTICAL_RESOLUTION_BIT 7 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_VERTICAL_RESOLUTION_BIT 8 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_FRAME_RATE_BIT 9 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_FRAME_RATE_BIT 10 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_SHUTTER_SPEED_BIT 11 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_SHUTTER_SPEED_BIT 12 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_IMAGE_CONTROL_BIT 13 -#define JAUS_REPORT_CAMERA_CAPABILITIES_PV_AUDIO_CONTROL_BIT 14 -#endif - -#ifndef JAUS_CAMERA_IMAGE_CONTROL_BF -#define JAUS_CAMERA_IMAGE_CONTROL_BF -#define JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_FOCUS_BIT 0 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_IRIS_BIT 1 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_IMAGE_STABILIZATION_BIT 2 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_WHITE_BALANCE_BIT 3 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_SYNC_FLASH_BIT 4 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_RED_EYE_BIT 5 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_SHUTTER_BIT 6 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_GAIN_BIT 7 -#define JAUS_CAMERA_IMAGE_CONTROL_BF_INTERLACED_BIT 8 -#endif - -#ifndef JAUS_CAMERA_AUDIO_CONTROL_BF -#define JAUS_CAMERA_AUDIO_CONTROL_BF -#define JAUS_CAMERA_AUDIO_CONTROL_BF_AUDIO_BIT 0 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_AUTO_GAIN_BIT 1 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_STEREO_BIT 2 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_DIRECTIONAL_BIT 3 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_FRONT_MICROPHONE_BIT 4 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_REAR_MICROPHONE_BIT 5 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_LEFT_MICROPHONE_BIT 6 -#define JAUS_CAMERA_AUDIO_CONTROL_BF_RIGHT_MICROPHONE_BIT 7 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausUnsignedShort presenceVector; - JausByte cameraID; - char cameraDescription[JAUS_CAMERA_DESCRIPTION_LENGTH_BYTES]; - JausDouble maxHorizontalFovRadians; // Scaled UShort (0, JAUS_PI) - JausDouble minHorizontalFovRadians; // Scaled UShort (0, JAUS_PI) - JausDouble maxVerticalFovRadians; // Scaled UShort (0, JAUS_PI) - JausDouble minVerticalFovRadians; // Scaled UShort (0, JAUS_PI) - JausUnsignedShort maxHorizontalResolution; - JausUnsignedShort minHorizontalResolution; - JausUnsignedShort maxVerticalResolution; - JausUnsignedShort minVerticalResolution; - JausUnsignedShort maxFrameRate; - JausUnsignedShort minFrameRate; - JausUnsignedShort maxShutterSpeed; - JausUnsignedShort minShutterSpeed; - - // Image Control - JausBoolean autoFocusAvailable; - JausBoolean autoIrisAvailable; - JausBoolean imageStabilizationAvailable; - JausBoolean whiteBalanceAvailable; - JausBoolean syncFlashAvailable; - JausBoolean redEyeAvailable; - JausBoolean autoShutterAvailable; - JausBoolean videoAutoGainAvailable; - JausBoolean interlacedVideoAvailable; - - // Audio Control - JausBoolean audioEnabledAvailable; - JausBoolean audioAutoGainAvailable; - JausBoolean stereoAudioAvailable; - JausBoolean directionalAudioAvailable; - JausBoolean frontMicrophoneAvailable; - JausBoolean rearMicrophoneAvailable; - JausBoolean leftMicrophoneAvailable; - JausBoolean rightMicrophoneAvailable; - -}ReportCameraCapabilitiesMessageStruct; - -typedef ReportCameraCapabilitiesMessageStruct* ReportCameraCapabilitiesMessage; - -JAUS_EXPORT ReportCameraCapabilitiesMessage reportCameraCapabilitiesMessageCreate(void); -JAUS_EXPORT void reportCameraCapabilitiesMessageDestroy(ReportCameraCapabilitiesMessage); - -JAUS_EXPORT JausBoolean reportCameraCapabilitiesMessageFromBuffer(ReportCameraCapabilitiesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportCameraCapabilitiesMessageToBuffer(ReportCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportCameraCapabilitiesMessage reportCameraCapabilitiesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportCameraCapabilitiesMessageToJausMessage(ReportCameraCapabilitiesMessage message); - -JAUS_EXPORT unsigned int reportCameraCapabilitiesMessageSize(ReportCameraCapabilitiesMessage message); - -#endif // REPORT_CAMERA_CAPABILITIES_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/environment/reportCameraCountMessage.h b/lib/openjaus/libjaus/include/message/inform/environment/reportCameraCountMessage.h deleted file mode 100644 index 654c18253a5bc004bceae3ddd909ac7cc1a8f7eb..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/environment/reportCameraCountMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportCameraCountMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportCameraCountMessage - -#ifndef REPORT_CAMERA_COUNT_MESSAGE_H -#define REPORT_CAMERA_COUNT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte cameraCount; - -}ReportCameraCountMessageStruct; - -typedef ReportCameraCountMessageStruct* ReportCameraCountMessage; - -JAUS_EXPORT ReportCameraCountMessage reportCameraCountMessageCreate(void); -JAUS_EXPORT void reportCameraCountMessageDestroy(ReportCameraCountMessage); - -JAUS_EXPORT JausBoolean reportCameraCountMessageFromBuffer(ReportCameraCountMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportCameraCountMessageToBuffer(ReportCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportCameraCountMessage reportCameraCountMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportCameraCountMessageToJausMessage(ReportCameraCountMessage message); - -JAUS_EXPORT unsigned int reportCameraCountMessageSize(ReportCameraCountMessage message); - -#endif // REPORT_CAMERA_COUNT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/environment/reportCameraFormatOptionsMessage.h b/lib/openjaus/libjaus/include/message/inform/environment/reportCameraFormatOptionsMessage.h deleted file mode 100644 index 3bfc2c7aac4aef97226edd0bda786610e5b954b0..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/environment/reportCameraFormatOptionsMessage.h +++ /dev/null @@ -1,160 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportCameraFormatOptionsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportCameraFormatOptionsMessage - -#ifndef REPORT_CAMERA_FORMAT_OPTIONS_MESSAGE_H -#define REPORT_CAMERA_FORMAT_OPTIONS_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV -#define JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV -#define JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_AUDIO_FORMAT_ONE_BIT 0 -#define JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_AUDIO_FORMAT_TWO_BIT 1 -#define JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_ONE_BIT 2 -#define JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_TWO_BIT 3 -#define JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_THREE_BIT 4 -#define JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_FOUR_BIT 5 -#define JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_FORMAT_OPTIONS_BIT 6 -#endif - -#ifndef JAUS_AUDIO_FORMAT_ENUM -#define JAUS_AUDIO_FORMAT_ENUM -typedef enum -{ - UnusedAudioFormat=0, - RAW_AUDIO=1, - PCM=2, - AU=3, - WAV=4, - MID=5, - MP3=6, - MP2=7, - ASF=8 -}JausAudioFormatEnum; -#endif - -#ifndef JAUS_IMAGE_FORMAT_ENUM -#define JAUS_IMAGE_FORMAT_ENUM -typedef enum -{ - UnusedImageFormat=0, - MPEG2=1, - MPEG4=2, - MJPEG=3, - NTSC=4, - PAL=5, - TIFF=6, - JPEG=7, - GIF=8, - H263=9, - H264=10, - PNG=11, - BMP=12, - RAW_IMAGE=13, - PPM=14, - PGM=15, - PNM=16 -} JausImageFormatEnum; -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; - JausByte cameraID; - JausAudioFormatEnum audioFormat[2]; - JausImageFormatEnum imageFormat[4]; - JausUnsignedInteger formatOption; - -}ReportCameraFormatOptionsMessageStruct; - -typedef ReportCameraFormatOptionsMessageStruct* ReportCameraFormatOptionsMessage; - -JAUS_EXPORT ReportCameraFormatOptionsMessage reportCameraFormatOptionsMessageCreate(void); -JAUS_EXPORT void reportCameraFormatOptionsMessageDestroy(ReportCameraFormatOptionsMessage); - -JAUS_EXPORT JausBoolean reportCameraFormatOptionsMessageFromBuffer(ReportCameraFormatOptionsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportCameraFormatOptionsMessageToBuffer(ReportCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportCameraFormatOptionsMessage reportCameraFormatOptionsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportCameraFormatOptionsMessageToJausMessage(ReportCameraFormatOptionsMessage message); - -JAUS_EXPORT unsigned int reportCameraFormatOptionsMessageSize(ReportCameraFormatOptionsMessage message); - -#endif // REPORT_CAMERA_FORMAT_OPTIONS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/environment/reportCameraPoseMessage.h b/lib/openjaus/libjaus/include/message/inform/environment/reportCameraPoseMessage.h deleted file mode 100644 index 3adb06e40119ef431be846ddcd60ee115db4a508..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/environment/reportCameraPoseMessage.h +++ /dev/null @@ -1,132 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportCameraPoseMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportCameraPoseMessage - -#ifndef REPORT_CAMERA_POSE_MESSAGE_H -#define REPORT_CAMERA_POSE_MESSAGE_H - -#include "jaus.h" - -#define JAUS_CAMERA_NAME_LENGTH_BYTES 15 - -#ifndef JAUS_REPORT_CAMERA_POSE_PV -#define JAUS_REPORT_CAMERA_POSE_PV -#define JAUS_REPORT_CAMERA_POSE_PV_CAMERA_NAME_BIT 0 -#define JAUS_REPORT_CAMERA_POSE_PV_X_ORIGIN_BIT 1 -#define JAUS_REPORT_CAMERA_POSE_PV_Y_ORIGIN_BIT 2 -#define JAUS_REPORT_CAMERA_POSE_PV_Z_ORIGIN_BIT 3 -#define JAUS_REPORT_CAMERA_POSE_PV_X_DIRECTION_COSINE_X 4 -#define JAUS_REPORT_CAMERA_POSE_PV_X_DIRECTION_COSINE_Y 5 -#define JAUS_REPORT_CAMERA_POSE_PV_X_DIRECTION_COSINE_Z 6 -#define JAUS_REPORT_CAMERA_POSE_PV_Z_DIRECTION_COSINE_X 7 -#define JAUS_REPORT_CAMERA_POSE_PV_Z_DIRECTION_COSINE_Y 8 -#define JAUS_REPORT_CAMERA_POSE_PV_Z_DIRECTION_COSINE_Z 9 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausUnsignedShort presenceVector; - JausByte cameraID; - char cameraName[JAUS_CAMERA_NAME_LENGTH_BYTES]; - JausDouble xCameraOriginMeters; // Scaled Short (-32.767, 32.767) - JausDouble yCameraOriginMeters; // Scaled Short (-32.767, 32.767) - JausDouble zCameraOriginMeters; // Scaled Short (-32.767, 32.767) - JausDouble xCameraAxisDirectionCosineX; // Scaled Short (-1.0, 1.0) - JausDouble xCameraAxisDirectionCosineY; // Scaled Short (-1.0, 1.0) - JausDouble xCameraAxisDirectionCosineZ; // Scaled Short (-1.0, 1.0) - JausDouble zCameraAxisDirectionCosineX; // Scaled Short (-1.0, 1.0) - JausDouble zCameraAxisDirectionCosineY; // Scaled Short (-1.0, 1.0) - JausDouble zCameraAxisDirectionCosineZ; // Scaled Short (-1.0, 1.0) - -}ReportCameraPoseMessageStruct; - -typedef ReportCameraPoseMessageStruct* ReportCameraPoseMessage; - -JAUS_EXPORT ReportCameraPoseMessage reportCameraPoseMessageCreate(void); -JAUS_EXPORT void reportCameraPoseMessageDestroy(ReportCameraPoseMessage); - -JAUS_EXPORT JausBoolean reportCameraPoseMessageFromBuffer(ReportCameraPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportCameraPoseMessageToBuffer(ReportCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportCameraPoseMessage reportCameraPoseMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportCameraPoseMessageToJausMessage(ReportCameraPoseMessage message); - -JAUS_EXPORT unsigned int reportCameraPoseMessageSize(ReportCameraPoseMessage message); - -#endif // REPORT_CAMERA_POSE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/environment/reportImageMessage.h b/lib/openjaus/libjaus/include/message/inform/environment/reportImageMessage.h deleted file mode 100644 index d6d5ae33f18d2aade0fcb3de7719dec88b2df338..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/environment/reportImageMessage.h +++ /dev/null @@ -1,109 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportImageMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportImageMessage - -#ifndef REPORT_IMAGE_MESSAGE_H -#define REPORT_IMAGE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - - JausByte cameraID; - JausByte videoFormat; - JausByte *data; // or char* ? - JausUnsignedInteger bufferSizeBytes; - -}ReportImageMessageStruct; - -typedef ReportImageMessageStruct* ReportImageMessage; - -JAUS_EXPORT ReportImageMessage reportImageMessageCreate(void); -JAUS_EXPORT void reportImageMessageDestroy(ReportImageMessage); - -JAUS_EXPORT JausBoolean reportImageMessageFromBuffer(ReportImageMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportImageMessageToBuffer(ReportImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportImageMessage reportImageMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportImageMessageToJausMessage(ReportImageMessage message); - -JAUS_EXPORT unsigned int reportImageMessageSize(ReportImageMessage message); - -#endif // REPORT_IMAGE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/environment/reportRelativeObjectPositionMessage.h b/lib/openjaus/libjaus/include/message/inform/environment/reportRelativeObjectPositionMessage.h deleted file mode 100644 index 40f2d4ca72c95319f6acb18552130ed335937f94..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/environment/reportRelativeObjectPositionMessage.h +++ /dev/null @@ -1,126 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportRelativeObjectPositionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportRelativeObjectPositionMessage - -#ifndef REPORT_RELATIVE_OBJECT_POSITION_MESSAGE_H -#define REPORT_RELATIVE_OBJECT_POSITION_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_RELATIVE_OBJECT_POSITION_PV -#define JAUS_RELATIVE_OBJECT_POSITION_PV -#define JAUS_RELATIVE_OBJECT_POSITION_PV_RANGE_BIT 0 -#define JAUS_RELATIVE_OBJECT_POSITION_PV_RANGE_ERROR_BIT 1 -#define JAUS_RELATIVE_OBJECT_POSITION_PV_BEARING_BIT 2 -#define JAUS_RELATIVE_OBJECT_POSITION_PV_BEARING_ERROR_BIT 3 -#define JAUS_RELATIVE_OBJECT_POSITION_PV_INCLINATION_BIT 4 -#define JAUS_RELATIVE_OBJECT_POSITION_PV_INCLINATION_ERROR_BIT 5 -#define JAUS_RELATIVE_OBJECT_POSITION_PV_CONFIDENCE_BIT 6 -#define JAUS_RELATIVE_OBJECT_POSITION_PV_OBJECT_ID_BIT 6 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; - JausTime time; - JausDouble rangeMeters; // Scaled Int (-10,000, 10,000) - JausDouble rangeErrorMeters; // Scaled UInt (0, 1000) - JausDouble bearingRadians; // Scaled Int (-JAUS_PI, JAUS_PI) - JausDouble bearingErrorRadians; // Scaled UInt (0, JAUS_PI) - JausDouble inclinationRadians; // Scaled Int (-JAUS_PI, JAUS_PI) - JausDouble inclinationErrorRadians; // Scaled UInt (0, JAUS_PI) - JausByte confidence; - JausUnsignedShort objectId; - -}ReportRelativeObjectPositionMessageStruct; - -typedef ReportRelativeObjectPositionMessageStruct* ReportRelativeObjectPositionMessage; - -JAUS_EXPORT ReportRelativeObjectPositionMessage reportRelativeObjectPositionMessageCreate(void); -JAUS_EXPORT void reportRelativeObjectPositionMessageDestroy(ReportRelativeObjectPositionMessage); - -JAUS_EXPORT JausBoolean reportRelativeObjectPositionMessageFromBuffer(ReportRelativeObjectPositionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportRelativeObjectPositionMessageToBuffer(ReportRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportRelativeObjectPositionMessage reportRelativeObjectPositionMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportRelativeObjectPositionMessageToJausMessage(ReportRelativeObjectPositionMessage message); - -JAUS_EXPORT unsigned int reportRelativeObjectPositionMessageSize(ReportRelativeObjectPositionMessage message); - -#endif // REPORT_RELATIVE_OBJECT_POSITION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/environment/reportSelectedCameraMessage.h b/lib/openjaus/libjaus/include/message/inform/environment/reportSelectedCameraMessage.h deleted file mode 100644 index 78db161aa6f294f3ac4917b8270975697a6e7409..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/environment/reportSelectedCameraMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportSelectedCameraMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportSelectedCameraMessage - -#ifndef REPORT_SELECTED_CAMERA_MESSAGE_H -#define REPORT_SELECTED_CAMERA_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte cameraID; - -}ReportSelectedCameraMessageStruct; - -typedef ReportSelectedCameraMessageStruct* ReportSelectedCameraMessage; - -JAUS_EXPORT ReportSelectedCameraMessage reportSelectedCameraMessageCreate(void); -JAUS_EXPORT void reportSelectedCameraMessageDestroy(ReportSelectedCameraMessage); - -JAUS_EXPORT JausBoolean reportSelectedCameraMessageFromBuffer(ReportSelectedCameraMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportSelectedCameraMessageToBuffer(ReportSelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportSelectedCameraMessage reportSelectedCameraMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportSelectedCameraMessageToJausMessage(ReportSelectedCameraMessage message); - -JAUS_EXPORT unsigned int reportSelectedCameraMessageSize(ReportSelectedCameraMessage message); - -#endif // REPORT_SELECTED_CAMERA_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/event/eventMessage.h b/lib/openjaus/libjaus/include/message/inform/event/eventMessage.h deleted file mode 100644 index 0580f352e7b1243ce7bdd0772d978251c4535c8a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/event/eventMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: eventMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 11/2/05 -// -// This file defines the attributes of a EventMessage - -#ifndef EVENT_MESSAGE_H -#define EVENT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte eventId; // ID of event to be updated - JausByte eventSequenceNumber; // Sequential count of the number of times the event has occured - JausMessage reportMessage; // Report message of event -}EventMessageStruct; - -typedef EventMessageStruct* EventMessage; - -JAUS_EXPORT EventMessage eventMessageCreate(void); -JAUS_EXPORT void eventMessageDestroy(EventMessage); - -JAUS_EXPORT JausBoolean eventMessageFromBuffer(EventMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean eventMessageToBuffer(EventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT EventMessage eventMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage eventMessageToJausMessage(EventMessage message); - -JAUS_EXPORT unsigned int eventMessageSize(EventMessage message); - -#endif // EVENT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/event/reportEventsMessage.h b/lib/openjaus/libjaus/include/message/inform/event/reportEventsMessage.h deleted file mode 100644 index 6c8b1c0b3d149d39d0f05f89462f367cd2e1209f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/event/reportEventsMessage.h +++ /dev/null @@ -1,152 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportEventsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 11/2/05 -// -// This file defines the attributes of a ReportEventsMessage - -#ifndef REPORT_EVENTS_MESSAGE_H -#define REPORT_EVENTS_MESSAGE_H - -#include "jaus.h" - -// PV as defined in v3.3 -#ifndef REPORT_EVENTS_PV -#define REPORT_EVENTS_PV_BOUNDARY_BIT 0 // Field 5 -#define REPORT_EVENTS_PV_DATA_FIELD_BIT 1 // Field 6 -#define REPORT_EVENTS_PV_LOWER_LIMIT_BIT 2 // Field 7/8 -#define REPORT_EVENTS_PV_UPPER_LIMIT_BIT 3 // Field 9/10 -#define REPORT_EVENTS_PV_STATE_LIMIT_BIT 4 // Field 11/12 -#define REPORT_EVENTS_PV_EVENT_ID_BIT 5 // Field 15/16 -#define REPORT_EVENTS_PV_QUERY_MESSAGE_BIT 6 // Field 15/16 - -#endif - -// Event Types -#ifndef EVENT_TYPES -#define EVENT_TYPES -#define EVENT_PERIODIC_TYPE 0 -#define EVENT_EVERY_CHANGE_TYPE 1 -#define EVENT_FIRST_CHANGE_TYPE 2 -#define EVENT_FIRST_CHANGE_IN_AND_OUT_TYPE 3 -#define EVENT_PERIODIC_NO_REPEAT_TYPE 4 -#define EVENT_ONE_TIME_ON_DEMAND_TYPE 5 -#endif - -// Event Boundaries -#ifndef EVENT_BOUNDARIES -#define EVENT_BOUNDARIES -#define EQUAL_BOUNDARY 0 -#define NOT_EQUAL_BOUNDARY 1 -#define INSIDE_INCLUSIVE_BOUNDARY 2 -#define INSIDE_EXCLUSIVE_BOUNDARY 3 -#define OUTSIDE_INCLUSIVE_BOUNDARY 4 -#define OUTSIDE_EXCLUSIVE_BOUNDARY 5 -#define GREATER_THAN_OR_EQUAL_BOUNDARY 6 -#define GREATER_THAN_BOUNDARY 7 -#define LESS_THAN_OR_EQUAL_BOUNDARY 8 -#define LESS_THAN_BOUNDARY 9 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte count; // Number of events reported - JausByte *presenceVector; // Presence Vector - JausUnsignedShort *messageCode; // Command Code of the resulting query - JausByte *eventType; // Enumeration of Event types - JausByte *eventBoundary; // Enumeration of Event Boundary Conditions - JausByte *limitDataField; // Field from Report for Limit Trigger - JausEventLimit *lowerLimit; // Lower Event Limit - JausEventLimit *upperLimit; // Upper Event Limit - JausEventLimit *stateLimit; // State Event Limit used for Equal Boundary - JausByte *eventId; // ID of event to be updated - JausMessage *queryMessage; // Array to Query Messages (including header) to use for response -}ReportEventsMessageStruct; - -typedef ReportEventsMessageStruct* ReportEventsMessage; - -JAUS_EXPORT ReportEventsMessage reportEventsMessageCreate(void); -JAUS_EXPORT void reportEventsMessageDestroy(ReportEventsMessage); - -JAUS_EXPORT JausBoolean reportEventsMessageFromBuffer(ReportEventsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportEventsMessageToBuffer(ReportEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportEventsMessage reportEventsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportEventsMessageToJausMessage(ReportEventsMessage message); - -JAUS_EXPORT unsigned int reportEventsMessageSize(ReportEventsMessage message); - -#endif // REPORT_EVENTS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/manipulator/reportJointEffortsMessage.h b/lib/openjaus/libjaus/include/message/inform/manipulator/reportJointEffortsMessage.h deleted file mode 100644 index 3f5ab4c7e457bedbd512340b629a8417172491c4..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/manipulator/reportJointEffortsMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportJointEffortsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportJointEffortsMessage - -#ifndef REPORT_JOINT_EFFORTS_MESSAGE_H -#define REPORT_JOINT_EFFORTS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte numJoints; - - JausDouble *jointEffort; - -}ReportJointEffortsMessageStruct; - -typedef ReportJointEffortsMessageStruct* ReportJointEffortsMessage; - -JAUS_EXPORT ReportJointEffortsMessage reportJointEffortsMessageCreate(void); -JAUS_EXPORT void reportJointEffortsMessageDestroy(ReportJointEffortsMessage); - -JAUS_EXPORT JausBoolean reportJointEffortsMessageFromBuffer(ReportJointEffortsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportJointEffortsMessageToBuffer(ReportJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportJointEffortsMessage reportJointEffortsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportJointEffortsMessageToJausMessage(ReportJointEffortsMessage message); - -JAUS_EXPORT unsigned int reportJointEffortsMessageSize(ReportJointEffortsMessage message); - -#endif // REPORT_JOINT_EFFORTS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/manipulator/reportJointForceTorquesMessage.h b/lib/openjaus/libjaus/include/message/inform/manipulator/reportJointForceTorquesMessage.h deleted file mode 100644 index 0a6b412e58fad579dd7bc5097362620e1e627609..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/manipulator/reportJointForceTorquesMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportJointForceTorquesMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportJointForceTorquesMessage - -#ifndef REPORT_JOINT_FORCE_TORQUES_MESSAGE_H -#define REPORT_JOINT_FORCE_TORQUES_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte numJoints; - - JausDouble *jointForceTorque; - -}ReportJointForceTorquesMessageStruct; - -typedef ReportJointForceTorquesMessageStruct* ReportJointForceTorquesMessage; - -JAUS_EXPORT ReportJointForceTorquesMessage reportJointForceTorquesMessageCreate(void); -JAUS_EXPORT void reportJointForceTorquesMessageDestroy(ReportJointForceTorquesMessage); - -JAUS_EXPORT JausBoolean reportJointForceTorquesMessageFromBuffer(ReportJointForceTorquesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportJointForceTorquesMessageToBuffer(ReportJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportJointForceTorquesMessage reportJointForceTorquesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportJointForceTorquesMessageToJausMessage(ReportJointForceTorquesMessage message); - -JAUS_EXPORT unsigned int reportJointForceTorquesMessageSize(ReportJointForceTorquesMessage message); - -#endif // REPORT_JOINT_FORCE_TORQUES_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/manipulator/reportJointPositionsMessage.h b/lib/openjaus/libjaus/include/message/inform/manipulator/reportJointPositionsMessage.h deleted file mode 100644 index 8273d10d5778f168e40fbf32ee711442a1a71f2a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/manipulator/reportJointPositionsMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportJointPositionsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportJointPositionsMessage - -#ifndef REPORT_JOINT_POSITIONS_MESSAGE_H -#define REPORT_JOINT_POSITIONS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte numJoints; - - JausDouble *jointPosition; - -}ReportJointPositionsMessageStruct; - -typedef ReportJointPositionsMessageStruct* ReportJointPositionsMessage; - -JAUS_EXPORT ReportJointPositionsMessage reportJointPositionsMessageCreate(void); -JAUS_EXPORT void reportJointPositionsMessageDestroy(ReportJointPositionsMessage); - -JAUS_EXPORT JausBoolean reportJointPositionsMessageFromBuffer(ReportJointPositionsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportJointPositionsMessageToBuffer(ReportJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportJointPositionsMessage reportJointPositionsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportJointPositionsMessageToJausMessage(ReportJointPositionsMessage message); - -JAUS_EXPORT unsigned int reportJointPositionsMessageSize(ReportJointPositionsMessage message); - -#endif // REPORT_JOINT_POSITIONS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/manipulator/reportJointVelocitiesMessage.h b/lib/openjaus/libjaus/include/message/inform/manipulator/reportJointVelocitiesMessage.h deleted file mode 100644 index f7cd7ddf62941c4fe84e1443bbe11732c374653e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/manipulator/reportJointVelocitiesMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportJointVelocitiesMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportJointVelocitiesMessage - -#ifndef REPORT_JOINT_VELOCITIES_MESSAGE_H -#define REPORT_JOINT_VELOCITIES_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte numJoints; - - JausDouble *jointVelocity; - -}ReportJointVelocitiesMessageStruct; - -typedef ReportJointVelocitiesMessageStruct* ReportJointVelocitiesMessage; - -JAUS_EXPORT ReportJointVelocitiesMessage reportJointVelocitiesMessageCreate(void); -JAUS_EXPORT void reportJointVelocitiesMessageDestroy(ReportJointVelocitiesMessage); - -JAUS_EXPORT JausBoolean reportJointVelocitiesMessageFromBuffer(ReportJointVelocitiesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportJointVelocitiesMessageToBuffer(ReportJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportJointVelocitiesMessage reportJointVelocitiesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportJointVelocitiesMessageToJausMessage(ReportJointVelocitiesMessage message); - -JAUS_EXPORT unsigned int reportJointVelocitiesMessageSize(ReportJointVelocitiesMessage message); - -#endif // REPORT_JOINT_VELOCITIES_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/manipulator/reportManipulatorSpecificationsMessage.h b/lib/openjaus/libjaus/include/message/inform/manipulator/reportManipulatorSpecificationsMessage.h deleted file mode 100644 index 3fc06da9dacbff11cfc42fa18ab3e76218747f5f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/manipulator/reportManipulatorSpecificationsMessage.h +++ /dev/null @@ -1,120 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportManipulatorSpecificationsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportManipulatorSpecificationsMessage - -#ifndef REPORT_MANIPULATOR_SPECIFICATIONS_MESSAGE_H -#define REPORT_MANIPULATOR_SPECIFICATIONS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - - JausByte numJoints; - JausByte *jointType; - JausDouble *jointOffset; - JausDouble *linkLength; - JausDouble *twistAngle; - JausDouble *jointMinValue; - JausDouble *jointMaxValue; - JausDouble *jointMaxVelocity; - JausDouble coordinateSysX; - JausDouble coordinateSysY; - JausDouble coordinateSysZ; - JausDouble coordinateSysA; - JausDouble coordinateSysB; - JausDouble coordinateSysC; - JausDouble coordinateSysD; - -}ReportManipulatorSpecificationsMessageStruct; - -typedef ReportManipulatorSpecificationsMessageStruct* ReportManipulatorSpecificationsMessage; - -JAUS_EXPORT ReportManipulatorSpecificationsMessage reportManipulatorSpecificationsMessageCreate(void); -JAUS_EXPORT void reportManipulatorSpecificationsMessageDestroy(ReportManipulatorSpecificationsMessage); - -JAUS_EXPORT JausBoolean reportManipulatorSpecificationsMessageFromBuffer(ReportManipulatorSpecificationsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportManipulatorSpecificationsMessageToBuffer(ReportManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportManipulatorSpecificationsMessage reportManipulatorSpecificationsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportManipulatorSpecificationsMessageToJausMessage(ReportManipulatorSpecificationsMessage message); - -JAUS_EXPORT unsigned int reportManipulatorSpecificationsMessageSize(ReportManipulatorSpecificationsMessage message); - -#endif // REPORT_MANIPULATOR_SPECIFICATIONS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/manipulator/reportToolPointMessage.h b/lib/openjaus/libjaus/include/message/inform/manipulator/reportToolPointMessage.h deleted file mode 100644 index 260379654962e5c8973ff3de5135792e8fe49336..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/manipulator/reportToolPointMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportToolPointMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportToolPointMessage - -#ifndef REPORT_TOOL_POINT_MESSAGE_H -#define REPORT_TOOL_POINT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausDouble x; - JausDouble y; - JausDouble z; - -}ReportToolPointMessageStruct; - -typedef ReportToolPointMessageStruct* ReportToolPointMessage; - -JAUS_EXPORT ReportToolPointMessage reportToolPointMessageCreate(void); -JAUS_EXPORT void reportToolPointMessageDestroy(ReportToolPointMessage); - -JAUS_EXPORT JausBoolean reportToolPointMessageFromBuffer(ReportToolPointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportToolPointMessageToBuffer(ReportToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportToolPointMessage reportToolPointMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportToolPointMessageToJausMessage(ReportToolPointMessage message); - -JAUS_EXPORT unsigned int reportToolPointMessageSize(ReportToolPointMessage message); - -#endif // REPORT_TOOL_POINT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/payload/reportPayloadDataElementMessage.h b/lib/openjaus/libjaus/include/message/inform/payload/reportPayloadDataElementMessage.h deleted file mode 100644 index abc4bd46616b58fba0c7d36210a57cec9e4fd665..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/payload/reportPayloadDataElementMessage.h +++ /dev/null @@ -1,111 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportPayloadDataElementMessage.h -// -// Written By: Bob Touchton -// -// Version: 3.3.0a -// -// Date: 3/20/06 -// -// This file defines the attributes of a reportPayloadDataElementMessage -// NOTE WELL: this message will also be used for general purpose information exchange - -#ifndef REPORT_PAYLOAD_DATA_ELEMENT_MESSAGE_H -#define REPORT_PAYLOAD_DATA_ELEMENT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - //message-specific fields - JausPayloadInterface jausPayloadInterface; - int numberInterfaces; - int* indexes; - -}ReportPayloadDataElementMessageStruct; - -typedef ReportPayloadDataElementMessageStruct* ReportPayloadDataElementMessage; - -JAUS_EXPORT ReportPayloadDataElementMessage reportPayloadDataElementMessageCreate(void); -JAUS_EXPORT void reportPayloadDataElementMessageDestroy(ReportPayloadDataElementMessage); - -JAUS_EXPORT JausBoolean reportPayloadDataElementMessageFromBuffer(ReportPayloadDataElementMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportPayloadDataElementMessageToBuffer(ReportPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportPayloadDataElementMessage reportPayloadDataElementMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportPayloadDataElementMessageToJausMessage(ReportPayloadDataElementMessage message); - -JAUS_EXPORT unsigned int reportPayloadDataElementMessageSize(ReportPayloadDataElementMessage message); - -#endif - - - - diff --git a/lib/openjaus/libjaus/include/message/inform/payload/reportPayloadInterfaceMessage.h b/lib/openjaus/libjaus/include/message/inform/payload/reportPayloadInterfaceMessage.h deleted file mode 100644 index 9dac2753c5b1f785a0220075ddccbddedd976b53..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/payload/reportPayloadInterfaceMessage.h +++ /dev/null @@ -1,109 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportPayloadInterfaceMessage.h -// -// Written By: Bob Touchton -// -// Version: 3.3.0a -// -// Date: 3/13/06 -// -// This file defines the attributes of a ReportPayloadInterfaceMessage -// NOTE WELL: this message will also be used for general purpose information exchange - -#ifndef REPORT_PAYLOAD_INTERFACE_MESSAGE_H -#define REPORT_PAYLOAD_INTERFACE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - //message-specific fields - JausPayloadInterface jausPayloadInterface; - -}ReportPayloadInterfaceMessageStruct; - -typedef ReportPayloadInterfaceMessageStruct* ReportPayloadInterfaceMessage; - -JAUS_EXPORT ReportPayloadInterfaceMessage reportPayloadInterfaceMessageCreate(void); -JAUS_EXPORT void reportPayloadInterfaceMessageDestroy(ReportPayloadInterfaceMessage); - -JAUS_EXPORT JausBoolean reportPayloadInterfaceMessageFromBuffer(ReportPayloadInterfaceMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportPayloadInterfaceMessageToBuffer(ReportPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportPayloadInterfaceMessage reportPayloadInterfaceMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportPayloadInterfaceMessageToJausMessage(ReportPayloadInterfaceMessage message); - -JAUS_EXPORT unsigned int reportPayloadInterfaceMessageSize(ReportPayloadInterfaceMessage message); - -#endif - - - - diff --git a/lib/openjaus/libjaus/include/message/inform/planning/reportMissionStatusMessage.h b/lib/openjaus/libjaus/include/message/inform/planning/reportMissionStatusMessage.h deleted file mode 100644 index 6dd6dbff18f36dee4268b3650c3bfee3157e4fc5..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/planning/reportMissionStatusMessage.h +++ /dev/null @@ -1,153 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportMissionStatusMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportMissionStatusMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/09/08 - -#ifndef REPORT_MISSION_STATUS_MESSAGE_H -#define REPORT_MISSION_STATUS_MESSAGE_H - -#include "jaus.h" - - - - -/** - * These defines identify mission message types and status per RA 3.3. - */ -// Mission Types: non-redundant declaration -#ifndef JAUS_MISSION_TYPES -#define JAUS_MISSION_TYPES -#define JAUS_MISSION 0 -#define JAUS_TASK 1 -#define JAUS_MESSAGE 2 -#endif -//Mission primary status types: non-redundant declaration -#ifndef JAUS_MISSION_PRIMARY_STATUS_TYPES -#define JAUS_MISSION_PRIMARY_STATUS_TYPES -#define JAUS_SPOOLING 0 -#define JAUS_PENDING 1 -#define JAUS_PAUSED 2 -#define JAUS_ABORTED 3 -#define JAUS_FINISHED 4 -#endif -//Mission secondary status types: non-redundant declaration -#ifndef JAUS_MISSION_SECONDARY_STATUS_TYPES -#define JAUS_MISSION_SECONDARY_STATUS_TYPES -#define JAUS_NON_ERROR_COND 0 -#define JAUS_LOST_CMPT_CONTROL 1 -#define JAUS_TOLERANCE_NOT_MET 2 -#endif - - - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS - JausByte type; //see MISSION_TYPES - JausByte status; //see MISSION_PRIMARY_STATUS_TYPES - JausByte secondaryStatus; //see MISSION_SECONDARY_STATUS_TYPES - JausUnsignedShort missionId; //unique Mission ID to be aborted - JausUnsignedShort taskId; //unique Task ID to be reported. If type = 0 - //then taskId = 0. - JausUnsignedShort taskMsgId; //unique message ID in Task - -}ReportMissionStatusMessageStruct; - -typedef ReportMissionStatusMessageStruct* ReportMissionStatusMessage; - -JAUS_EXPORT ReportMissionStatusMessage reportMissionStatusMessageCreate(void); -JAUS_EXPORT void reportMissionStatusMessageDestroy(ReportMissionStatusMessage); - -JAUS_EXPORT JausBoolean reportMissionStatusMessageFromBuffer - (ReportMissionStatusMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportMissionStatusMessageToBuffer - (ReportMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportMissionStatusMessage reportMissionStatusMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportMissionStatusMessageToJausMessage - (ReportMissionStatusMessage message); - -JAUS_EXPORT unsigned int reportMissionStatusMessageSize(ReportMissionStatusMessage message); - -#endif // REPORT_MISSION_STATUS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/planning/reportSpoolingPreferenceMessage.h b/lib/openjaus/libjaus/include/message/inform/planning/reportSpoolingPreferenceMessage.h deleted file mode 100644 index d2478181301d2d2e9d5c472dd5fb5688514078ae..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/planning/reportSpoolingPreferenceMessage.h +++ /dev/null @@ -1,117 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportSpoolingPreferenceMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportSpoolingPreferenceMessage - -#ifndef REPORT_SPOOLING_PREFERENCE_MESSAGE_H -#define REPORT_SPOOLING_PREFERENCE_MESSAGE_H - -#include "jaus.h" - -// Spool Types -#ifndef JAUS_SPOOL_TYPES -#define JAUS_SPOOL_TYPES -#define JAUS_SPOOL_COUNT_TYPE 0 -#define JAUS_SPOOL_DISTANCE_TYPE 1 -#define JAUS_SPOOL_TIME_TYPE 2 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - //Declares what type of limit to place on spooling message count, distance, or time - JausByte spoolType; - //The limit on spooling either the number of messages, the number of meters, - // or the number of seconds based on spoolType - JausInteger data; - -}ReportSpoolingPreferenceMessageStruct; - -typedef ReportSpoolingPreferenceMessageStruct* ReportSpoolingPreferenceMessage; - -JAUS_EXPORT ReportSpoolingPreferenceMessage reportSpoolingPreferenceMessageCreate(void); -JAUS_EXPORT void reportSpoolingPreferenceMessageDestroy(ReportSpoolingPreferenceMessage); - -JAUS_EXPORT JausBoolean reportSpoolingPreferenceMessageFromBuffer(ReportSpoolingPreferenceMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportSpoolingPreferenceMessageToBuffer(ReportSpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportSpoolingPreferenceMessage reportSpoolingPreferenceMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportSpoolingPreferenceMessageToJausMessage(ReportSpoolingPreferenceMessage message); - -JAUS_EXPORT unsigned int reportSpoolingPreferenceMessageSize(ReportSpoolingPreferenceMessage message); - -#endif // REPORT_SPOOLING_PREFERENCE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportDiscreteDevicesMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportDiscreteDevicesMessage.h deleted file mode 100644 index fdcfe0b19360d58a12c3f9d2548288a58d6fe05f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportDiscreteDevicesMessage.h +++ /dev/null @@ -1,147 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportDiscreteDevicesMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportDiscreteDevicesMessage - -#ifndef REPORT_DISCRETE_DEVICES_MESSAGE_H -#define REPORT_DISCRETE_DEVICES_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_DEVICES_PV -#define JAUS_DEVICES_PV -#define JAUS_DEVICES_PV_PROPULSION_BIT 0 -#define JAUS_DEVICES_PV_PARKING_BIT 1 -#define JAUS_DEVICES_PV_GEAR_BIT 2 -#define JAUS_DEVICES_PV_TRANSFER_BIT 3 -#endif - -#ifndef JAUS_DEVICES_PROPULSION_BF -#define JAUS_DEVICES_PROPULSION_BF -#define JAUS_DEVICES_PROPULSION_BF_MAIN_POWER_BIT 0 -#define JAUS_DEVICES_PROPULSION_BF_MAIN_FUEL_BIT 1 -#define JAUS_DEVICES_PROPULSION_BF_AUXILARY_FUEL_BIT 2 -#define JAUS_DEVICES_PROPULSION_BF_AUXILARY_POWER_BIT 3 -#define JAUS_DEVICES_PROPULSION_BF_STARTING_DEVICE_BIT 4 -#define JAUS_DEVICES_PROPULSION_BF_COLD_START_BIT 5 -#define JAUS_DEVICES_PROPULSION_BF_AUTO_START_BIT 6 -#define JAUS_DEVICES_PROPULSION_BF_AUTO_SHUTDOWN_BIT 7 -#endif - -#ifndef JAUS_DEVICES_OTHER_BF -#define JAUS_DEVICES_OTHER_BF -#define JAUS_DEVICES_OTHER_BF_PARKING_BRAKE_BIT 0 -#define JAUS_DEVICES_OTHER_BF_HORN_BIT 1 -#endif - - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausByte gear; - JausByte transferCase; - - // Main Propulsion - JausBoolean mainPropulsion; - JausBoolean mainFuelSupply; - JausBoolean auxFuelSupply; - JausBoolean powerAuxDevices; - JausBoolean startingDevice; - JausBoolean coldStart; - JausBoolean automaticStart; - JausBoolean automaticStop; - - // Parking, Brake and Horn - JausBoolean parkingBrake; - JausBoolean horn; - -}ReportDiscreteDevicesMessageStruct; - -typedef ReportDiscreteDevicesMessageStruct* ReportDiscreteDevicesMessage; - -JAUS_EXPORT ReportDiscreteDevicesMessage reportDiscreteDevicesMessageCreate(void); -JAUS_EXPORT void reportDiscreteDevicesMessageDestroy(ReportDiscreteDevicesMessage); - -JAUS_EXPORT JausBoolean reportDiscreteDevicesMessageFromBuffer(ReportDiscreteDevicesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportDiscreteDevicesMessageToBuffer(ReportDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportDiscreteDevicesMessage reportDiscreteDevicesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportDiscreteDevicesMessageToJausMessage(ReportDiscreteDevicesMessage message); - -JAUS_EXPORT unsigned int reportDiscreteDevicesMessageSize(ReportDiscreteDevicesMessage message); - -#endif // REPORT_DISCRETE_DEVICES_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportGlobalPathSegmentMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportGlobalPathSegmentMessage.h deleted file mode 100644 index 27175d85dd62d4d3e6657546a6b8072bceebb731..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportGlobalPathSegmentMessage.h +++ /dev/null @@ -1,118 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportGlobalPathSegmentMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportGlobalPathSegmentMessage - -#ifndef REPORT_GLOBAL_PATH_SEGMENT_MESSAGE_H -#define REPORT_GLOBAL_PATH_SEGMENT_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_PATH_SEGMENT_PV -#define JAUS_PATH_SEGMENT_PV -#define JAUS_PATH_SEGMENT_PV_P1_ALTITUDE_BIT 0 -#define JAUS_PATH_SEGMENT_PV_P2_ALTITUDE_BIT 1 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausUnsignedShort pathSegmentNumber; - JausDouble p1LatitudeDeg; // Scaled Integer (-90, 90) - JausDouble p1LongitudeDeg; // Scaled Integer (-180, 180) - JausDouble p1AltitudeM; // Scaled Integer (-10000, 35000) - JausDouble p2LatitudeDeg; // Scaled Integer (-90, 90) - JausDouble p2LongitudeDeg; // Scaled Integer (-180, 180) - JausDouble p2AltitudeM; // Scaled Integer (-10000, 35000) - JausDouble weightingFactor; // Scaled Unsigned Short (0, 500) - -}ReportGlobalPathSegmentMessageStruct; - -typedef ReportGlobalPathSegmentMessageStruct* ReportGlobalPathSegmentMessage; - -JAUS_EXPORT ReportGlobalPathSegmentMessage reportGlobalPathSegmentMessageCreate(void); -JAUS_EXPORT void reportGlobalPathSegmentMessageDestroy(ReportGlobalPathSegmentMessage); - -JAUS_EXPORT JausBoolean reportGlobalPathSegmentMessageFromBuffer(ReportGlobalPathSegmentMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportGlobalPathSegmentMessageToBuffer(ReportGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportGlobalPathSegmentMessage reportGlobalPathSegmentMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportGlobalPathSegmentMessageToJausMessage(ReportGlobalPathSegmentMessage message); - -JAUS_EXPORT unsigned int reportGlobalPathSegmentMessageSize(ReportGlobalPathSegmentMessage message); - -#endif // REPORT_GLOBAL_PATH_SEGMENT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportGlobalPoseMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportGlobalPoseMessage.h deleted file mode 100644 index 11e1518d6cc315169d7e66b862aec4d4ae3c5ea0..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportGlobalPoseMessage.h +++ /dev/null @@ -1,126 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportGlobalPoseMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportGlobalPoseMessage - -#ifndef REPORT_GLOBAL_POSE_MESSAGE_H -#define REPORT_GLOBAL_POSE_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_POSE_PV -#define JAUS_POSE_PV -#define JAUS_POSE_PV_LATITUDE_BIT 0 -#define JAUS_POSE_PV_LONGITUDE_BIT 1 -#define JAUS_POSE_PV_ELEVATION_BIT 2 -#define JAUS_POSE_PV_POSITION_RMS_BIT 3 -#define JAUS_POSE_PV_ROLL_BIT 4 -#define JAUS_POSE_PV_PITCH_BIT 5 -#define JAUS_POSE_PV_YAW_BIT 6 -#define JAUS_POSE_PV_ATTITUDE_RMS_BIT 7 -#define JAUS_POSE_PV_TIME_STAMP_BIT 8 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort presenceVector; - JausDouble latitudeDegrees; // Scaled Int (-90, 90) - JausDouble longitudeDegrees; // Scaled Int (-180, 180) - JausDouble elevationMeters; // Scaled Int (-10000, 35000) - JausDouble positionRmsMeters; // Scaled UInt (0, 100) - JausDouble rollRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble attitudeRmsRadians; // Scaled Short (0, JAUS_PI) - JausTime time; - -}ReportGlobalPoseMessageStruct; - -typedef ReportGlobalPoseMessageStruct* ReportGlobalPoseMessage; - -JAUS_EXPORT ReportGlobalPoseMessage reportGlobalPoseMessageCreate(void); -JAUS_EXPORT void reportGlobalPoseMessageDestroy(ReportGlobalPoseMessage); - -JAUS_EXPORT JausBoolean reportGlobalPoseMessageFromBuffer(ReportGlobalPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportGlobalPoseMessageToBuffer(ReportGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportGlobalPoseMessage reportGlobalPoseMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportGlobalPoseMessageToJausMessage(ReportGlobalPoseMessage message); - -JAUS_EXPORT unsigned int reportGlobalPoseMessageSize(ReportGlobalPoseMessage message); - -#endif // REPORT_GLOBAL_POSE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportGlobalVectorMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportGlobalVectorMessage.h deleted file mode 100644 index cd6c3f3bb78e31971bd30adc00233c286babb3f3..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportGlobalVectorMessage.h +++ /dev/null @@ -1,118 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportGlobalVectorMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportGlobalVectorMessage - -#ifndef REPORT_GLOBAL_VECTOR_MESSAGE_H -#define REPORT_GLOBAL_VECTOR_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_VECTOR_PV -#define JAUS_VECTOR_PV -#define JAUS_VECTOR_PV_SPEED_BIT 0 -#define JAUS_VECTOR_PV_ALTITUDE_BIT 1 -#define JAUS_VECTOR_PV_HEADING_BIT 2 -#define JAUS_VECTOR_PV_ROLL_BIT 3 -#define JAUS_VECTOR_PV_PITCH_BIT 4 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausDouble speedMps; // Scaled Unsigned Short (0, 10000) Mps = Meters Per Second - JausDouble altitudeMeters; // Scaled Integer (-10000, 35000) - JausDouble headingRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble rollRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - -}ReportGlobalVectorMessageStruct; - -typedef ReportGlobalVectorMessageStruct* ReportGlobalVectorMessage; - -JAUS_EXPORT ReportGlobalVectorMessage reportGlobalVectorMessageCreate(void); -JAUS_EXPORT void reportGlobalVectorMessageDestroy(ReportGlobalVectorMessage); - -JAUS_EXPORT JausBoolean reportGlobalVectorMessageFromBuffer(ReportGlobalVectorMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportGlobalVectorMessageToBuffer(ReportGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportGlobalVectorMessage reportGlobalVectorMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportGlobalVectorMessageToJausMessage(ReportGlobalVectorMessage message); - -JAUS_EXPORT unsigned int reportGlobalVectorMessageSize(ReportGlobalVectorMessage message); - -#endif // REPORT_GLOBAL_VECTOR_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportGlobalWaypointMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportGlobalWaypointMessage.h deleted file mode 100644 index 856353436660316e99124a71ddb47a09f8487fad..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportGlobalWaypointMessage.h +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportGlobalWaypointMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportGlobalWaypointMessage - -#ifndef REPORT_GLOBAL_WAYPOINT_MESSAGE_H -#define REPORT_GLOBAL_WAYPOINT_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_WAYPOINT_PV -#define JAUS_WAYPOINT_PV -#define JAUS_WAYPOINT_PV_ELEVATION_BIT 0 -#define JAUS_WAYPOINT_PV_ROLL_BIT 1 -#define JAUS_WAYPOINT_PV_PITCH_BIT 2 -#define JAUS_WAYPOINT_PV_YAW_BIT 3 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausUnsignedShort waypointNumber; - JausDouble latitudeDegrees; // Scaled Integer (-90, 90) - JausDouble longitudeDegrees; // Scaled Integer (-180, 180) - JausDouble elevationMeters; // Scaled Integer (-10000, 35000) - JausDouble rollRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - -}ReportGlobalWaypointMessageStruct; - -typedef ReportGlobalWaypointMessageStruct* ReportGlobalWaypointMessage; - -JAUS_EXPORT ReportGlobalWaypointMessage reportGlobalWaypointMessageCreate(void); -JAUS_EXPORT void reportGlobalWaypointMessageDestroy(ReportGlobalWaypointMessage); - -JAUS_EXPORT JausBoolean reportGlobalWaypointMessageFromBuffer(ReportGlobalWaypointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportGlobalWaypointMessageToBuffer(ReportGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportGlobalWaypointMessage reportGlobalWaypointMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportGlobalWaypointMessageToJausMessage(ReportGlobalWaypointMessage message); - -JAUS_EXPORT unsigned int reportGlobalWaypointMessageSize(ReportGlobalWaypointMessage message); - -#endif // REPORT_GLOBAL_WAYPOINT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportLocalPathSegmentMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportLocalPathSegmentMessage.h deleted file mode 100644 index dd7084c409c054243557fd16e1063e07d853ea1f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportLocalPathSegmentMessage.h +++ /dev/null @@ -1,118 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportLocalPathSegmentMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportLocalPathSegmentMessage - -#ifndef REPORT_LOCAL_PATH_SEGMENT_MESSAGE_H -#define REPORT_LOCAL_PATH_SEGMENT_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_LOCAL_PATH_SEGMENT_PV -#define JAUS_LOCAL_PATH_SEGMENT_PV -#define JAUS_LOCAL_PATH_SEGMENT_PV_P1_Z_BIT 0 -#define JAUS_LOCAL_PATH_SEGMENT_PV_P2_Z_BIT 1 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausUnsignedShort pathSegmentNumber; - JausDouble p1XM; // Scaled Integer (-100000, 100000) - JausDouble p1YM; // Scaled Integer (-100000, 100000) - JausDouble p1ZM; // Scaled Integer (-10000, 35000) - JausDouble p2XM; // Scaled Integer (-100000, 100000) - JausDouble p2YM; // Scaled Integer (-100000, 100000) - JausDouble p2ZM; // Scaled Integer (-10000, 35000) - JausDouble weightingFactor; // Scaled Unsigned Short (0, 500) - -}ReportLocalPathSegmentMessageStruct; - -typedef ReportLocalPathSegmentMessageStruct* ReportLocalPathSegmentMessage; - -JAUS_EXPORT ReportLocalPathSegmentMessage reportLocalPathSegmentMessageCreate(void); -JAUS_EXPORT void reportLocalPathSegmentMessageDestroy(ReportLocalPathSegmentMessage); - -JAUS_EXPORT JausBoolean reportLocalPathSegmentMessageFromBuffer(ReportLocalPathSegmentMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportLocalPathSegmentMessageToBuffer(ReportLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportLocalPathSegmentMessage reportLocalPathSegmentMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportLocalPathSegmentMessageToJausMessage(ReportLocalPathSegmentMessage message); - -JAUS_EXPORT unsigned int reportLocalPathSegmentMessageSize(ReportLocalPathSegmentMessage message); - -#endif // REPORT_LOCAL_PATH_SEGMENT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportLocalPoseMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportLocalPoseMessage.h deleted file mode 100644 index 4c938ba1c16a0e42d1668a8f06581cbcbae23a97..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportLocalPoseMessage.h +++ /dev/null @@ -1,126 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportLocalPoseMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportLocalPoseMessage - -#ifndef REPORT_LOCAL_POSE_MESSAGE_H -#define REPORT_LOCAL_POSE_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_LOCAL_POSE_PV -#define JAUS_LOCAL_POSE_PV -#define JAUS_LOCAL_POSE_PV_X_BIT 0 -#define JAUS_LOCAL_POSE_PV_Y_BIT 1 -#define JAUS_LOCAL_POSE_PV_Z_BIT 2 -#define JAUS_LOCAL_POSE_PV_POSITION_RMS_BIT 3 -#define JAUS_LOCAL_POSE_PV_ROLL_BIT 4 -#define JAUS_LOCAL_POSE_PV_PITCH_BIT 5 -#define JAUS_LOCAL_POSE_PV_YAW_BIT 6 -#define JAUS_LOCAL_POSE_PV_ATTITUDE_RMS_BIT 7 -#define JAUS_LOCAL_POSE_PV_TIME_STAMP_BIT 8 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort presenceVector; - JausDouble xM; // Scaled Int (-100000, 100000) - JausDouble yM; // Scaled Int (-100000, 100000) - JausDouble zM; // Scaled Int (-10000, 35000) - JausDouble positionRmsMeters; // Scaled UInt (0, 100) - JausDouble rollRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble attitudeRmsRadians; // Scaled Short (0, JAUS_PI) - JausTime time; - -}ReportLocalPoseMessageStruct; - -typedef ReportLocalPoseMessageStruct* ReportLocalPoseMessage; - -JAUS_EXPORT ReportLocalPoseMessage reportLocalPoseMessageCreate(void); -JAUS_EXPORT void reportLocalPoseMessageDestroy(ReportLocalPoseMessage); - -JAUS_EXPORT JausBoolean reportLocalPoseMessageFromBuffer(ReportLocalPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportLocalPoseMessageToBuffer(ReportLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportLocalPoseMessage reportLocalPoseMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportLocalPoseMessageToJausMessage(ReportLocalPoseMessage message); - -JAUS_EXPORT unsigned int reportLocalPoseMessageSize(ReportLocalPoseMessage message); - -#endif // REPORT_LOCAL_POSE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportLocalVectorMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportLocalVectorMessage.h deleted file mode 100644 index 1b2fac96e403b18e35256bad8a870803ed3930fd..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportLocalVectorMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportLocalVectorMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportLocalVectorMessage - -#ifndef REPORT_LOCAL_VECTOR_MESSAGE_H -#define REPORT_LOCAL_VECTOR_MESSAGE_H - -#include "jaus.h" - - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausDouble speedMps; // Scaled Unsigned Int (0, 10000) Mps = Meters Per Second - JausDouble headingRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - -}ReportLocalVectorMessageStruct; - -typedef ReportLocalVectorMessageStruct* ReportLocalVectorMessage; - -JAUS_EXPORT ReportLocalVectorMessage reportLocalVectorMessageCreate(void); -JAUS_EXPORT void reportLocalVectorMessageDestroy(ReportLocalVectorMessage); - -JAUS_EXPORT JausBoolean reportLocalVectorMessageFromBuffer(ReportLocalVectorMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportLocalVectorMessageToBuffer(ReportLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportLocalVectorMessage reportLocalVectorMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportLocalVectorMessageToJausMessage(ReportLocalVectorMessage message); - -JAUS_EXPORT unsigned int reportLocalVectorMessageSize(ReportLocalVectorMessage message); - -#endif // REPORT_LOCAL_VECTOR_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportLocalWaypointMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportLocalWaypointMessage.h deleted file mode 100644 index c31a4d9ae07c926dabafa8bcfc035fa9dd2af2a8..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportLocalWaypointMessage.h +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportLocalWaypointMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportLocalWaypointMessage - -#ifndef REPORT_LOCAL_WAYPOINT_MESSAGE_H -#define REPORT_LOCAL_WAYPOINT_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_LOCAL_WAYPOINT_PV -#define JAUS_LOCAL_WAYPOINT_PV -#define JAUS_LOCAL_WAYPOINT_PV_Z_BIT 0 -#define JAUS_LOCAL_WAYPOINT_PV_ROLL_BIT 1 -#define JAUS_LOCAL_WAYPOINT_PV_PITCH_BIT 2 -#define JAUS_LOCAL_WAYPOINT_PV_YAW_BIT 3 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausUnsignedShort waypointNumber; - JausDouble xM; // Scaled Integer (-100000, 100000) - JausDouble yM; // Scaled Integer (-100000, 100000) - JausDouble zM; // Scaled Integer (-10000, 35000) - JausDouble rollRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - -}ReportLocalWaypointMessageStruct; - -typedef ReportLocalWaypointMessageStruct* ReportLocalWaypointMessage; - -JAUS_EXPORT ReportLocalWaypointMessage reportLocalWaypointMessageCreate(void); -JAUS_EXPORT void reportLocalWaypointMessageDestroy(ReportLocalWaypointMessage); - -JAUS_EXPORT JausBoolean reportLocalWaypointMessageFromBuffer(ReportLocalWaypointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportLocalWaypointMessageToBuffer(ReportLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportLocalWaypointMessage reportLocalWaypointMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportLocalWaypointMessageToJausMessage(ReportLocalWaypointMessage message); - -JAUS_EXPORT unsigned int reportLocalWaypointMessageSize(ReportLocalWaypointMessage message); - -#endif // REPORT_LOCAL_WAYPOINT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportPathSegmentCountMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportPathSegmentCountMessage.h deleted file mode 100644 index 6292a7635a4e287ce783b56427061db1485a1587..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportPathSegmentCountMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportPathSegmentCountMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportPathSegmentCountMessage - -#ifndef REPORT_PATH_SEGMENT_COUNT_MESSAGE_H -#define REPORT_PATH_SEGMENT_COUNT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort pathSegmentCount; - -}ReportPathSegmentCountMessageStruct; - -typedef ReportPathSegmentCountMessageStruct* ReportPathSegmentCountMessage; - -JAUS_EXPORT ReportPathSegmentCountMessage reportPathSegmentCountMessageCreate(void); -JAUS_EXPORT void reportPathSegmentCountMessageDestroy(ReportPathSegmentCountMessage); - -JAUS_EXPORT JausBoolean reportPathSegmentCountMessageFromBuffer(ReportPathSegmentCountMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportPathSegmentCountMessageToBuffer(ReportPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportPathSegmentCountMessage reportPathSegmentCountMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportPathSegmentCountMessageToJausMessage(ReportPathSegmentCountMessage message); - -JAUS_EXPORT unsigned int reportPathSegmentCountMessageSize(ReportPathSegmentCountMessage message); - -#endif // REPORT_PATH_SEGMENT_COUNT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportPlatformOperationalDataMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportPlatformOperationalDataMessage.h deleted file mode 100644 index fb9edad1b29eb41153e01bf0d1c14b5a7552341d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportPlatformOperationalDataMessage.h +++ /dev/null @@ -1,118 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportPlatformOperationalDataMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportPlatformOperationalDataMessage - -#ifndef REPORT_PLATFORM_OPERATIONAL_DATA_MESSAGE_H -#define REPORT_PLATFORM_OPERATIONAL_DATA_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_OPERATIONAL_PV -#define JAUS_OPERATIONAL_PV -#define JAUS_OPERATIONAL_PV_ENGINE_BIT 0 -#define JAUS_OPERATIONAL_PV_ODOMETER_BIT 1 -#define JAUS_OPERATIONAL_PV_BATTERY_BIT 2 -#define JAUS_OPERATIONAL_PV_FUEL_BIT 3 -#define JAUS_OPERATIONAL_PV_OIL_BIT 4 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - JausDouble engineTemperatureCelsius; // Scaled Short (-75, 180) - JausUnsignedInteger odometerMeters; - JausDouble batteryVoltagePercent; // Scaled Byte (0, 127) - JausDouble fuelLevelPercent; // Scaled Byte (0, 100) - JausDouble oilPressurePercent; // Scaled Byte (0, 127) - -}ReportPlatformOperationalDataMessageStruct; - -typedef ReportPlatformOperationalDataMessageStruct* ReportPlatformOperationalDataMessage; - -JAUS_EXPORT ReportPlatformOperationalDataMessage reportPlatformOperationalDataMessageCreate(void); -JAUS_EXPORT void reportPlatformOperationalDataMessageDestroy(ReportPlatformOperationalDataMessage); - -JAUS_EXPORT JausBoolean reportPlatformOperationalDataMessageFromBuffer(ReportPlatformOperationalDataMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportPlatformOperationalDataMessageToBuffer(ReportPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportPlatformOperationalDataMessage reportPlatformOperationalDataMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportPlatformOperationalDataMessageToJausMessage(ReportPlatformOperationalDataMessage message); - -JAUS_EXPORT unsigned int reportPlatformOperationalDataMessageSize(ReportPlatformOperationalDataMessage message); - -#endif // REPORT_PLATFORM_OPERATIONAL_DATA_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportPlatformSpecificationsMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportPlatformSpecificationsMessage.h deleted file mode 100644 index 947a6119d1a2a17e2794db9dc6fc46ef5143ef54..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportPlatformSpecificationsMessage.h +++ /dev/null @@ -1,152 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportPlatformSpecificationsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportPlatformSpecificationsMessage - -#ifndef REPORT_PLATFORM_SPEFICATIONS_MESSAGE_H -#define REPORT_PLATFORM_SPEFICATIONS_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_DISCRETE_PV -#define JAUS_DISCRETE_PV -#define JAUS_DISCRETE_PV_PLATFORM_NAME_BIT 0 -#define JAUS_DISCRETE_PV_FRONT_BIT 1 -#define JAUS_DISCRETE_PV_BACK_BIT 2 -#define JAUS_DISCRETE_PV_RIGHT_BIT 3 -#define JAUS_DISCRETE_PV_LEFT_BIT 4 -#define JAUS_DISCRETE_PV_BOTTOM_BIT 5 -#define JAUS_DISCRETE_PV_TOP_BIT 6 -#define JAUS_DISCRETE_PV_X_CG_BIT 7 -#define JAUS_DISCRETE_PV_Y_CG_BIT 8 -#define JAUS_DISCRETE_PV_Z_CG_BIT 9 -#define JAUS_DISCRETE_PV_TURNING_RADIUS_BIT 10 -#define JAUS_DISCRETE_PV_WHEEL_BASE_BIT 11 -#define JAUS_DISCRETE_PV_TRACK_WIDTH_BIT 12 -#define JAUS_DISCRETE_PV_PITCH_OVER_BIT 13 -#define JAUS_DISCRETE_PV_ROLL_OVER_BIT 14 -#define JAUS_DISCRETE_PV_MAX_VELOCITY_X_BIT 15 -#define JAUS_DISCRETE_PV_MAX_VELOCITY_Y_BIT 16 -#define JAUS_DISCRETE_PV_MAX_VELOCITY_Z_BIT 17 -#define JAUS_DISCRETE_PV_MAX_ROLL_RATE_BIT 18 -#define JAUS_DISCRETE_PV_MAX_PITCH_RATE_BIT 19 -#define JAUS_DISCRETE_PV_MAX_YAW_RATE_BIT 20 -#endif - -#define JAUS_PLATFORM_NAME_LENGTH_BYTES 15 - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedInteger presenceVector; - char platformName[JAUS_PLATFORM_NAME_LENGTH_BYTES]; - JausDouble frontMeters; // Scaled Unsigned Short (0, 32.767) - JausDouble backMeters; // Scaled Unsigned Short (0, 32.767) - JausDouble rightMeters; // Scaled Unsigned Short (0, 32.767) - JausDouble leftMeters; // Scaled Unsigned Short (0, 32.767) - JausDouble bottomMeters; // Scaled Unsigned Short (0, 32.767) - JausDouble topMeters; // Scaled Unsigned Short (0, 32.767) - JausDouble xCgMeters; // Scaled Unsigned Short (0, 32.767) - JausDouble yCgMeters; // Scaled Unsigned Short (0, 32.767) - JausDouble zCgMeters; // Scaled Unsigned Short (0, 32.767) - JausDouble turningRadiusMeters; // Scaled Unsigned Short (0, 65.535) - JausDouble wheelBaseMeters; // Scaled Unsigned Short (0, 65.535) - JausDouble trackWidthMeters; // Scaled Unsigned Short (0, 65.535) - JausDouble pitchOverRadians; // Scaled Unsigned Short (0, 2.56) - JausDouble rollOverRadians; // Scaled Unsigned Short (0, 2.56) - JausDouble maximumVelocityXMps; // Scaled Unsigned Short (0, 65.535) Mps = Meters per Second - JausDouble maximumVelocityYMps; // Scaled Unsigned Short (0, 65.535) Mps = Meters per Second - JausDouble maximumVelocityZMps; // Scaled Unsigned Short (0, 65.535) Mps = Meters per Second - JausDouble maximumRollRateRps; // Scaled Unsigned Short (0, 32.767) Rps = Radians per Second - JausDouble maximumPitchRateRps; // Scaled Unsigned Short (0, 32.767) Rps = Radians per Second - JausDouble maximumYawRateRps; // Scaled Unsigned Short (0, 32.767) Rps = Radians per Second - -}ReportPlatformSpecificationsMessageStruct; - -typedef ReportPlatformSpecificationsMessageStruct* ReportPlatformSpecificationsMessage; - -JAUS_EXPORT ReportPlatformSpecificationsMessage reportPlatformSpecificationsMessageCreate(void); -JAUS_EXPORT void reportPlatformSpecificationsMessageDestroy(ReportPlatformSpecificationsMessage); - -JAUS_EXPORT JausBoolean reportPlatformSpecificationsMessageFromBuffer(ReportPlatformSpecificationsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportPlatformSpecificationsMessageToBuffer(ReportPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportPlatformSpecificationsMessage reportPlatformSpecificationsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportPlatformSpecificationsMessageToJausMessage(ReportPlatformSpecificationsMessage message); - -JAUS_EXPORT unsigned int reportPlatformSpecificationsMessageSize(ReportPlatformSpecificationsMessage message); - -#endif // REPORT_PLATFORM_SPEFICATIONS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportTravelSpeedMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportTravelSpeedMessage.h deleted file mode 100644 index e3036fc0780bb29e0dbaad9c5b262479fc4676d9..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportTravelSpeedMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportTravelSpeedMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportTravelSpeedMessage - -#ifndef REPORT_TRAVEL_SPEED_MESSAGE_H -#define REPORT_TRAVEL_SPEED_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausDouble speedMps; //Scaled Unsigned Short (0, 10000) Mps = Meters Per Second - -}ReportTravelSpeedMessageStruct; - -typedef ReportTravelSpeedMessageStruct* ReportTravelSpeedMessage; - -JAUS_EXPORT ReportTravelSpeedMessage reportTravelSpeedMessageCreate(void); -JAUS_EXPORT void reportTravelSpeedMessageDestroy(ReportTravelSpeedMessage); - -JAUS_EXPORT JausBoolean reportTravelSpeedMessageFromBuffer(ReportTravelSpeedMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportTravelSpeedMessageToBuffer(ReportTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportTravelSpeedMessage reportTravelSpeedMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportTravelSpeedMessageToJausMessage(ReportTravelSpeedMessage message); - -JAUS_EXPORT unsigned int reportTravelSpeedMessageSize(ReportTravelSpeedMessage message); - -#endif // REPORT_TRAVEL_SPEED_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportVelocityStateMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportVelocityStateMessage.h deleted file mode 100644 index 23cd3beda80b5475df1fa46f68d516261fdc5f3e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportVelocityStateMessage.h +++ /dev/null @@ -1,126 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportVelocityStateMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportVelocityStateMessage - -#ifndef REPORT_VELOCITY_STATE_MESSAGE_H -#define REPORT_VELOCITY_STATE_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_VELOCITY_PV -#define JAUS_VELOCITY_PV -#define JAUS_VELOCITY_PV_VELOCITY_X_BIT 0 -#define JAUS_VELOCITY_PV_VELOCITY_Y_BIT 1 -#define JAUS_VELOCITY_PV_VELOCITY_Z_BIT 2 -#define JAUS_VELOCITY_PV_VELOCITY_RMS_BIT 3 -#define JAUS_VELOCITY_PV_ROLL_RATE_BIT 4 -#define JAUS_VELOCITY_PV_PITCH_RATE_BIT 5 -#define JAUS_VELOCITY_PV_YAW_RATE_BIT 6 -#define JAUS_VELOCITY_PV_RATE_RMS_BIT 7 -#define JAUS_VELOCITY_PV_TIME_STAMP_BIT 8 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort presenceVector; - JausDouble velocityXMps; // Scaled Int (-65.534, 65.534) Mps = Meters per Second - JausDouble velocityYMps; // Scaled Int (-65.534, 65.534) Mps = Meters per Second - JausDouble velocityZMps; // Scaled Int (-65.534, 65.534) Mps = Meters per Secon - JausDouble velocityRmsMps; // Scaled UInt (0, 100) Mps = Meters per Second - JausDouble rollRateRps; // Scaled Short (-32.767, 32.767) Rps = Radians per Second - JausDouble pitchRateRps; // Scaled Short (-32.767, 32.767) Rps = Radians per Second - JausDouble yawRateRps; // Scaled Short (-32.767, 32.767) Rps = Radians per Second - JausDouble rateRmsRps; // Scaled UShort (0, JAUS_PI) Rps = Radians per Second - JausTime time; - -}ReportVelocityStateMessageStruct; - -typedef ReportVelocityStateMessageStruct* ReportVelocityStateMessage; - -JAUS_EXPORT ReportVelocityStateMessage reportVelocityStateMessageCreate(void); -JAUS_EXPORT void reportVelocityStateMessageDestroy(ReportVelocityStateMessage); - -JAUS_EXPORT JausBoolean reportVelocityStateMessageFromBuffer(ReportVelocityStateMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportVelocityStateMessageToBuffer(ReportVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportVelocityStateMessage reportVelocityStateMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportVelocityStateMessageToJausMessage(ReportVelocityStateMessage message); - -JAUS_EXPORT unsigned int reportVelocityStateMessageSize(ReportVelocityStateMessage message); - -#endif // REPORT_VELOCITY_STATE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportWaypointCountMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportWaypointCountMessage.h deleted file mode 100644 index 14ae29e7a55fed17c83a229551909d077bd912a5..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportWaypointCountMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportWaypointCountMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportWaypointCountMessage - -#ifndef REPORT_WAYPOINT_COUNT_MESSAGE_H -#define REPORT_WAYPOINT_COUNT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort waypointCount; - -}ReportWaypointCountMessageStruct; - -typedef ReportWaypointCountMessageStruct* ReportWaypointCountMessage; - -JAUS_EXPORT ReportWaypointCountMessage reportWaypointCountMessageCreate(void); -JAUS_EXPORT void reportWaypointCountMessageDestroy(ReportWaypointCountMessage); - -JAUS_EXPORT JausBoolean reportWaypointCountMessageFromBuffer(ReportWaypointCountMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportWaypointCountMessageToBuffer(ReportWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportWaypointCountMessage reportWaypointCountMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportWaypointCountMessageToJausMessage(ReportWaypointCountMessage message); - -JAUS_EXPORT unsigned int reportWaypointCountMessageSize(ReportWaypointCountMessage message); - -#endif // REPORT_WAYPOINT_COUNT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/platform/reportWrenchEffortMessage.h b/lib/openjaus/libjaus/include/message/inform/platform/reportWrenchEffortMessage.h deleted file mode 100644 index 8e13a6a542747b82e8235db4a5520f1f948ae4f1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/platform/reportWrenchEffortMessage.h +++ /dev/null @@ -1,133 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportWrenchEffortMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportWrenchEffortMessage - -#ifndef REPORT_WRENCH_EFFORT_MESSAGE_H -#define REPORT_WRENCH_EFFORT_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_WRENCH_PV -#define JAUS_WRENCH_PV -#define JAUS_WRENCH_PV_PROPULSIVE_LINEAR_X_BIT 0 -#define JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Y_BIT 1 -#define JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Z_BIT 2 -#define JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_X_BIT 3 -#define JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Y_BIT 4 -#define JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Z_BIT 5 -#define JAUS_WRENCH_PV_RESISTIVE_LINEAR_X_BIT 6 -#define JAUS_WRENCH_PV_RESISTIVE_LINEAR_Y_BIT 7 -#define JAUS_WRENCH_PV_RESISTIVE_LINEAR_Z_BIT 8 -#define JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_X_BIT 9 -#define JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Y_BIT 10 -#define JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Z_BIT 11 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // Message Fields: - JausUnsignedShort presenceVector; - JausDouble propulsiveLinearEffortXPercent; // Scaled Short (-100, 100) - JausDouble propulsiveLinearEffortYPercent; // Scaled Short (-100, 100) - JausDouble propulsiveLinearEffortZPercent; // Scaled Short (-100, 100) - JausDouble propulsiveRotationalEffortXPercent; // Scaled Short (-100, 100) - JausDouble propulsiveRotationalEffortZPercent; // Scaled Short (-100, 100) - JausDouble propulsiveRotationalEffortYPercent; // Scaled Short (-100, 100) - JausDouble resistiveLinearEffortXPercent; // Scaled Byte (0, 100) - JausDouble resistiveLinearEffortYPercent; // Scaled Byte (0, 100) - JausDouble resistiveLinearEffortZPercent; // Scaled Byte (0, 100) - JausDouble resistiveRotationalEffortXPercent; // Scaled Byte (0, 100) - JausDouble resistiveRotationalEffortZPercent; // Scaled Byte (0, 100) - JausDouble resistiveRotationalEffortYPercent; // Scaled Byte (0, 100) - -}ReportWrenchEffortMessageStruct; - -typedef ReportWrenchEffortMessageStruct* ReportWrenchEffortMessage; - -JAUS_EXPORT ReportWrenchEffortMessage reportWrenchEffortMessageCreate(void); -JAUS_EXPORT void reportWrenchEffortMessageDestroy(ReportWrenchEffortMessage); - -JAUS_EXPORT JausBoolean reportWrenchEffortMessageFromBuffer(ReportWrenchEffortMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportWrenchEffortMessageToBuffer(ReportWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportWrenchEffortMessage reportWrenchEffortMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportWrenchEffortMessageToJausMessage(ReportWrenchEffortMessage message); - -JAUS_EXPORT unsigned int reportWrenchEffortMessageSize(ReportWrenchEffortMessage message); - -#endif // REPORT_WRENCH_EFFORT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksBoundsMessage.h b/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksBoundsMessage.h deleted file mode 100644 index 0bf2e7fbac1d7a71a7effe30b868e6ec5a7251d4..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksBoundsMessage.h +++ /dev/null @@ -1,110 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportVksBoundsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportVksBoundsMessage - -#ifndef REPORT_VKS_BOUNDS_MESSAGE_H -#define REPORT_VKS_BOUNDS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte requestId; - JausUnsignedShort featureClass; - JausDouble southWestLatitudeDegrees; - JausDouble southWestLongitudeDegrees; - JausDouble northEastLatitudeDegrees; - JausDouble northEastLongitudeDegrees; - -}ReportVksBoundsMessageStruct; - -typedef ReportVksBoundsMessageStruct* ReportVksBoundsMessage; - -JAUS_EXPORT ReportVksBoundsMessage reportVksBoundsMessageCreate(void); -JAUS_EXPORT void reportVksBoundsMessageDestroy(ReportVksBoundsMessage); - -JAUS_EXPORT JausBoolean reportVksBoundsMessageFromBuffer(ReportVksBoundsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportVksBoundsMessageToBuffer(ReportVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportVksBoundsMessage reportVksBoundsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportVksBoundsMessageToJausMessage(ReportVksBoundsMessage message); - -JAUS_EXPORT unsigned int reportVksBoundsMessageSize(ReportVksBoundsMessage message); - -#endif // REPORT_VKS_BOUNDS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksDataTransferTerminationMessage.h b/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksDataTransferTerminationMessage.h deleted file mode 100644 index ce415980637c44a80e16f52489e3d9fa5e35ab28..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksDataTransferTerminationMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportVksDataTransferTerminationMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportVksDataTransferTerminationMessage - -#ifndef REPORT_VKS_DATA_TRANSFER_TERMINATION_MESSAGE_H -#define REPORT_VKS_DATA_TRANSFER_TERMINATION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No Data - -}ReportVksDataTransferTerminationMessageStruct; - -typedef ReportVksDataTransferTerminationMessageStruct* ReportVksDataTransferTerminationMessage; - -JAUS_EXPORT ReportVksDataTransferTerminationMessage reportVksDataTransferTerminationMessageCreate(void); -JAUS_EXPORT void reportVksDataTransferTerminationMessageDestroy(ReportVksDataTransferTerminationMessage); - -JAUS_EXPORT JausBoolean reportVksDataTransferTerminationMessageFromBuffer(ReportVksDataTransferTerminationMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportVksDataTransferTerminationMessageToBuffer(ReportVksDataTransferTerminationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportVksDataTransferTerminationMessage reportVksDataTransferTerminationMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportVksDataTransferTerminationMessageToJausMessage(ReportVksDataTransferTerminationMessage message); - -JAUS_EXPORT unsigned int reportVksDataTransferTerminationMessageSize(ReportVksDataTransferTerminationMessage message); - -#endif // REPORT_VKS_DATA_TRANSFER_TERMINATION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksFeatureClassMetadataMessage.h b/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksFeatureClassMetadataMessage.h deleted file mode 100644 index 284c17cfc5de65c8732be0052ff4075149135026..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksFeatureClassMetadataMessage.h +++ /dev/null @@ -1,103 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportVksFeatureClassMetadataMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportVksFeatureClassMetadataMessage - -#ifndef REPORT_VKS_FEATURE_CLASS_METADATA_MESSAGE_H -#define REPORT_VKS_FEATURE_CLASS_METADATA_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausWorldModelFeatureClass fcClass; -}ReportVksFeatureClassMetadataMessageStruct; - -typedef ReportVksFeatureClassMetadataMessageStruct* ReportVksFeatureClassMetadataMessage; - -JAUS_EXPORT ReportVksFeatureClassMetadataMessage reportVksFeatureClassMetadataMessageCreate(void); -JAUS_EXPORT void reportVksFeatureClassMetadataMessageDestroy(ReportVksFeatureClassMetadataMessage); - -JAUS_EXPORT JausBoolean reportVksFeatureClassMetadataMessageFromBuffer(ReportVksFeatureClassMetadataMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportVksFeatureClassMetadataMessageToBuffer(ReportVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportVksFeatureClassMetadataMessage reportVksFeatureClassMetadataMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportVksFeatureClassMetadataMessageToJausMessage(ReportVksFeatureClassMetadataMessage message); - -JAUS_EXPORT unsigned int reportVksFeatureClassMetadataMessageSize(ReportVksFeatureClassMetadataMessage message); - -#endif // REPORT_VKS_FEATURE_CLASS_METADATA_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksObjectsCreationMessage.h b/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksObjectsCreationMessage.h deleted file mode 100644 index c3e592ed1b1775bace9b55e5d0d35a3767dccc0c..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksObjectsCreationMessage.h +++ /dev/null @@ -1,107 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportVksObjectsCreationMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportVksObjectsCreationMessage - -#ifndef REPORT_VKS_OBJECTS_CREATION_MESSAGE_H -#define REPORT_VKS_OBJECTS_CREATION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte requestId; // 1: The request id sent by the requesting service - JausUnsignedShort objectCount; // 2: Total number of objects reported - JausUnsignedInteger *objectIds; // 3: unique id for object created, 0x0000000 is reserved for an error - -}ReportVksObjectsCreationMessageStruct; - -typedef ReportVksObjectsCreationMessageStruct* ReportVksObjectsCreationMessage; - -JAUS_EXPORT ReportVksObjectsCreationMessage reportVksObjectsCreationMessageCreate(void); -JAUS_EXPORT void reportVksObjectsCreationMessageDestroy(ReportVksObjectsCreationMessage); - -JAUS_EXPORT JausBoolean reportVksObjectsCreationMessageFromBuffer(ReportVksObjectsCreationMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportVksObjectsCreationMessageToBuffer(ReportVksObjectsCreationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportVksObjectsCreationMessage reportVksObjectsCreationMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportVksObjectsCreationMessageToJausMessage(ReportVksObjectsCreationMessage message); - -JAUS_EXPORT unsigned int reportVksObjectsCreationMessageSize(ReportVksObjectsCreationMessage message); - -#endif // REPORT_VKS_OBJECTS_CREATION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksObjectsMessage.h b/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksObjectsMessage.h deleted file mode 100644 index 72e8e3e3617ed46bbf39b356b8d6d0a74e857fad..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/inform/worldModel/reportVksObjectsMessage.h +++ /dev/null @@ -1,113 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportVksObjectsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a ReportVksObjectsMessage - -#ifndef REPORT_VKS_OBJECTS_MESSAGE_H -#define REPORT_VKS_OBJECTS_MESSAGE_H - -#include "jaus.h" - -#ifndef VKS_PV_REPORT -#define VKS_PV_REPORT -#define VKS_PV_REPORT_DATA_BIT 0 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; - JausByte requestId; - JausUnsignedShort objectCount; - JausArray vectorObjects; - -}ReportVksObjectsMessageStruct; - -typedef ReportVksObjectsMessageStruct* ReportVksObjectsMessage; - -JAUS_EXPORT ReportVksObjectsMessage reportVksObjectsMessageCreate(void); -JAUS_EXPORT void reportVksObjectsMessageDestroy(ReportVksObjectsMessage); - -JAUS_EXPORT JausBoolean reportVksObjectsMessageFromBuffer(ReportVksObjectsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean reportVksObjectsMessageToBuffer(ReportVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT ReportVksObjectsMessage reportVksObjectsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage reportVksObjectsMessageToJausMessage(ReportVksObjectsMessage message); - -JAUS_EXPORT unsigned int reportVksObjectsMessageSize(ReportVksObjectsMessage message); - -#endif // REPORT_VKS_OBJECTS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/jausMessage.h b/lib/openjaus/libjaus/include/message/jausMessage.h deleted file mode 100644 index 2ad5cfb0edba65bb2dbe67b8710c20e36c1144c2..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/jausMessage.h +++ /dev/null @@ -1,313 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the attributes of a JausMessage and all pre-defined command codes according to RA 3.2 - -#ifndef JAUS_MESSAGE_H -#define JAUS_MESSAGE_H - -#include "jaus.h" - -#define JAUS_HEADER_SIZE_BYTES 16 - -#define JAUS_LOW_PRIORITY 0 -#define JAUS_DEFAULT_PRIORITY 6 -#define JAUS_HIGH_PRIORITY 11 - -#define JAUS_ACK_NAK_NOT_REQUIRED 0 -#define JAUS_ACK_NAK_REQUIRED 1 -#define JAUS_NEGATIVE_ACKNOWLEDGE 2 -#define JAUS_ACKNOWLEDGE 3 - -#define JAUS_ACK JAUS_ACKNOWLEDGE -#define JAUS_NAK JAUS_NEGATIVE_ACKNOWLEDGE - -#define JAUS_SERVICE_CONNECTION_MESSAGE 1 -#define JAUS_NOT_SERVICE_CONNECTION_MESSAGE 0 - -#define JAUS_EXPERIMENTAL_MESSAGE 1 -#define JAUS_NOT_EXPERIMENTAL_MESSAGE 0 - -#define JAUS_VERSION_2_0 0 -#define JAUS_VERSION_2_1 0 -#define JAUS_VERSION_3_0 1 -#define JAUS_VERSION_3_1 1 -#define JAUS_VERSION_3_2 2 -#define JAUS_VERSION_3_3 2 // Not a bug, 2 is defined as 3.2 and 3.3 - -#define JAUS_MAX_DATA_SIZE_BYTES 4080 - -#define JAUS_SINGLE_DATA_PACKET 0 -#define JAUS_FIRST_DATA_PACKET 1 -#define JAUS_NORMAL_DATA_PACKET 2 -#define JAUS_RETRANSMITTED_DATA_PACKET 4 -#define JAUS_LAST_DATA_PACKET 8 - -#define JAUS_MAX_SEQUENCE_NUMBER 65535 - -// Jaus Command Class Messages -#define JAUS_SET_COMPONENT_AUTHORITY 0x0001 -#define JAUS_SHUTDOWN 0x0002 -#define JAUS_STANDBY 0x0003 -#define JAUS_RESUME 0x0004 -#define JAUS_RESET 0x0005 -#define JAUS_SET_EMERGENCY 0x0006 -#define JAUS_CLEAR_EMERGENCY 0x0007 -#define JAUS_CREATE_SERVICE_CONNECTION 0x0008 -#define JAUS_CONFIRM_SERVICE_CONNECTION 0x0009 -#define JAUS_ACTIVATE_SERVICE_CONNECTION 0x000A -#define JAUS_SUSPEND_SERVICE_CONNECTION 0x000B -#define JAUS_TERMINATE_SERVICE_CONNECTION 0x000C -#define JAUS_REQUEST_COMPONENT_CONTROL 0x000D -#define JAUS_RELEASE_COMPONENT_CONTROL 0x000E -#define JAUS_CONFIRM_COMPONENT_CONTROL 0x000F -#define JAUS_REJECT_COMPONENT_CONTROL 0x0010 -#define JAUS_SET_TIME 0x0011 -#define JAUS_CREATE_EVENT 0x01F0 -#define JAUS_UPDATE_EVENT 0x01F1 -#define JAUS_CANCEL_EVENT 0x01F2 -#define JAUS_CONFIRM_EVENT_REQUEST 0x01F3 -#define JAUS_REJECT_EVENT_REQUEST 0x01F4 -#define JAUS_SET_DATA_LINK_STATUS 0x0200 -#define JAUS_SET_DATA_LINK_SELECT 0x0201 -#define JAUS_SET_SELECTED_DATA_LINK_STATE 0x0202 -#define JAUS_SET_WRENCH_EFFORT 0x0405 -#define JAUS_SET_DISCRETE_DEVICES 0x0406 -#define JAUS_SET_GLOBAL_VECTOR 0x0407 -#define JAUS_SET_LOCAL_VECTOR 0x0408 -#define JAUS_SET_TRAVEL_SPEED 0x040A -#define JAUS_SET_GLOBAL_WAYPOINT 0x040C -#define JAUS_SET_LOCAL_WAYPOINT 0x040D -#define JAUS_SET_GLOBAL_PATH_SEGMENT 0x040F -#define JAUS_SET_LOCAL_PATH_SEGMENT 0x0410 -#define JAUS_SET_JOINT_EFFORTS 0x0601 -#define JAUS_SET_JOINT_POSITIONS 0x0602 -#define JAUS_SET_JOINT_VELOCITIES 0x0603 -#define JAUS_SET_TOOL_POINT 0x0604 -#define JAUS_SET_END_EFFECTOR_POSE 0x0605 -#define JAUS_SET_END_EFFECTOR_VELOCITY_STATE 0x0606 -#define JAUS_SET_JOINT_MOTION 0x0607 -#define JAUS_SET_END_EFFECTOR_PATH_MOTION 0x0608 -#define JAUS_SET_CAMERA_POSE 0x0801 -#define JAUS_SELECT_CAMERA 0x0802 -#define JAUS_SET_CAMERA_CAPABILITIES 0x0805 -#define JAUS_SET_CAMERA_FORMAT_OPTIONS 0x0806 -#define JAUS_CREATE_VKS_OBJECTS 0x0A20 -#define JAUS_DELETE_VKS_OBJECTS 0x0A25 -#define JAUS_SET_VKS_FEATURE_CLASS_METADATA 0x0A21 -#define JAUS_TERMINATE_VKS_DATA_TRANSFER 0x0A24 -#define JAUS_SET_PAYLOAD_DATA_ELEMENT 0x0D01 -#define JAUS_SPOOL_MISSION 0x0E00 -#define JAUS_RUN_MISSION 0x0E01 -#define JAUS_ABORT_MISSION 0x0E02 -#define JAUS_PAUSE_MISSION 0x0E03 -#define JAUS_RESUME_MISSION 0x0E04 -#define JAUS_REMOVE_MESSAGES 0x0E05 -#define JAUS_REPLACE_MESSAGES 0x0E06 - -// Jaus Query Class Messages -#define JAUS_QUERY_COMPONENT_AUTHORITY 0x2001 -#define JAUS_QUERY_COMPONENT_STATUS 0x2002 -#define JAUS_QUERY_TIME 0x2011 -#define JAUS_QUERY_COMPONENT_CONTROL 0x200D -#define JAUS_QUERY_EVENTS 0x21F0 -#define JAUS_QUERY_DATA_LINK_STATUS 0x2200 -#define JAUS_QUERY_SELECTED_DATA_LINK_STATUS 0x2201 -#define JAUS_QUERY_HEARTBEAT_PULSE 0x2202 -#define JAUS_QUERY_PLATFORM_SPECIFICATIONS 0x2400 -#define JAUS_QUERY_PLATFORM_OPERATIONAL_DATA 0x2401 -#define JAUS_QUERY_GLOBAL_POSE 0x2402 -#define JAUS_QUERY_LOCAL_POSE 0x2403 -#define JAUS_QUERY_VELOCITY_STATE 0x2404 -#define JAUS_QUERY_WRENCH_EFFORT 0x2405 -#define JAUS_QUERY_DISCRETE_DEVICES 0x2406 -#define JAUS_QUERY_GLOBAL_VECTOR 0x2407 -#define JAUS_QUERY_LOCAL_VECTOR 0x2408 -#define JAUS_QUERY_TRAVEL_SPEED 0x240A -#define JAUS_QUERY_WAYPOINT_COUNT 0x240B -#define JAUS_QUERY_GLOBAL_WAYPOINT 0x240C -#define JAUS_QUERY_LOCAL_WAYPOINT 0x240D -#define JAUS_QUERY_PATH_SEGMENT_COUNT 0x240E -#define JAUS_QUERY_GLOBAL_PATH_SEGMENT 0x240F -#define JAUS_QUERY_LOCAL_PATH_SEGMENT 0x2410 -#define JAUS_QUERY_MANIPULATOR_SPECIFICATIONS 0x2600 -#define JAUS_QUERY_JOINT_EFFORTS 0x2601 -#define JAUS_QUERY_JOINT_POSITIONS 0x2602 -#define JAUS_QUERY_JOINT_VELOCITIES 0x2603 -#define JAUS_QUERY_TOOL_POINT 0x2604 -#define JAUS_QUERY_JOINT_FORCE_TORQUES 0x2605 -#define JAUS_QUERY_CAMERA_POSE 0x2800 -#define JAUS_QUERY_CAMERA_COUNT 0x2801 -#define JAUS_QUERY_RELATIVE_OBJECT_POSITION 0x2802 -#define JAUS_QUERY_SELECTED_CAMERA 0x2804 -#define JAUS_QUERY_CAMERA_CAPABILITIES 0x2805 -#define JAUS_QUERY_CAMERA_FORMAT_OPTIONS 0x2806 -#define JAUS_QUERY_IMAGE 0x2807 -#define JAUS_QUERY_VKS_FEATURE_CLASS_METADATA 0x2A21 -#define JAUS_QUERY_VKS_BOUNDS 0x2A22 -#define JAUS_QUERY_VKS_OBJECTS 0x2A23 -#define JAUS_QUERY_IDENTIFICATION 0x2B00 -#define JAUS_QUERY_CONFIGURATION 0x2B01 -#define JAUS_QUERY_SUBSYSTEM_LIST 0x2B02 -#define JAUS_QUERY_SERVICES 0x2B03 -#define JAUS_QUERY_PAYLOAD_INTERFACE 0x2D00 -#define JAUS_QUERY_PAYLOAD_DATA_ELEMENT 0x2D01 -#define JAUS_QUERY_SPOOLING_PREFERENCE 0x2E00 -#define JAUS_QUERY_MISSION_STATUS 0x2E01 - -// Jaus Inform Class Messages -#define JAUS_REPORT_COMPONENT_AUTHORITY 0x4001 -#define JAUS_REPORT_COMPONENT_STATUS 0x4002 -#define JAUS_REPORT_TIME 0x4011 -#define JAUS_REPORT_COMPONENT_CONTROL 0x400D -#define JAUS_REPORT_EVENTS 0x41F0 -#define JAUS_EVENT 0x41F1 -#define JAUS_REPORT_DATA_LINK_STATUS 0x4200 -#define JAUS_REPORT_SELECTED_DATA_LINK_STATUS 0x4201 -#define JAUS_REPORT_HEARTBEAT_PULSE 0x4202 -#define JAUS_REPORT_PLATFORM_SPECIFICATIONS 0x4400 -#define JAUS_REPORT_PLATFORM_OPERATIONAL_DATA 0x4401 -#define JAUS_REPORT_GLOBAL_POSE 0x4402 -#define JAUS_REPORT_LOCAL_POSE 0x4403 -#define JAUS_REPORT_VELOCITY_STATE 0x4404 -#define JAUS_REPORT_WRENCH_EFFORT 0x4405 -#define JAUS_REPORT_DISCRETE_DEVICES 0x4406 -#define JAUS_REPORT_GLOBAL_VECTOR 0x4407 -#define JAUS_REPORT_LOCAL_VECTOR 0x4408 -#define JAUS_REPORT_TRAVEL_SPEED 0x440A -#define JAUS_REPORT_WAYPOINT_COUNT 0x440B -#define JAUS_REPORT_GLOBAL_WAYPOINT 0x440C -#define JAUS_REPORT_LOCAL_WAYPOINT 0x440D -#define JAUS_REPORT_PATH_SEGMENT_COUNT 0x440E -#define JAUS_REPORT_GLOBAL_PATH_SEGMENT 0x440F -#define JAUS_REPORT_LOCAL_PATH_SEGMENT 0x4410 -#define JAUS_REPORT_MANIPULATOR_SPECIFICATIONS 0x4600 -#define JAUS_REPORT_JOINT_EFFORTS 0x4601 -#define JAUS_REPORT_JOINT_POSITIONS 0x4602 -#define JAUS_REPORT_JOINT_VELOCITIES 0x4603 -#define JAUS_REPORT_TOOL_POINT 0x4604 -#define JAUS_REPORT_JOINT_FORCE_TORQUES 0x4605 -#define JAUS_REPORT_CAMERA_POSE 0x4800 -#define JAUS_REPORT_CAMERA_COUNT 0x4801 -#define JAUS_REPORT_RELATIVE_OBJECT_POSITION 0x4802 -#define JAUS_REPORT_SELECTED_CAMERA 0x4804 -#define JAUS_REPORT_CAMERA_CAPABILITIES 0x4805 -#define JAUS_REPORT_CAMERA_FORMAT_OPTIONS 0x4806 -#define JAUS_REPORT_IMAGE 0x4807 -#define JAUS_REPORT_VKS_OBJECTS_CREATION 0x4A20 -#define JAUS_REPORT_VKS_FEATURE_CLASS_METADATA 0x4A21 -#define JAUS_REPORT_VKS_BOUNDS 0x4A22 -#define JAUS_REPORT_VKS_OBJECTS 0x4A23 -#define JAUS_REPORT_VKS_DATA_TRANSFER_TERMINATION 0x4A24 -#define JAUS_REPORT_IDENTIFICATION 0x4B00 -#define JAUS_REPORT_CONFIGURATION 0x4B01 -#define JAUS_REPORT_SUBSYSTEM_LIST 0x4B02 -#define JAUS_REPORT_SERVICES 0x4B03 -#define JAUS_REPORT_PAYLOAD_INTERFACE 0x4D00 -#define JAUS_REPORT_PAYLOAD_DATA_ELEMENT 0x4D01 -#define JAUS_REPORT_SPOOLING_PREFERENCE 0x4E00 -#define JAUS_REPORT_MISSION_STATUS 0x4E01 - -// Experimental Messages -#define JAUS_SET_VELOCITY_STATE 0x0404 - -// Define JausMessage data structure -struct JausMessageStruct -{ - // Header Properties - - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // Message Data Buffer - JausByte *data; - - struct JausMessageStruct *next; -}; - -typedef struct JausMessageStruct *JausMessage; - -JAUS_EXPORT JausMessage jausMessageCreate(void); -JAUS_EXPORT void jausMessageDestroy(JausMessage); - -JAUS_EXPORT unsigned int jausMessageSize(JausMessage); - -JAUS_EXPORT JausBoolean jausMessageToBuffer(JausMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean jausMessageFromBuffer(JausMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT char *jausMessageCommandCodeString(JausMessage); -JAUS_EXPORT char *jausCommandCodeString(unsigned short commandCode); -JAUS_EXPORT JausMessage jausMessageClone(JausMessage); -JAUS_EXPORT JausBoolean jausMessageIsRejectableCommand(JausMessage message); -JAUS_EXPORT unsigned short jausMessageGetComplimentaryCommandCode(unsigned short commandCode); - - -#endif // JAUS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/jausMessageHeaders.h b/lib/openjaus/libjaus/include/message/jausMessageHeaders.h deleted file mode 100644 index 5882413dd1c5040c1afc56d7cd08b561159a1d4f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/jausMessageHeaders.h +++ /dev/null @@ -1,206 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -#ifndef JAUS_MESSAGE_HEADERS_H -#define JAUS_MESSAGE_HEADERS_H - -#include "jausMessage.h" - -// Command Class -#include "command/core/setComponentAuthorityMessage.h" -#include "command/core/shutdownMessage.h" -#include "command/core/standbyMessage.h" -#include "command/core/resumeMessage.h" -#include "command/core/resetMessage.h" -#include "command/core/setEmergencyMessage.h" -#include "command/core/clearEmergencyMessage.h" -#include "command/core/createServiceConnectionMessage.h" -#include "command/core/confirmServiceConnectionMessage.h" -#include "command/core/activateServiceConnectionMessage.h" -#include "command/core/suspendServiceConnectionMessage.h" -#include "command/core/terminateServiceConnectionMessage.h" -#include "command/core/requestComponentControlMessage.h" -#include "command/core/releaseComponentControlMessage.h" -#include "command/core/confirmComponentControlMessage.h" -#include "command/core/rejectComponentControlMessage.h" -#include "command/core/setTimeMessage.h" -#include "command/communications/setDataLinkStatusMessage.h" -#include "command/communications/setDataLinkSelectMessage.h" -#include "command/communications/setSelectedDataLinkStateMessage.h" -#include "command/environment/selectCameraMessage.h" -#include "command/environment/setCameraPoseMessage.h" -#include "command/environment/setCameraCapabilitiesMessage.h" -#include "command/environment/setCameraFormatOptionsMessage.h" -#include "command/manipulator/setJointEffortsMessage.h" -#include "command/manipulator/setJointPositionsMessage.h" -#include "command/manipulator/setJointVelocitiesMessage.h" -#include "command/manipulator/setToolPointMessage.h" -#include "command/manipulator/setEndEffectorPoseMessage.h" -#include "command/manipulator/setEndEffectorVelocityStateMessage.h" -#include "command/manipulator/setJointMotionMessage.h" -#include "command/manipulator/setEndEffectorPathMotionMessage.h" -#include "command/platform/setWrenchEffortMessage.h" -#include "command/platform/setDiscreteDevicesMessage.h" -#include "command/platform/setGlobalVectorMessage.h" -#include "command/platform/setLocalVectorMessage.h" -#include "command/platform/setTravelSpeedMessage.h" -#include "command/platform/setGlobalWaypointMessage.h" -#include "command/platform/setLocalWaypointMessage.h" -#include "command/platform/setVelocityStateMessage.h" -#include "command/platform/setGlobalPathSegmentMessage.h" -#include "command/platform/setLocalPathSegmentMessage.h" -#include "command/planning/abortMissionMessage.h" -#include "command/planning/pauseMissionMessage.h" -#include "command/planning/removeMessagesMessage.h" -#include "command/planning/resumeMissionMessage.h" -#include "command/planning/runMissionMessage.h" -#include "command/planning/spoolMissionMessage.h" -#include "command/planning/replaceMessagesMessage.h" -#include "command/worldModel/createVksObjectsMessage.h" -#include "command/worldModel/deleteVksObjectsMessage.h" -#include "command/worldModel/setVksFeatureClassMetadataMessage.h" -#include "command/worldModel/terminateVksDataTransferMessage.h" -#include "command/payload/setPayloadDataElementMessage.h" -#include "command/event/cancelEventMessage.h" -#include "command/event/confirmEventRequestMessage.h" -#include "command/event/createEventMessage.h" -#include "command/event/updateEventMessage.h" -#include "command/event/rejectEventRequestMessage.h" - - -// Inform Class -#include "inform/core/reportComponentAuthorityMessage.h" -#include "inform/core/reportComponentStatusMessage.h" -#include "inform/core/reportTimeMessage.h" -#include "inform/core/reportComponentControlMessage.h" -#include "inform/communications/reportDataLinkStatusMessage.h" -#include "inform/communications/reportSelectedDataLinkStatusMessage.h" -#include "inform/communications/reportHeartbeatPulseMessage.h" -#include "inform/environment/reportImageMessage.h" -#include "inform/environment/reportCameraPoseMessage.h" -#include "inform/environment/reportCameraCountMessage.h" -#include "inform/environment/reportCameraCapabilitiesMessage.h" -#include "inform/environment/reportCameraFormatOptionsMessage.h" -#include "inform/environment/reportRelativeObjectPositionMessage.h" -#include "inform/environment/reportSelectedCameraMessage.h" -#include "inform/manipulator/reportManipulatorSpecificationsMessage.h" -#include "inform/manipulator/reportJointEffortsMessage.h" -#include "inform/manipulator/reportJointPositionsMessage.h" -#include "inform/manipulator/reportJointVelocitiesMessage.h" -#include "inform/manipulator/reportJointForceTorquesMessage.h" -#include "inform/manipulator/reportToolPointMessage.h" -#include "inform/platform/reportPlatformSpecificationsMessage.h" -#include "inform/platform/reportPlatformOperationalDataMessage.h" -#include "inform/platform/reportGlobalPoseMessage.h" -#include "inform/platform/reportLocalPoseMessage.h" -#include "inform/platform/reportVelocityStateMessage.h" -#include "inform/platform/reportWrenchEffortMessage.h" -#include "inform/platform/reportDiscreteDevicesMessage.h" -#include "inform/platform/reportGlobalVectorMessage.h" -#include "inform/platform/reportLocalVectorMessage.h" -#include "inform/platform/reportTravelSpeedMessage.h" -#include "inform/platform/reportWaypointCountMessage.h" -#include "inform/platform/reportGlobalWaypointMessage.h" -#include "inform/platform/reportLocalWaypointMessage.h" -#include "inform/platform/reportPathSegmentCountMessage.h" -#include "inform/platform/reportGlobalPathSegmentMessage.h" -#include "inform/platform/reportLocalPathSegmentMessage.h" -#include "inform/planning/reportMissionStatusMessage.h" -#include "inform/planning/reportSpoolingPreferenceMessage.h" -#include "inform/dynamicConfiguration/reportIdentificationMessage.h" -#include "inform/dynamicConfiguration/reportConfigurationMessage.h" -#include "inform/dynamicConfiguration/reportServicesMessage.h" -#include "inform/dynamicConfiguration/reportSubsystemListMessage.h" -#include "inform/payload/reportPayloadDataElementMessage.h" -#include "inform/payload/reportPayloadInterfaceMessage.h" -#include "inform/worldModel/reportVksBoundsMessage.h" -#include "inform/worldModel/reportVksFeatureClassMetadataMessage.h" -#include "inform/worldModel/reportVksObjectsCreationMessage.h" -#include "inform/worldModel/reportVksObjectsMessage.h" -#include "inform/worldModel/reportVksDataTransferTerminationMessage.h" -#include "inform/event/reportEventsMessage.h" -#include "inform/event/eventMessage.h" - -// Query Class -#include "query/core/queryComponentAuthorityMessage.h" -#include "query/core/queryComponentStatusMessage.h" -#include "query/core/queryTimeMessage.h" -#include "query/core/queryComponentControlMessage.h" -#include "query/communications/queryDataLinkStatusMessage.h" -#include "query/communications/querySelectedDataLinkStatusMessage.h" -#include "query/environment/queryImageMessage.h" -#include "query/environment/queryCameraPoseMessage.h" -#include "query/environment/queryCameraCountMessage.h" -#include "query/environment/queryCameraCapabilitiesMessage.h" -#include "query/environment/queryCameraFormatOptionsMessage.h" -#include "query/environment/queryRelativeObjectPositionMessage.h" -#include "query/environment/querySelectedCameraMessage.h" -#include "query/manipulator/queryManipulatorSpecificationsMessage.h" -#include "query/manipulator/queryJointEffortsMessage.h" -#include "query/manipulator/queryJointPositionsMessage.h" -#include "query/manipulator/queryJointVelocitiesMessage.h" -#include "query/manipulator/queryToolPointMessage.h" -#include "query/manipulator/queryJointForceTorquesMessage.h" -#include "query/platform/queryPlatformSpecificationsMessage.h" -#include "query/platform/queryPlatformOperationalDataMessage.h" -#include "query/platform/queryGlobalPoseMessage.h" -#include "query/platform/queryLocalPoseMessage.h" -#include "query/platform/queryVelocityStateMessage.h" -#include "query/platform/queryWrenchEffortMessage.h" -#include "query/platform/queryDiscreteDevicesMessage.h" -#include "query/platform/queryGlobalVectorMessage.h" -#include "query/platform/queryLocalVectorMessage.h" -#include "query/platform/queryTravelSpeedMessage.h" -#include "query/platform/queryWaypointCountMessage.h" -#include "query/platform/queryGlobalWaypointMessage.h" -#include "query/platform/queryLocalWaypointMessage.h" -#include "query/platform/queryPathSegmentCountMessage.h" -#include "query/platform/queryGlobalPathSegmentMessage.h" -#include "query/platform/queryLocalPathSegmentMessage.h" -#include "query/planning/queryMissionStatusMessage.h" -#include "query/planning/querySpoolingPreferenceMessage.h" -#include "query/communications/queryHeartbeatPulseMessage.h" -#include "query/dynamicConfiguration/queryIdentificationMessage.h" -#include "query/dynamicConfiguration/queryConfigurationMessage.h" -#include "query/dynamicConfiguration/queryServicesMessage.h" -#include "query/dynamicConfiguration/querySubsystemListMessage.h" -#include "query/payload/queryPayloadDataElementMessage.h" -#include "query/payload/queryPayloadInterfaceMessage.h" -#include "query/worldModel/queryVksBoundsMessage.h" -#include "query/worldModel/queryVksFeatureClassMetadataMessage.h" -#include "query/worldModel/queryVksObjectsMessage.h" -#include "query/event/queryEventsMessage.h" - -// Experimental - -#endif //JAUS_MESSAGE_HEADERS_H diff --git a/lib/openjaus/libjaus/include/message/query/communications/queryDataLinkStatusMessage.h b/lib/openjaus/libjaus/include/message/query/communications/queryDataLinkStatusMessage.h deleted file mode 100644 index e8bc6a410a7834f5926cb29cc7c5eec06d3eb3f1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/communications/queryDataLinkStatusMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryDataLinkStatusMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryDataLinkStatusMessage - -#ifndef QUERY_DATA_LINK_STATUS_MESSAGE_H -#define QUERY_DATA_LINK_STATUS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - - JausByte dataLinkId; - -}QueryDataLinkStatusMessageStruct; - -typedef QueryDataLinkStatusMessageStruct* QueryDataLinkStatusMessage; - -JAUS_EXPORT QueryDataLinkStatusMessage queryDataLinkStatusMessageCreate(void); -JAUS_EXPORT void queryDataLinkStatusMessageDestroy(QueryDataLinkStatusMessage); - -JAUS_EXPORT JausBoolean queryDataLinkStatusMessageFromBuffer(QueryDataLinkStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryDataLinkStatusMessageToBuffer(QueryDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryDataLinkStatusMessage queryDataLinkStatusMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryDataLinkStatusMessageToJausMessage(QueryDataLinkStatusMessage message); - -JAUS_EXPORT unsigned int queryDataLinkStatusMessageSize(QueryDataLinkStatusMessage message); - -#endif // QUERY_DATA_LINK_STATUS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/communications/queryHeartbeatPulseMessage.h b/lib/openjaus/libjaus/include/message/query/communications/queryHeartbeatPulseMessage.h deleted file mode 100644 index 5388e898330bc92b8d0a79afe1e7e49171d8b373..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/communications/queryHeartbeatPulseMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryHeartbeatPulseMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryHeartbeatPulseMessage - -#ifndef QUERY_HEARTBEAT_PULSE_MESSAGE_H -#define QUERY_HEARTBEAT_PULSE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No Message Fields - -}QueryHeartbeatPulseMessageStruct; - -typedef QueryHeartbeatPulseMessageStruct* QueryHeartbeatPulseMessage; - -JAUS_EXPORT QueryHeartbeatPulseMessage queryHeartbeatPulseMessageCreate(void); -JAUS_EXPORT void queryHeartbeatPulseMessageDestroy(QueryHeartbeatPulseMessage); - -JAUS_EXPORT JausBoolean queryHeartbeatPulseMessageFromBuffer(QueryHeartbeatPulseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryHeartbeatPulseMessageToBuffer(QueryHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryHeartbeatPulseMessage queryHeartbeatPulseMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryHeartbeatPulseMessageToJausMessage(QueryHeartbeatPulseMessage message); - -JAUS_EXPORT unsigned int queryHeartbeatPulseMessageSize(QueryHeartbeatPulseMessage message); - -#endif // QUERY_HEARTBEAT_PULSE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/communications/querySelectedDataLinkStatusMessage.h b/lib/openjaus/libjaus/include/message/query/communications/querySelectedDataLinkStatusMessage.h deleted file mode 100644 index 949d3daf4dc77ea162c6b0f3d2d1a42e4aafe134..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/communications/querySelectedDataLinkStatusMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: querySelectedDataLinkStatusMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QuerySelectedDataLinkStatusMessage - -#ifndef QUERY_SELECTED_DATA_LINK_STATUS_MESSAGE_H -#define QUERY_SELECTED_DATA_LINK_STATUS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - -}QuerySelectedDataLinkStatusMessageStruct; - -typedef QuerySelectedDataLinkStatusMessageStruct* QuerySelectedDataLinkStatusMessage; - -JAUS_EXPORT QuerySelectedDataLinkStatusMessage querySelectedDataLinkStatusMessageCreate(void); -JAUS_EXPORT void querySelectedDataLinkStatusMessageDestroy(QuerySelectedDataLinkStatusMessage); - -JAUS_EXPORT JausBoolean querySelectedDataLinkStatusMessageFromBuffer(QuerySelectedDataLinkStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean querySelectedDataLinkStatusMessageToBuffer(QuerySelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QuerySelectedDataLinkStatusMessage querySelectedDataLinkStatusMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage querySelectedDataLinkStatusMessageToJausMessage(QuerySelectedDataLinkStatusMessage message); - -JAUS_EXPORT unsigned int querySelectedDataLinkStatusMessageSize(QuerySelectedDataLinkStatusMessage message); - -#endif // QUERY_SELECTED_DATA_LINK_STATUS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/core/queryComponentAuthorityMessage.h b/lib/openjaus/libjaus/include/message/query/core/queryComponentAuthorityMessage.h deleted file mode 100644 index 653f116b0f168af9d2f9ae7e09d01d6483c4fca6..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/core/queryComponentAuthorityMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryComponentAuthorityMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryComponentAuthorityMessage - -#ifndef QUERY_COMPONENT_AUTHORITY_MESSAGE_H -#define QUERY_COMPONENT_AUTHORITY_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - // No Fields - -}QueryComponentAuthorityMessageStruct; - -typedef QueryComponentAuthorityMessageStruct* QueryComponentAuthorityMessage; - -JAUS_EXPORT QueryComponentAuthorityMessage queryComponentAuthorityMessageCreate(void); -JAUS_EXPORT void queryComponentAuthorityMessageDestroy(QueryComponentAuthorityMessage); - -JAUS_EXPORT JausBoolean queryComponentAuthorityMessageFromBuffer(QueryComponentAuthorityMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryComponentAuthorityMessageToBuffer(QueryComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryComponentAuthorityMessage queryComponentAuthorityMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryComponentAuthorityMessageToJausMessage(QueryComponentAuthorityMessage message); - -JAUS_EXPORT unsigned int queryComponentAuthorityMessageSize(QueryComponentAuthorityMessage message); - -#endif // QUERY_COMPONENT_AUTHORITY_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/core/queryComponentControlMessage.h b/lib/openjaus/libjaus/include/message/query/core/queryComponentControlMessage.h deleted file mode 100644 index 447e3f19f559c226d8f4794c135f3b93fadbae6e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/core/queryComponentControlMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryComponentControlMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryComponentControlMessage - -#ifndef QUERY_COMPONENT_CONTROL_MESSAGE_H -#define QUERY_COMPONENT_CONTROL_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - // No Fields - -}QueryComponentControlMessageStruct; - -typedef QueryComponentControlMessageStruct* QueryComponentControlMessage; - -JAUS_EXPORT QueryComponentControlMessage queryComponentControlMessageCreate(void); -JAUS_EXPORT void queryComponentControlMessageDestroy(QueryComponentControlMessage); - -JAUS_EXPORT JausBoolean queryComponentControlMessageFromBuffer(QueryComponentControlMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryComponentControlMessageToBuffer(QueryComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryComponentControlMessage queryComponentControlMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryComponentControlMessageToJausMessage(QueryComponentControlMessage message); - -JAUS_EXPORT unsigned int queryComponentControlMessageSize(QueryComponentControlMessage message); - -#endif // QUERY_COMPONENT_CONTROL_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/core/queryComponentStatusMessage.h b/lib/openjaus/libjaus/include/message/query/core/queryComponentStatusMessage.h deleted file mode 100644 index cc831cb6db8e55e894fbf2ab5343227f05c42e0f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/core/queryComponentStatusMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryComponentStatusMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryComponentStatusMessage - -#ifndef QUERY_COMPONENT_STATUS_MESSAGE_H -#define QUERY_COMPONENT_STATUS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - // No Message Fields - -}QueryComponentStatusMessageStruct; - -typedef QueryComponentStatusMessageStruct* QueryComponentStatusMessage; - -JAUS_EXPORT QueryComponentStatusMessage queryComponentStatusMessageCreate(void); -JAUS_EXPORT void queryComponentStatusMessageDestroy(QueryComponentStatusMessage); - -JAUS_EXPORT JausBoolean queryComponentStatusMessageFromBuffer(QueryComponentStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryComponentStatusMessageToBuffer(QueryComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryComponentStatusMessage queryComponentStatusMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryComponentStatusMessageToJausMessage(QueryComponentStatusMessage message); - -JAUS_EXPORT unsigned int queryComponentStatusMessageSize(QueryComponentStatusMessage message); - -#endif // QUERY_COMPONENT_STATUS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/core/queryTimeMessage.h b/lib/openjaus/libjaus/include/message/query/core/queryTimeMessage.h deleted file mode 100644 index dce41f7e7b9b19180284cfe3cbec57a2f41a2838..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/core/queryTimeMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryTimeMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a queryTimeMessage - -#ifndef QUERY_TIME_MESSAGE_H -#define QUERY_TIME_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; - -}QueryTimeMessageStruct; - -typedef QueryTimeMessageStruct* QueryTimeMessage; - -JAUS_EXPORT QueryTimeMessage queryTimeMessageCreate(void); -JAUS_EXPORT void queryTimeMessageDestroy(QueryTimeMessage); - -JAUS_EXPORT JausBoolean queryTimeMessageFromBuffer(QueryTimeMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryTimeMessageToBuffer(QueryTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryTimeMessage queryTimeMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryTimeMessageToJausMessage(QueryTimeMessage message); - -JAUS_EXPORT unsigned int queryTimeMessageSize(QueryTimeMessage message); - -#endif // QUERY_TIME_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/dynamicConfiguration/queryConfigurationMessage.h b/lib/openjaus/libjaus/include/message/query/dynamicConfiguration/queryConfigurationMessage.h deleted file mode 100644 index cb5531ac46baca2331a043940239d411cd4d46b9..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/dynamicConfiguration/queryConfigurationMessage.h +++ /dev/null @@ -1,110 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryConfigurationMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryConfigurationMessage - -#ifndef QUERY_CONFIGURATION_MESSAGE_H -#define QUERY_CONFIGURATION_MESSAGE_H - -#include "jaus.h" - -#define JAUS_SYSTEM_CONFIGURATION 1 -#define JAUS_SUBSYSTEM_CONFIGURATION 2 -#define JAUS_NODE_CONFIGURATION 3 -#define JAUS_COMPONENT_CONFIGURATION 4 -#define JAUS_INSTANCE_CONFIGURATION 5 - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte queryField; - -}QueryConfigurationMessageStruct; - -typedef QueryConfigurationMessageStruct* QueryConfigurationMessage; - -JAUS_EXPORT QueryConfigurationMessage queryConfigurationMessageCreate(void); -JAUS_EXPORT void queryConfigurationMessageDestroy(QueryConfigurationMessage); - -JAUS_EXPORT JausBoolean queryConfigurationMessageFromBuffer(QueryConfigurationMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryConfigurationMessageToBuffer(QueryConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryConfigurationMessage queryConfigurationMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryConfigurationMessageToJausMessage(QueryConfigurationMessage message); - -JAUS_EXPORT unsigned int queryConfigurationMessageSize(QueryConfigurationMessage message); - -#endif // QUERY_CONFIGURATION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/dynamicConfiguration/queryIdentificationMessage.h b/lib/openjaus/libjaus/include/message/query/dynamicConfiguration/queryIdentificationMessage.h deleted file mode 100644 index e78e0adc39cce65c71112b72b50fc8d8143a0557..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/dynamicConfiguration/queryIdentificationMessage.h +++ /dev/null @@ -1,113 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryIdentificationMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryIdentificationMessage - -#ifndef QUERY_IDENTIFICATION_MESSAGE_H -#define QUERY_IDENTIFICATION_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_IDENTIFICATION_TYPE -#define JAUS_IDENTIFICATION_TYPE -#define JAUS_QUERY_FIELD_RESERVED 0 -#define JAUS_QUERY_FIELD_SYSTEM_IDENTITY 1 -#define JAUS_QUERY_FIELD_SS_IDENTITY 2 -#define JAUS_QUERY_FIELD_NODE_IDENTITY 3 -#define JAUS_QUERY_FIELD_COMPONENT_IDENTITY 4 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte queryField; - -}QueryIdentificationMessageStruct; - -typedef QueryIdentificationMessageStruct* QueryIdentificationMessage; - -JAUS_EXPORT QueryIdentificationMessage queryIdentificationMessageCreate(void); -JAUS_EXPORT void queryIdentificationMessageDestroy(QueryIdentificationMessage); - -JAUS_EXPORT JausBoolean queryIdentificationMessageFromBuffer(QueryIdentificationMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryIdentificationMessageToBuffer(QueryIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryIdentificationMessage queryIdentificationMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryIdentificationMessageToJausMessage(QueryIdentificationMessage message); - -JAUS_EXPORT unsigned int queryIdentificationMessageSize(QueryIdentificationMessage message); - -#endif // QUERY_IDENTIFICATION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/dynamicConfiguration/queryServicesMessage.h b/lib/openjaus/libjaus/include/message/query/dynamicConfiguration/queryServicesMessage.h deleted file mode 100644 index 5c2c53815dcdbd4376415485d6660a68be66d6ea..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/dynamicConfiguration/queryServicesMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryServicesMessage.h -// -// Written By: Bob Touchton, inspired by Danny Kent -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// This file defines the attributes of a QueryServicesMessage - -#ifndef QUERY_SERVICES_MESSAGE_H -#define QUERY_SERVICES_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No Message Fields - -}QueryServicesMessageStruct; - -typedef QueryServicesMessageStruct* QueryServicesMessage; - -JAUS_EXPORT QueryServicesMessage queryServicesMessageCreate(void); -JAUS_EXPORT void queryServicesMessageDestroy(QueryServicesMessage); - -JAUS_EXPORT JausBoolean queryServicesMessageFromBuffer(QueryServicesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryServicesMessageToBuffer(QueryServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryServicesMessage queryServicesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryServicesMessageToJausMessage(QueryServicesMessage message); - -JAUS_EXPORT unsigned int queryServicesMessageSize(QueryServicesMessage message); - -#endif // QUERY_SERVICES_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/dynamicConfiguration/querySubsystemListMessage.h b/lib/openjaus/libjaus/include/message/query/dynamicConfiguration/querySubsystemListMessage.h deleted file mode 100644 index 30da5b9c5414a4a96f959374b2768ee3beed3833..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/dynamicConfiguration/querySubsystemListMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: querySubsystemListMessage.h -// -// Written By: Bob Touchton, inspired by Danny Kent -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// This file defines the attributes of a QuerySubsystemListMessage - -#ifndef QUERY_SUBSYSTEM_LIST_MESSAGE_H -#define QUERY_SUBSYSTEM_LIST_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No Message Fields - -}QuerySubsystemListMessageStruct; - -typedef QuerySubsystemListMessageStruct* QuerySubsystemListMessage; - -JAUS_EXPORT QuerySubsystemListMessage querySubsystemListMessageCreate(void); -JAUS_EXPORT void querySubsystemListMessageDestroy(QuerySubsystemListMessage); - -JAUS_EXPORT JausBoolean querySubsystemListMessageFromBuffer(QuerySubsystemListMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean querySubsystemListMessageToBuffer(QuerySubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QuerySubsystemListMessage querySubsystemListMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage querySubsystemListMessageToJausMessage(QuerySubsystemListMessage message); - -JAUS_EXPORT unsigned int querySubsystemListMessageSize(QuerySubsystemListMessage message); - -#endif // QUERY_SUBSYSTEM_LIST_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/environment/queryCameraCapabilitiesMessage.h b/lib/openjaus/libjaus/include/message/query/environment/queryCameraCapabilitiesMessage.h deleted file mode 100644 index 9fc183ce1472cb408c490e8d63d919e78ba62489..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/environment/queryCameraCapabilitiesMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryCameraCapabilitiesMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryCameraCapabilitiesMessage - -#ifndef QUERY_CAMERA_CAPABILITIES_MESSAGE_H -#define QUERY_CAMERA_CAPABILITIES_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausUnsignedShort presenceVector; - JausByte cameraID; - -}QueryCameraCapabilitiesMessageStruct; - -typedef QueryCameraCapabilitiesMessageStruct* QueryCameraCapabilitiesMessage; - -JAUS_EXPORT QueryCameraCapabilitiesMessage queryCameraCapabilitiesMessageCreate(void); -JAUS_EXPORT void queryCameraCapabilitiesMessageDestroy(QueryCameraCapabilitiesMessage); - -JAUS_EXPORT JausBoolean queryCameraCapabilitiesMessageFromBuffer(QueryCameraCapabilitiesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryCameraCapabilitiesMessageToBuffer(QueryCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryCameraCapabilitiesMessage queryCameraCapabilitiesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryCameraCapabilitiesMessageToJausMessage(QueryCameraCapabilitiesMessage message); - -JAUS_EXPORT unsigned int queryCameraCapabilitiesMessageSize(QueryCameraCapabilitiesMessage message); - -#endif // QUERY_CAMERA_CAPABILITIES_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/environment/queryCameraCountMessage.h b/lib/openjaus/libjaus/include/message/query/environment/queryCameraCountMessage.h deleted file mode 100644 index ad3f40b894e1dd38fb9f675b2c3837fc3628d65e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/environment/queryCameraCountMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryCameraCountMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryCameraCountMessage - -#ifndef QUERY_CAMERA_COUNT_MESSAGE_H -#define QUERY_CAMERA_COUNT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - // No Members - -}QueryCameraCountMessageStruct; - -typedef QueryCameraCountMessageStruct* QueryCameraCountMessage; - -JAUS_EXPORT QueryCameraCountMessage queryCameraCountMessageCreate(void); -JAUS_EXPORT void queryCameraCountMessageDestroy(QueryCameraCountMessage); - -JAUS_EXPORT JausBoolean queryCameraCountMessageFromBuffer(QueryCameraCountMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryCameraCountMessageToBuffer(QueryCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryCameraCountMessage queryCameraCountMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryCameraCountMessageToJausMessage(QueryCameraCountMessage message); - -JAUS_EXPORT unsigned int queryCameraCountMessageSize(QueryCameraCountMessage message); - -#endif // QUERY_CAMERA_COUNT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/environment/queryCameraFormatOptionsMessage.h b/lib/openjaus/libjaus/include/message/query/environment/queryCameraFormatOptionsMessage.h deleted file mode 100644 index da6c66a6007e55421c674aec07753ec744a2db1a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/environment/queryCameraFormatOptionsMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryCameraFormatOptionsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryCameraFormatOptionsMessage - -#ifndef QUERY_CAMERA_FORMAT_OPTIONS_MESSAGE_H -#define QUERY_CAMERA_FORMAT_OPTIONS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; - JausByte cameraID; - -}QueryCameraFormatOptionsMessageStruct; - -typedef QueryCameraFormatOptionsMessageStruct* QueryCameraFormatOptionsMessage; - -JAUS_EXPORT QueryCameraFormatOptionsMessage queryCameraFormatOptionsMessageCreate(void); -JAUS_EXPORT void queryCameraFormatOptionsMessageDestroy(QueryCameraFormatOptionsMessage); - -JAUS_EXPORT JausBoolean queryCameraFormatOptionsMessageFromBuffer(QueryCameraFormatOptionsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryCameraFormatOptionsMessageToBuffer(QueryCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryCameraFormatOptionsMessage queryCameraFormatOptionsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryCameraFormatOptionsMessageToJausMessage(QueryCameraFormatOptionsMessage message); - -JAUS_EXPORT unsigned int queryCameraFormatOptionsMessageSize(QueryCameraFormatOptionsMessage message); - -#endif // QUERY_CAMERA_FORMAT_OPTIONS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/environment/queryCameraPoseMessage.h b/lib/openjaus/libjaus/include/message/query/environment/queryCameraPoseMessage.h deleted file mode 100644 index c7feca564578549f91079f630478157a03ad38d5..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/environment/queryCameraPoseMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryCameraPoseMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryCameraPoseMessage - -#ifndef QUERY_CAMERA_POSE_MESSAGE_H -#define QUERY_CAMERA_POSE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausUnsignedShort presenceVector; - JausByte cameraID; - -}QueryCameraPoseMessageStruct; - -typedef QueryCameraPoseMessageStruct* QueryCameraPoseMessage; - -JAUS_EXPORT QueryCameraPoseMessage queryCameraPoseMessageCreate(void); -JAUS_EXPORT void queryCameraPoseMessageDestroy(QueryCameraPoseMessage); - -JAUS_EXPORT JausBoolean queryCameraPoseMessageFromBuffer(QueryCameraPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryCameraPoseMessageToBuffer(QueryCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryCameraPoseMessage queryCameraPoseMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryCameraPoseMessageToJausMessage(QueryCameraPoseMessage message); - -JAUS_EXPORT unsigned int queryCameraPoseMessageSize(QueryCameraPoseMessage message); - -#endif // QUERY_CAMERA_POSE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/environment/queryImageMessage.h b/lib/openjaus/libjaus/include/message/query/environment/queryImageMessage.h deleted file mode 100644 index d29f734e455b4ec79caac2b500c381a04a9cd2b1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/environment/queryImageMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryImageMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryImageMessage - -#ifndef QUERY_IMAGE_MESSAGE_H -#define QUERY_IMAGE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - -}QueryImageMessageStruct; - -typedef QueryImageMessageStruct* QueryImageMessage; - -JAUS_EXPORT QueryImageMessage queryImageMessageCreate(void); -JAUS_EXPORT void queryImageMessageDestroy(QueryImageMessage); - -JAUS_EXPORT JausBoolean queryImageMessageFromBuffer(QueryImageMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryImageMessageToBuffer(QueryImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryImageMessage queryImageMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryImageMessageToJausMessage(QueryImageMessage message); - -JAUS_EXPORT unsigned int queryImageMessageSize(QueryImageMessage message); - -#endif // QUERY_IMAGE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/environment/queryRelativeObjectPositionMessage.h b/lib/openjaus/libjaus/include/message/query/environment/queryRelativeObjectPositionMessage.h deleted file mode 100644 index 0845a2c0b5a5489e47f6b01084b5188ca41db598..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/environment/queryRelativeObjectPositionMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryRelativeObjectPositionMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryRelativeObjectPositionMessage - -#ifndef QUERY_RELATIVE_OBJECT_POSITION_MESSAGE_H -#define QUERY_RELATIVE_OBJECT_POSITION_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; - -}QueryRelativeObjectPositionMessageStruct; - -typedef QueryRelativeObjectPositionMessageStruct* QueryRelativeObjectPositionMessage; - -JAUS_EXPORT QueryRelativeObjectPositionMessage queryRelativeObjectPositionMessageCreate(void); -JAUS_EXPORT void queryRelativeObjectPositionMessageDestroy(QueryRelativeObjectPositionMessage); - -JAUS_EXPORT JausBoolean queryRelativeObjectPositionMessageFromBuffer(QueryRelativeObjectPositionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryRelativeObjectPositionMessageToBuffer(QueryRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryRelativeObjectPositionMessage queryRelativeObjectPositionMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryRelativeObjectPositionMessageToJausMessage(QueryRelativeObjectPositionMessage message); - -JAUS_EXPORT unsigned int queryRelativeObjectPositionMessageSize(QueryRelativeObjectPositionMessage message); - -#endif // QUERY_RELATIVE_OBJECT_POSITION_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/environment/querySelectedCameraMessage.h b/lib/openjaus/libjaus/include/message/query/environment/querySelectedCameraMessage.h deleted file mode 100644 index 3151bda1eab2ef28892cdf273a17882d8c587105..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/environment/querySelectedCameraMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: querySelectedCameraMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QuerySelectedCameraMessage - -#ifndef QUERY_SELECTED_CAMERA_MESSAGE_H -#define QUERY_SELECTED_CAMERA_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - // No Data - -}QuerySelectedCameraMessageStruct; - -JAUS_EXPORT typedef QuerySelectedCameraMessageStruct* QuerySelectedCameraMessage; - -JAUS_EXPORT QuerySelectedCameraMessage querySelectedCameraMessageCreate(void); -JAUS_EXPORT void querySelectedCameraMessageDestroy(QuerySelectedCameraMessage); - -JAUS_EXPORT JausBoolean querySelectedCameraMessageFromBuffer(QuerySelectedCameraMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean querySelectedCameraMessageToBuffer(QuerySelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QuerySelectedCameraMessage querySelectedCameraMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage querySelectedCameraMessageToJausMessage(QuerySelectedCameraMessage message); - -JAUS_EXPORT unsigned int querySelectedCameraMessageSize(QuerySelectedCameraMessage message); - -#endif // QUERY_SELECTED_CAMERA_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/event/queryEventsMessage.h b/lib/openjaus/libjaus/include/message/query/event/queryEventsMessage.h deleted file mode 100644 index abf59c0fa2713401524bd80bde7de47fd1af927a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/event/queryEventsMessage.h +++ /dev/null @@ -1,116 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryEventsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryEventsMessage - -#ifndef QUERY_EVENTS_MESSAGE_H -#define QUERY_EVENTS_MESSAGE_H - -#include "jaus.h" - -#ifndef QUERY_EVENTS_PV -#define QUERY_EVENTS_PV_MESSAGE_CODE_BIT 0 // Field 2 -#define QUERY_EVENTS_PV_EVENT_TYPE_BIT 1 // Field 3 -#define QUERY_EVENTS_PV_EVENT_ID_BIT 2 // Field 4 -#endif - - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; - JausUnsignedShort messageCode; - JausByte eventType; - JausByte eventId; - -}QueryEventsMessageStruct; - -typedef QueryEventsMessageStruct* QueryEventsMessage; - -JAUS_EXPORT QueryEventsMessage queryEventsMessageCreate(void); -JAUS_EXPORT void queryEventsMessageDestroy(QueryEventsMessage); - -JAUS_EXPORT JausBoolean queryEventsMessageFromBuffer(QueryEventsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryEventsMessageToBuffer(QueryEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryEventsMessage queryEventsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryEventsMessageToJausMessage(QueryEventsMessage message); - -unsigned int queryEventsMessageSize(QueryEventsMessage message); - - -#endif // QUERY_EVENTS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/manipulator/queryJointEffortsMessage.h b/lib/openjaus/libjaus/include/message/query/manipulator/queryJointEffortsMessage.h deleted file mode 100644 index bffd1d5edb0c3973056a5aa3dc7513a98e6b0cc0..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/manipulator/queryJointEffortsMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryJointEffortsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryJointEffortsMessage - -#ifndef QUERY_JOINT_EFFORTS_MESSAGE_H -#define QUERY_JOINT_EFFORTS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - -}QueryJointEffortsMessageStruct; - -typedef QueryJointEffortsMessageStruct* QueryJointEffortsMessage; - -JAUS_EXPORT QueryJointEffortsMessage queryJointEffortsMessageCreate(void); -JAUS_EXPORT void queryJointEffortsMessageDestroy(QueryJointEffortsMessage); - -JAUS_EXPORT JausBoolean queryJointEffortsMessageFromBuffer(QueryJointEffortsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryJointEffortsMessageToBuffer(QueryJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryJointEffortsMessage queryJointEffortsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryJointEffortsMessageToJausMessage(QueryJointEffortsMessage message); - -JAUS_EXPORT unsigned int queryJointEffortsMessageSize(QueryJointEffortsMessage message); - -#endif // QUERY_JOINT_EFFORTS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/manipulator/queryJointForceTorquesMessage.h b/lib/openjaus/libjaus/include/message/query/manipulator/queryJointForceTorquesMessage.h deleted file mode 100644 index b24f8afccd0e31fb8990bf9c3e04f51d14943572..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/manipulator/queryJointForceTorquesMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryJointForceTorquesMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryJointForceTorquesMessage - -#ifndef QUERY_JOINT_FORCE_TORQUES_MESSAGE_H -#define QUERY_JOINT_FORCE_TORQUES_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - -}QueryJointForceTorquesMessageStruct; - -typedef QueryJointForceTorquesMessageStruct* QueryJointForceTorquesMessage; - -JAUS_EXPORT QueryJointForceTorquesMessage queryJointForceTorquesMessageCreate(void); -JAUS_EXPORT void queryJointForceTorquesMessageDestroy(QueryJointForceTorquesMessage); - -JAUS_EXPORT JausBoolean queryJointForceTorquesMessageFromBuffer(QueryJointForceTorquesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryJointForceTorquesMessageToBuffer(QueryJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryJointForceTorquesMessage queryJointForceTorquesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryJointForceTorquesMessageToJausMessage(QueryJointForceTorquesMessage message); - -JAUS_EXPORT unsigned int queryJointForceTorquesMessageSize(QueryJointForceTorquesMessage message); - -#endif // QUERY_JOINT_FORCE_TORQUES_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/manipulator/queryJointPositionsMessage.h b/lib/openjaus/libjaus/include/message/query/manipulator/queryJointPositionsMessage.h deleted file mode 100644 index a0f24fd1602383c15c09df04570cfc1892ca33ed..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/manipulator/queryJointPositionsMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryJointPositionsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryJointPositionsMessage - -#ifndef QUERY_JOINT_POSITIONS_MESSAGE_H -#define QUERY_JOINT_POSITIONS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - -}QueryJointPositionsMessageStruct; - -typedef QueryJointPositionsMessageStruct* QueryJointPositionsMessage; - -JAUS_EXPORT QueryJointPositionsMessage queryJointPositionsMessageCreate(void); -JAUS_EXPORT void queryJointPositionsMessageDestroy(QueryJointPositionsMessage); - -JAUS_EXPORT JausBoolean queryJointPositionsMessageFromBuffer(QueryJointPositionsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryJointPositionsMessageToBuffer(QueryJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryJointPositionsMessage queryJointPositionsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryJointPositionsMessageToJausMessage(QueryJointPositionsMessage message); - -JAUS_EXPORT unsigned int queryJointPositionsMessageSize(QueryJointPositionsMessage message); - -#endif // QUERY_JOINT_POSITIONS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/manipulator/queryJointVelocitiesMessage.h b/lib/openjaus/libjaus/include/message/query/manipulator/queryJointVelocitiesMessage.h deleted file mode 100644 index 604881ff86855bdf320b4624d277e2e1ab238597..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/manipulator/queryJointVelocitiesMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryJointVelocitiesMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryJointVelocitiesMessage - -#ifndef QUERY_JOINT_VELOCITIES_MESSAGE_H -#define QUERY_JOINT_VELOCITIES_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - -}QueryJointVelocitiesMessageStruct; - -typedef QueryJointVelocitiesMessageStruct* QueryJointVelocitiesMessage; - -JAUS_EXPORT QueryJointVelocitiesMessage queryJointVelocitiesMessageCreate(void); -JAUS_EXPORT void queryJointVelocitiesMessageDestroy(QueryJointVelocitiesMessage); - -JAUS_EXPORT JausBoolean queryJointVelocitiesMessageFromBuffer(QueryJointVelocitiesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryJointVelocitiesMessageToBuffer(QueryJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryJointVelocitiesMessage queryJointVelocitiesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryJointVelocitiesMessageToJausMessage(QueryJointVelocitiesMessage message); - -JAUS_EXPORT unsigned int queryJointVelocitiesMessageSize(QueryJointVelocitiesMessage message); - -#endif // QUERY_JOINT_VELOCITIES_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/manipulator/queryManipulatorSpecificationsMessage.h b/lib/openjaus/libjaus/include/message/query/manipulator/queryManipulatorSpecificationsMessage.h deleted file mode 100644 index 351e55b90cbe01c7a62b025a78789095e09bb5be..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/manipulator/queryManipulatorSpecificationsMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryManipulatorSpecificationsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryManipulatorSpecificationsMessage - -#ifndef QUERY_MANIPULATOR_SPECIFICATIONS_MESSAGE_H -#define QUERY_MANIPULATOR_SPECIFICATIONS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - -}QueryManipulatorSpecificationsMessageStruct; - -typedef QueryManipulatorSpecificationsMessageStruct* QueryManipulatorSpecificationsMessage; - -JAUS_EXPORT QueryManipulatorSpecificationsMessage queryManipulatorSpecificationsMessageCreate(void); -JAUS_EXPORT void queryManipulatorSpecificationsMessageDestroy(QueryManipulatorSpecificationsMessage); - -JAUS_EXPORT JausBoolean queryManipulatorSpecificationsMessageFromBuffer(QueryManipulatorSpecificationsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryManipulatorSpecificationsMessageToBuffer(QueryManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryManipulatorSpecificationsMessage queryManipulatorSpecificationsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryManipulatorSpecificationsMessageToJausMessage(QueryManipulatorSpecificationsMessage message); - -JAUS_EXPORT unsigned int queryManipulatorSpecificationsMessageSize(QueryManipulatorSpecificationsMessage message); - -#endif // QUERY_MANIPULATOR_SPECIFICATIONS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/manipulator/queryToolPointMessage.h b/lib/openjaus/libjaus/include/message/query/manipulator/queryToolPointMessage.h deleted file mode 100644 index 7b8d2923aa34f23746034bf6c243a846d7bf595e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/manipulator/queryToolPointMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryToolPointMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryToolPointMessage - -#ifndef QUERY_TOOL_POINT_MESSAGE_H -#define QUERY_TOOL_POINT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - -}QueryToolPointMessageStruct; - -typedef QueryToolPointMessageStruct* QueryToolPointMessage; - -JAUS_EXPORT QueryToolPointMessage queryToolPointMessageCreate(void); -JAUS_EXPORT void queryToolPointMessageDestroy(QueryToolPointMessage); - -JAUS_EXPORT JausBoolean queryToolPointMessageFromBuffer(QueryToolPointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryToolPointMessageToBuffer(QueryToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryToolPointMessage queryToolPointMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryToolPointMessageToJausMessage(QueryToolPointMessage message); - -JAUS_EXPORT unsigned int queryToolPointMessageSize(QueryToolPointMessage message); - -#endif // QUERY_TOOL_POINT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/payload/queryPayloadDataElementMessage.h b/lib/openjaus/libjaus/include/message/query/payload/queryPayloadDataElementMessage.h deleted file mode 100644 index e21619456d40bd359fa61fa647b4580b26b9f559..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/payload/queryPayloadDataElementMessage.h +++ /dev/null @@ -1,111 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryPayloadDataElementMessage.h -// -// Written By: Bob Touchton -// -// Version: 3.3.0a -// -// Date: 3/27/06 -// -// This file defines the attributes of a reportPayloadDataElementMessage -// NOTE WELL: this message will also be used for general purpose information exchange - -#ifndef QUERY_PAYLOAD_DATA_ELEMENT_MESSAGE_H -#define QUERY_PAYLOAD_DATA_ELEMENT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - //message-specific fields - JausPayloadInterface jausPayloadInterface; - int numberInterfaces; - int* indexes; - -}QueryPayloadDataElementMessageStruct; - -typedef QueryPayloadDataElementMessageStruct* QueryPayloadDataElementMessage; - -JAUS_EXPORT QueryPayloadDataElementMessage queryPayloadDataElementMessageCreate(void); -JAUS_EXPORT void queryPayloadDataElementMessageDestroy(QueryPayloadDataElementMessage); - -JAUS_EXPORT JausBoolean queryPayloadDataElementMessageFromBuffer(QueryPayloadDataElementMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryPayloadDataElementMessageToBuffer(QueryPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryPayloadDataElementMessage queryPayloadDataElementMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryPayloadDataElementMessageToJausMessage(QueryPayloadDataElementMessage message); - -JAUS_EXPORT unsigned int queryPayloadDataElementMessageSize(QueryPayloadDataElementMessage message); - -#endif - - - - diff --git a/lib/openjaus/libjaus/include/message/query/payload/queryPayloadInterfaceMessage.h b/lib/openjaus/libjaus/include/message/query/payload/queryPayloadInterfaceMessage.h deleted file mode 100644 index abef81a926332753ddabbc52376eabc2f4aa1328..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/payload/queryPayloadInterfaceMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryPayloadInterfaceMessage.h -// -// Written By: Bob Touchton -// -// Version: 3.3.0a -// -// Date: 3/20/06 -// -// This file defines the attributes of a QueryPayloadInterfaceMessage - -#ifndef QUERY_PAYLOAD_INTERFACE_MESSAGE_H -#define QUERY_PAYLOAD_INTERFACE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No Message Fields - -}QueryPayloadInterfaceMessageStruct; - -typedef QueryPayloadInterfaceMessageStruct* QueryPayloadInterfaceMessage; - -JAUS_EXPORT QueryPayloadInterfaceMessage queryPayloadInterfaceMessageCreate(void); -JAUS_EXPORT void queryPayloadInterfaceMessageDestroy(QueryPayloadInterfaceMessage); - -JAUS_EXPORT JausBoolean queryPayloadInterfaceMessageFromBuffer(QueryPayloadInterfaceMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryPayloadInterfaceMessageToBuffer(QueryPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryPayloadInterfaceMessage queryPayloadInterfaceMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryPayloadInterfaceMessageToJausMessage(QueryPayloadInterfaceMessage message); - -JAUS_EXPORT unsigned int queryPayloadInterfaceMessageSize(QueryPayloadInterfaceMessage message); - -#endif // QUERY_PAYLOAD_INTERFACE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/planning/queryMissionStatusMessage.h b/lib/openjaus/libjaus/include/message/query/planning/queryMissionStatusMessage.h deleted file mode 100644 index d847b7716f142d737185ce93684cab86dbb9b32c..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/planning/queryMissionStatusMessage.h +++ /dev/null @@ -1,130 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryMissionStatusMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryMissionStatusMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/09/08 - -#ifndef QUERY_MISSION_STATUS_MESSAGE_H -#define QUERY_MISSION_STATUS_MESSAGE_H - -#include "jaus.h" - -// PV as defined in v3.3 -#ifndef JAUS_QUERY_MISSION_STATUS_PV -#define JAUS_QUERY_MISSION_STATUS_PV -#define JAUS_QUERY_MISSION_STATUS_PV_MISSIN_ID_BIT 0 // Field 3 -#define JAUS_QUERY_MISSION_STATUS_PV_TASK_ID_BIT 1 // Field 4 -#define JAUS_QUERY_MISSION_STATUS_PV_UID_BIT 2 // Field 5 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS - JausByte presenceVector; //Presence Vector - JausByte type; //see MISSION_TYPES - JausUnsignedShort missionId; //unique Mission ID to be aborted - JausUnsignedShort taskId; //unique Task ID to be reported. If type = 0 - //then taskId = 0. - JausUnsignedShort taskMsgId; //unique message ID in Task - -}QueryMissionStatusMessageStruct; - -typedef QueryMissionStatusMessageStruct* QueryMissionStatusMessage; - -JAUS_EXPORT QueryMissionStatusMessage queryMissionStatusMessageCreate(void); -JAUS_EXPORT void queryMissionStatusMessageDestroy(QueryMissionStatusMessage); - -JAUS_EXPORT JausBoolean queryMissionStatusMessageFromBuffer - (QueryMissionStatusMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryMissionStatusMessageToBuffer - (QueryMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryMissionStatusMessage queryMissionStatusMessageFromJausMessage - (JausMessage jausMessage); -JAUS_EXPORT JausMessage queryMissionStatusMessageToJausMessage - (QueryMissionStatusMessage message); - -JAUS_EXPORT unsigned int queryMissionStatusMessageSize - (QueryMissionStatusMessage message); - -#endif // QUERY_MISSION_STATUS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/planning/querySpoolingPreferenceMessage.h b/lib/openjaus/libjaus/include/message/query/planning/querySpoolingPreferenceMessage.h deleted file mode 100644 index baeb6af30de5aa9c865d8a377b0f3497666be935..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/planning/querySpoolingPreferenceMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: querySpoolingPreferenceMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo, -// Luke Roseberry MountainTop Technologies www.mntntp.com -// -// Version: 3.3.0a -// -// Date: 06/3/08 -// -// Description: This file defines the attributes of a QuerySpoolingPreferenceMessage - -#ifndef QUERY_SPOOLING_PREFERENCE_MESSAGE_H -#define QUERY_SPOOLING_PREFERENCE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - // THIS MESSAGE HAS NO DATA MEMEBERS - -}QuerySpoolingPreferenceMessageStruct; - -typedef QuerySpoolingPreferenceMessageStruct* QuerySpoolingPreferenceMessage; - -JAUS_EXPORT QuerySpoolingPreferenceMessage querySpoolingPreferenceMessageCreate(void); -JAUS_EXPORT void querySpoolingPreferenceMessageDestroy(QuerySpoolingPreferenceMessage); - -JAUS_EXPORT JausBoolean querySpoolingPreferenceMessageFromBuffer(QuerySpoolingPreferenceMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean querySpoolingPreferenceMessageToBuffer(QuerySpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QuerySpoolingPreferenceMessage querySpoolingPreferenceMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage querySpoolingPreferenceMessageToJausMessage(QuerySpoolingPreferenceMessage message); - -JAUS_EXPORT unsigned int querySpoolingPreferenceMessageSize(QuerySpoolingPreferenceMessage message); - -#endif // QUERY_SPOOLING_PREFERENCE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryDiscreteDevicesMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryDiscreteDevicesMessage.h deleted file mode 100644 index f5e7781ccc2df8d1cfd68e16d32330ecc50e9f5d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryDiscreteDevicesMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryDiscreteDevicesMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryDiscreteDevicesMessage - -#ifndef QUERY_DISCRETE_DEVICES_MESSAGE_H -#define QUERY_DISCRETE_DEVICES_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - -}QueryDiscreteDevicesMessageStruct; - -typedef QueryDiscreteDevicesMessageStruct* QueryDiscreteDevicesMessage; - -JAUS_EXPORT QueryDiscreteDevicesMessage queryDiscreteDevicesMessageCreate(void); -JAUS_EXPORT void queryDiscreteDevicesMessageDestroy(QueryDiscreteDevicesMessage); - -JAUS_EXPORT JausBoolean queryDiscreteDevicesMessageFromBuffer(QueryDiscreteDevicesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryDiscreteDevicesMessageToBuffer(QueryDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryDiscreteDevicesMessage queryDiscreteDevicesMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryDiscreteDevicesMessageToJausMessage(QueryDiscreteDevicesMessage message); - -JAUS_EXPORT unsigned int queryDiscreteDevicesMessageSize(QueryDiscreteDevicesMessage message); - -#endif // QUERY_DISCRETE_DEVICES_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryGlobalPathSegmentMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryGlobalPathSegmentMessage.h deleted file mode 100644 index b83b02b3df92793027af0846518815a50ecaa199..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryGlobalPathSegmentMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryGlobalPathSegmentMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryGlobalPathSegmentMessage - -#ifndef QUERY_GLOBAL_PATH_SEGMENT_MESSAGE_H -#define QUERY_GLOBAL_PATH_SEGMENT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort pathSegmentNumber; - JausByte presenceVector; - -}QueryGlobalPathSegmentMessageStruct; - -typedef QueryGlobalPathSegmentMessageStruct* QueryGlobalPathSegmentMessage; - -JAUS_EXPORT QueryGlobalPathSegmentMessage queryGlobalPathSegmentMessageCreate(void); -JAUS_EXPORT void queryGlobalPathSegmentMessageDestroy(QueryGlobalPathSegmentMessage); - -JAUS_EXPORT JausBoolean queryGlobalPathSegmentMessageFromBuffer(QueryGlobalPathSegmentMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryGlobalPathSegmentMessageToBuffer(QueryGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryGlobalPathSegmentMessage queryGlobalPathSegmentMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryGlobalPathSegmentMessageToJausMessage(QueryGlobalPathSegmentMessage message); - -JAUS_EXPORT unsigned int queryGlobalPathSegmentMessageSize(QueryGlobalPathSegmentMessage message); - -#endif // QUERY_GLOBAL_PATH_SEGMENT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryGlobalPoseMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryGlobalPoseMessage.h deleted file mode 100644 index d68bb5c9dbcbb4b20f05b500df84ba179902e70f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryGlobalPoseMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryGlobalPoseMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryGlobalPoseMessage - -#ifndef QUERY_GLOBAL_POSE_MESSAGE_H -#define QUERY_GLOBAL_POSE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort presenceVector; - -}QueryGlobalPoseMessageStruct; - -typedef QueryGlobalPoseMessageStruct* QueryGlobalPoseMessage; - -JAUS_EXPORT QueryGlobalPoseMessage queryGlobalPoseMessageCreate(void); -JAUS_EXPORT void queryGlobalPoseMessageDestroy(QueryGlobalPoseMessage); - -JAUS_EXPORT JausBoolean queryGlobalPoseMessageFromBuffer(QueryGlobalPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryGlobalPoseMessageToBuffer(QueryGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryGlobalPoseMessage queryGlobalPoseMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryGlobalPoseMessageToJausMessage(QueryGlobalPoseMessage message); - -JAUS_EXPORT unsigned int queryGlobalPoseMessageSize(QueryGlobalPoseMessage message); - -#endif // QUERY_GLOBAL_POSE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryGlobalVectorMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryGlobalVectorMessage.h deleted file mode 100644 index f1c62f8dcd2be8fb664b9d9efefebcf9d76e684f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryGlobalVectorMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryGlobalVectorMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryGlobalVectorMessage - -#ifndef QUERY_GLOBAL_VECTOR_MESSAGE_H -#define QUERY_GLOBAL_VECTOR_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - -}QueryGlobalVectorMessageStruct; - -typedef QueryGlobalVectorMessageStruct* QueryGlobalVectorMessage; - -JAUS_EXPORT QueryGlobalVectorMessage queryGlobalVectorMessageCreate(void); -JAUS_EXPORT void queryGlobalVectorMessageDestroy(QueryGlobalVectorMessage); - -JAUS_EXPORT JausBoolean queryGlobalVectorMessageFromBuffer(QueryGlobalVectorMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryGlobalVectorMessageToBuffer(QueryGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryGlobalVectorMessage queryGlobalVectorMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryGlobalVectorMessageToJausMessage(QueryGlobalVectorMessage message); - -JAUS_EXPORT unsigned int queryGlobalVectorMessageSize(QueryGlobalVectorMessage message); - -#endif // QUERY_GLOBAL_VECTOR_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryGlobalWaypointMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryGlobalWaypointMessage.h deleted file mode 100644 index 0ec77663f428dadbafa70fd47a25f7c9df8a24de..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryGlobalWaypointMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryGlobalWaypointMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryGlobalWaypointMessage - -#ifndef QUERY_GLOBAL_WAYPOINT_MESSAGE_H -#define QUERY_GLOBAL_WAYPOINT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort waypointNumber; - -}QueryGlobalWaypointMessageStruct; - -typedef QueryGlobalWaypointMessageStruct* QueryGlobalWaypointMessage; - -JAUS_EXPORT QueryGlobalWaypointMessage queryGlobalWaypointMessageCreate(void); -JAUS_EXPORT void queryGlobalWaypointMessageDestroy(QueryGlobalWaypointMessage); - -JAUS_EXPORT JausBoolean queryGlobalWaypointMessageFromBuffer(QueryGlobalWaypointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryGlobalWaypointMessageToBuffer(QueryGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryGlobalWaypointMessage queryGlobalWaypointMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryGlobalWaypointMessageToJausMessage(QueryGlobalWaypointMessage message); - -JAUS_EXPORT unsigned int queryGlobalWaypointMessageSize(QueryGlobalWaypointMessage message); - -#endif // QUERY_GLOBAL_WAYPOINT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryLocalPathSegmentMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryLocalPathSegmentMessage.h deleted file mode 100644 index f7f4c5c0517a82460749961541a8b786dffa22cf..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryLocalPathSegmentMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryLocalPathSegmentMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryLocalPathSegmentMessage - -#ifndef QUERY_LOCAL_PATH_SEGMENT_MESSAGE_H -#define QUERY_LOCAL_PATH_SEGMENT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort pathSegmentNumber; - JausByte presenceVector; - -}QueryLocalPathSegmentMessageStruct; - -typedef QueryLocalPathSegmentMessageStruct* QueryLocalPathSegmentMessage; - -JAUS_EXPORT QueryLocalPathSegmentMessage queryLocalPathSegmentMessageCreate(void); -JAUS_EXPORT void queryLocalPathSegmentMessageDestroy(QueryLocalPathSegmentMessage); - -JAUS_EXPORT JausBoolean queryLocalPathSegmentMessageFromBuffer(QueryLocalPathSegmentMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryLocalPathSegmentMessageToBuffer(QueryLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryLocalPathSegmentMessage queryLocalPathSegmentMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryLocalPathSegmentMessageToJausMessage(QueryLocalPathSegmentMessage message); - -JAUS_EXPORT unsigned int queryLocalPathSegmentMessageSize(QueryLocalPathSegmentMessage message); - -#endif // QUERY_LOCAL_PATH_SEGMENT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryLocalPoseMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryLocalPoseMessage.h deleted file mode 100644 index 4b3eddd4ed653dd47c2cff1b79bb2e957eade4c3..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryLocalPoseMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryLocalPoseMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryLocalPoseMessage - -#ifndef QUERY_LOCAL_POSE_MESSAGE_H -#define QUERY_LOCAL_POSE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort presenceVector; - -}QueryLocalPoseMessageStruct; - -typedef QueryLocalPoseMessageStruct* QueryLocalPoseMessage; - -JAUS_EXPORT QueryLocalPoseMessage queryLocalPoseMessageCreate(void); -JAUS_EXPORT void queryLocalPoseMessageDestroy(QueryLocalPoseMessage); - -JAUS_EXPORT JausBoolean queryLocalPoseMessageFromBuffer(QueryLocalPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryLocalPoseMessageToBuffer(QueryLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryLocalPoseMessage queryLocalPoseMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryLocalPoseMessageToJausMessage(QueryLocalPoseMessage message); - -JAUS_EXPORT unsigned int queryLocalPoseMessageSize(QueryLocalPoseMessage message); - -#endif // QUERY_LOCAL_POSE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryLocalVectorMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryLocalVectorMessage.h deleted file mode 100644 index 5f1cc369cec5642fc1a1443c8a830738b451511d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryLocalVectorMessage.h +++ /dev/null @@ -1,103 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryLocalVectorMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryLocalVectorMessage - -#ifndef QUERY_LOCAL_VECTOR_MESSAGE_H -#define QUERY_LOCAL_VECTOR_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - -}QueryLocalVectorMessageStruct; - -typedef QueryLocalVectorMessageStruct* QueryLocalVectorMessage; - -JAUS_EXPORT QueryLocalVectorMessage queryLocalVectorMessageCreate(void); -JAUS_EXPORT void queryLocalVectorMessageDestroy(QueryLocalVectorMessage); - -JAUS_EXPORT JausBoolean queryLocalVectorMessageFromBuffer(QueryLocalVectorMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryLocalVectorMessageToBuffer(QueryLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryLocalVectorMessage queryLocalVectorMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryLocalVectorMessageToJausMessage(QueryLocalVectorMessage message); - -JAUS_EXPORT unsigned int queryLocalVectorMessageSize(QueryLocalVectorMessage message); - -#endif // QUERY_LOCAL_VECTOR_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryLocalWaypointMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryLocalWaypointMessage.h deleted file mode 100644 index fd630840f823c9c84f464595313e36c96d72a84c..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryLocalWaypointMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryLocalWaypointMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryLocalWaypointMessage - -#ifndef QUERY_LOCAL_WAYPOINT_MESSAGE_H -#define QUERY_LOCAL_WAYPOINT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort waypointNumber; - -}QueryLocalWaypointMessageStruct; - -typedef QueryLocalWaypointMessageStruct* QueryLocalWaypointMessage; - -JAUS_EXPORT QueryLocalWaypointMessage queryLocalWaypointMessageCreate(void); -JAUS_EXPORT void queryLocalWaypointMessageDestroy(QueryLocalWaypointMessage); - -JAUS_EXPORT JausBoolean queryLocalWaypointMessageFromBuffer(QueryLocalWaypointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryLocalWaypointMessageToBuffer(QueryLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryLocalWaypointMessage queryLocalWaypointMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryLocalWaypointMessageToJausMessage(QueryLocalWaypointMessage message); - -JAUS_EXPORT unsigned int queryLocalWaypointMessageSize(QueryLocalWaypointMessage message); - -#endif // QUERY_LOCAL_WAYPOINT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryPathSegmentCountMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryPathSegmentCountMessage.h deleted file mode 100644 index d6161ed34e5689f115ab60a2ad4d69207962d450..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryPathSegmentCountMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryPathSegmentCountMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryPathSegmentCountMessage - -#ifndef QUERY_PATH_SEGMENT_COUNT_MESSAGE_H -#define QUERY_PATH_SEGMENT_COUNT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No Fields - -}QueryPathSegmentCountMessageStruct; - -typedef QueryPathSegmentCountMessageStruct* QueryPathSegmentCountMessage; - -JAUS_EXPORT QueryPathSegmentCountMessage queryPathSegmentCountMessageCreate(void); -JAUS_EXPORT void queryPathSegmentCountMessageDestroy(QueryPathSegmentCountMessage); - -JAUS_EXPORT JausBoolean queryPathSegmentCountMessageFromBuffer(QueryPathSegmentCountMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryPathSegmentCountMessageToBuffer(QueryPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryPathSegmentCountMessage queryPathSegmentCountMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryPathSegmentCountMessageToJausMessage(QueryPathSegmentCountMessage message); - -JAUS_EXPORT unsigned int queryPathSegmentCountMessageSize(QueryPathSegmentCountMessage message); - -#endif // QUERY_PATH_SEGMENT_COUNT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryPlatformOperationalDataMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryPlatformOperationalDataMessage.h deleted file mode 100644 index 2f4977496c2ebe3a6474c56f5a9615edd8a2d8be..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryPlatformOperationalDataMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryPlatformOperationalDataMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryPlatformOperationalDataMessage - -#ifndef QUERY_PLATFORM_OPERATIONAL_DATA_MESSAGE_H -#define QUERY_PLATFORM_OPERATIONAL_DATA_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausByte presenceVector; - -}QueryPlatformOperationalDataMessageStruct; - -typedef QueryPlatformOperationalDataMessageStruct* QueryPlatformOperationalDataMessage; - -JAUS_EXPORT QueryPlatformOperationalDataMessage queryPlatformOperationalDataMessageCreate(void); -JAUS_EXPORT void queryPlatformOperationalDataMessageDestroy(QueryPlatformOperationalDataMessage); - -JAUS_EXPORT JausBoolean queryPlatformOperationalDataMessageFromBuffer(QueryPlatformOperationalDataMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryPlatformOperationalDataMessageToBuffer(QueryPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryPlatformOperationalDataMessage queryPlatformOperationalDataMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryPlatformOperationalDataMessageToJausMessage(QueryPlatformOperationalDataMessage message); - -JAUS_EXPORT unsigned int queryPlatformOperationalDataMessageSize(QueryPlatformOperationalDataMessage message); - -#endif // QUERY_PLATFORM_OPERATIONAL_DATA_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryPlatformSpecificationsMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryPlatformSpecificationsMessage.h deleted file mode 100644 index ec77b70fc255969b0158798a4ba9ebac5f116ec4..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryPlatformSpecificationsMessage.h +++ /dev/null @@ -1,129 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryPlatformSpecificationsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryPlatformSpecificationsMessage - -#ifndef QUERY_PLATFORM_SPECIFICATIONS_MESSAGE_H -#define QUERY_PLATFORM_SPECIFICATIONS_MESSAGE_H - -#include "jaus.h" - -#ifndef JAUS_PLATFORM_PV -#define JAUS_PLATFORM_PV -#define JAUS_PLATFORM_PV_PLATFORM_NAME_BIT 0 -#define JAUS_PLATFORM_PV_FRONT_BIT 1 -#define JAUS_PLATFORM_PV_BACK_BIT 2 -#define JAUS_PLATFORM_PV_RIGHT_BIT 3 -#define JAUS_PLATFORM_PV_LEFT_BIT 4 -#define JAUS_PLATFORM_PV_BOTTOM_BIT 5 -#define JAUS_PLATFORM_PV_TOP_BIT 6 -#define JAUS_PLATFORM_PV_X_CG_BIT 7 -#define JAUS_PLATFORM_PV_Y_CG_BIT 8 -#define JAUS_PLATFORM_PV_Z_CG_BIT 9 -#define JAUS_PLATFORM_PV_TURNING_RADIUS_BIT 10 -#define JAUS_PLATFORM_PV_WHEEL_BASE_BIT 11 -#define JAUS_PLATFORM_PV_TRACK_WIDTH_BIT 12 -#define JAUS_PLATFORM_PV_PITCH_OVER_BIT 13 -#define JAUS_PLATFORM_PV_ROLL_OVER_BIT 14 -#define JAUS_PLATFORM_PV_MAX_VELOCITY_X_BIT 15 -#define JAUS_PLATFORM_PV_MAX_VELOCITY_Y_BIT 16 -#define JAUS_PLATFORM_PV_MAX_VELOCITY_Z_BIT 17 -#define JAUS_PLATFORM_PV_MAX_ROLL_RATE_BIT 18 -#define JAUS_PLATFORM_PV_MAX_PITCH_RATE_BIT 19 -#define JAUS_PLATFORM_PV_MAX_YAW_RATE_BIT 20 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedInteger presenceVector; - -}QueryPlatformSpecificationsMessageStruct; - -typedef QueryPlatformSpecificationsMessageStruct* QueryPlatformSpecificationsMessage; - -JAUS_EXPORT QueryPlatformSpecificationsMessage queryPlatformSpecificationsMessageCreate(void); -JAUS_EXPORT void queryPlatformSpecificationsMessageDestroy(QueryPlatformSpecificationsMessage); - -JAUS_EXPORT JausBoolean queryPlatformSpecificationsMessageFromBuffer(QueryPlatformSpecificationsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryPlatformSpecificationsMessageToBuffer(QueryPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryPlatformSpecificationsMessage queryPlatformSpecificationsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryPlatformSpecificationsMessageToJausMessage(QueryPlatformSpecificationsMessage message); - -JAUS_EXPORT unsigned int queryPlatformSpecificationsMessageSize(QueryPlatformSpecificationsMessage message); - -#endif // QUERY_PLATFORM_SPECIFICATIONS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryTravelSpeedMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryTravelSpeedMessage.h deleted file mode 100644 index 7caa6fe4a61ecb7e896b065d88653b5171535a30..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryTravelSpeedMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryTravelSpeedMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryTravelSpeedMessage - -#ifndef QUERY_TRAVEL_SPEED_MESSAGE_H -#define QUERY_TRAVEL_SPEED_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No Message Fields - -}QueryTravelSpeedMessageStruct; - -typedef QueryTravelSpeedMessageStruct* QueryTravelSpeedMessage; - -JAUS_EXPORT QueryTravelSpeedMessage queryTravelSpeedMessageCreate(void); -JAUS_EXPORT void queryTravelSpeedMessageDestroy(QueryTravelSpeedMessage); - -JAUS_EXPORT JausBoolean queryTravelSpeedMessageFromBuffer(QueryTravelSpeedMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryTravelSpeedMessageToBuffer(QueryTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryTravelSpeedMessage queryTravelSpeedMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryTravelSpeedMessageToJausMessage(QueryTravelSpeedMessage message); - -JAUS_EXPORT unsigned int queryTravelSpeedMessageSize(QueryTravelSpeedMessage message); - -#endif // QUERY_TRAVEL_SPEED_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryVelocityStateMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryVelocityStateMessage.h deleted file mode 100644 index b930b3d18efbfa9e9c4122c8d676b7daa9e50943..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryVelocityStateMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryVelocityStateMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryVelocityStateMessage - -#ifndef QUERY_VELOCITY_STATE_MESSAGE_H -#define QUERY_VELOCITY_STATE_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort presenceVector; - -}QueryVelocityStateMessageStruct; - -typedef QueryVelocityStateMessageStruct* QueryVelocityStateMessage; - -JAUS_EXPORT QueryVelocityStateMessage queryVelocityStateMessageCreate(void); -JAUS_EXPORT void queryVelocityStateMessageDestroy(QueryVelocityStateMessage); - -JAUS_EXPORT JausBoolean queryVelocityStateMessageFromBuffer(QueryVelocityStateMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryVelocityStateMessageToBuffer(QueryVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryVelocityStateMessage queryVelocityStateMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryVelocityStateMessageToJausMessage(QueryVelocityStateMessage message); - -JAUS_EXPORT unsigned int queryVelocityStateMessageSize(QueryVelocityStateMessage message); - -#endif // QUERY_VELOCITY_STATE_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryWaypointCountMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryWaypointCountMessage.h deleted file mode 100644 index 853702ec6c358f2ad5b1e646497bb6a90af65ee7..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryWaypointCountMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryWaypointCountMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryWaypointCountMessage - -#ifndef QUERY_WAYPOINT_COUNT_MESSAGE_H -#define QUERY_WAYPOINT_COUNT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // No Fields - -}QueryWaypointCountMessageStruct; - -typedef QueryWaypointCountMessageStruct* QueryWaypointCountMessage; - -JAUS_EXPORT QueryWaypointCountMessage queryWaypointCountMessageCreate(void); -JAUS_EXPORT void queryWaypointCountMessageDestroy(QueryWaypointCountMessage); - -JAUS_EXPORT JausBoolean queryWaypointCountMessageFromBuffer(QueryWaypointCountMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryWaypointCountMessageToBuffer(QueryWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryWaypointCountMessage queryWaypointCountMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryWaypointCountMessageToJausMessage(QueryWaypointCountMessage message); - -JAUS_EXPORT unsigned int queryWaypointCountMessageSize(QueryWaypointCountMessage message); - -#endif // QUERY_WAYPOINT_COUNT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/platform/queryWrenchEffortMessage.h b/lib/openjaus/libjaus/include/message/query/platform/queryWrenchEffortMessage.h deleted file mode 100644 index 89a9567a544f2547af5b33a9c41f62a91898b248..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/platform/queryWrenchEffortMessage.h +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryWrenchEffortMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryWrenchEffortMessage - -#ifndef QUERY_WRENCH_EFFORT_MESSAGE_H -#define QUERY_WRENCH_EFFORT_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - JausUnsignedShort presenceVector; - -}QueryWrenchEffortMessageStruct; - -typedef QueryWrenchEffortMessageStruct* QueryWrenchEffortMessage; - -JAUS_EXPORT QueryWrenchEffortMessage queryWrenchEffortMessageCreate(void); -JAUS_EXPORT void queryWrenchEffortMessageDestroy(QueryWrenchEffortMessage); - -JAUS_EXPORT JausBoolean queryWrenchEffortMessageFromBuffer(QueryWrenchEffortMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryWrenchEffortMessageToBuffer(QueryWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryWrenchEffortMessage queryWrenchEffortMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryWrenchEffortMessageToJausMessage(QueryWrenchEffortMessage message); - -JAUS_EXPORT unsigned int queryWrenchEffortMessageSize(QueryWrenchEffortMessage message); - -#endif // QUERY_WRENCH_EFFORT_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/worldModel/queryVksBoundsMessage.h b/lib/openjaus/libjaus/include/message/query/worldModel/queryVksBoundsMessage.h deleted file mode 100644 index 076f401441ee0b61019895d17343f1fc575cdfe5..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/worldModel/queryVksBoundsMessage.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryVksBoundsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryVksBoundsMessage - -#ifndef QUERY_VKS_BOUNDS_MESSAGE_H -#define QUERY_VKS_BOUNDS_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte requestId; - JausUnsignedShort featureClassId; - -}QueryVksBoundsMessageStruct; - -typedef QueryVksBoundsMessageStruct* QueryVksBoundsMessage; - -JAUS_EXPORT QueryVksBoundsMessage queryVksBoundsMessageCreate(void); -JAUS_EXPORT void queryVksBoundsMessageDestroy(QueryVksBoundsMessage); - -JAUS_EXPORT JausBoolean queryVksBoundsMessageFromBuffer(QueryVksBoundsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryVksBoundsMessageToBuffer(QueryVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryVksBoundsMessage queryVksBoundsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryVksBoundsMessageToJausMessage(QueryVksBoundsMessage message); - -JAUS_EXPORT unsigned int queryVksBoundsMessageSize(QueryVksBoundsMessage message); - -#endif // QUERY_VKS_BOUNDS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/worldModel/queryVksFeatureClassMetadataMessage.h b/lib/openjaus/libjaus/include/message/query/worldModel/queryVksFeatureClassMetadataMessage.h deleted file mode 100644 index 02265ffb252bf1c94e5d1298e7356ab3e930c977..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/worldModel/queryVksFeatureClassMetadataMessage.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryVksFeatureClassMetadataMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryVksFeatureClassMetadataMessage - -#ifndef QUERY_VKS_FEATURE_CLASS_METADATA_MESSAGE_H -#define QUERY_VKS_FEATURE_CLASS_METADATA_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausUnsignedShort featureClassId; - -}QueryVksFeatureClassMetadataMessageStruct; - -typedef QueryVksFeatureClassMetadataMessageStruct* QueryVksFeatureClassMetadataMessage; - -JAUS_EXPORT QueryVksFeatureClassMetadataMessage queryVksFeatureClassMetadataMessageCreate(void); -JAUS_EXPORT void queryVksFeatureClassMetadataMessageDestroy(QueryVksFeatureClassMetadataMessage); - -JAUS_EXPORT JausBoolean queryVksFeatureClassMetadataMessageFromBuffer(QueryVksFeatureClassMetadataMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryVksFeatureClassMetadataMessageToBuffer(QueryVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryVksFeatureClassMetadataMessage queryVksFeatureClassMetadataMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryVksFeatureClassMetadataMessageToJausMessage(QueryVksFeatureClassMetadataMessage message); - -JAUS_EXPORT unsigned int queryVksFeatureClassMetadataMessageSize(QueryVksFeatureClassMetadataMessage message); - -#endif // QUERY_VKS_FEATURE_CLASS_METADATA_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/query/worldModel/queryVksObjectsMessage.h b/lib/openjaus/libjaus/include/message/query/worldModel/queryVksObjectsMessage.h deleted file mode 100644 index 853d804db23d6e666fb4cb5aee1e5b52d9c1a531..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/query/worldModel/queryVksObjectsMessage.h +++ /dev/null @@ -1,127 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryVksObjectsMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a QueryVksObjectsMessage - -#ifndef QUERY_VKS_OBJECTS_MESSAGE_H -#define QUERY_VKS_OBJECTS_MESSAGE_H - -#include "jaus.h" - -// Note: The PV for this message is a bit over-defined -// If the VKS_PV_QUERY_OBJECTS_REGION_BIT is set, then the VKS_PV_QUERY_OBJECTS_POINT_COUNT_BIT is required -// The VKS_PV_QUERY_OBJECTS_BUFFER_BIT cannot be set without the VKS_PV_QUERY_OBJECTS_REGION_BIT -// -// If the VKS_PV_QUERY_OBJECTS_FEATURE_CLASS_BIT is set or the VKS_PV_QUERY_OBJECTS_ATTRIBUTE_BIT is set, -// then the VKS_PV_QUERY_OBJECTS_FC_COUNT_BIT is required -#ifndef VKS_PV_QUERY_OBJECTS -#define VKS_PV_QUERY_OBJECTS -#define VKS_PV_QUERY_OBJECTS_ID_BIT 0 -#define VKS_PV_QUERY_OBJECTS_REGION_BIT 1 -#define VKS_PV_QUERY_OBJECTS_BUFFER_BIT 2 -#define VKS_PV_QUERY_OBJECTS_FC_COUNT_BIT 3 -#define VKS_PV_QUERY_OBJECTS_FEATURE_CLASS_BIT 4 -#define VKS_PV_QUERY_OBJECTS_ATTRIBUTE_BIT 5 -#define VKS_PV_QUERY_OBJECTS_POINT_COUNT_BIT 6 -#endif - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - JausByte presenceVector; // 1: Presence Vector - JausByte responsePresenceVector; // 2: Presence Vector to be used in response (defines the data requested) - JausByte requestId; // 3: Local Request Id - JausUnsignedShort objectCount; // 4: Count of specific object ids requested - JausUnsignedInteger *objectIds; // 5: Array of specific object ids - JausWorldModelVectorObject queryRegion; // 6: Query region with associated FCs and attributes - -}QueryVksObjectsMessageStruct; - -typedef QueryVksObjectsMessageStruct* QueryVksObjectsMessage; - -JAUS_EXPORT QueryVksObjectsMessage queryVksObjectsMessageCreate(void); -JAUS_EXPORT void queryVksObjectsMessageDestroy(QueryVksObjectsMessage); - -JAUS_EXPORT JausBoolean queryVksObjectsMessageFromBuffer(QueryVksObjectsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean queryVksObjectsMessageToBuffer(QueryVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT QueryVksObjectsMessage queryVksObjectsMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage queryVksObjectsMessageToJausMessage(QueryVksObjectsMessage message); - -JAUS_EXPORT unsigned int queryVksObjectsMessageSize(QueryVksObjectsMessage message); - -#endif // QUERY_VKS_OBJECTS_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/message/skeletonMessage.h b/lib/openjaus/libjaus/include/message/skeletonMessage.h deleted file mode 100644 index ab7b949f316327b0353e4056dc8e1370745c73f3..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/message/skeletonMessage.h +++ /dev/null @@ -1,117 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: xXXXMessage.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a XxXxMessage - -#ifndef XXXX_MESSAGE_H -#define XXXX_MESSAGE_H - -#include "jaus.h" - -typedef struct -{ - // Include all parameters from a JausMessage structure: - // Header Properties - struct - { - // Properties by bit fields - #ifdef JAUS_BIG_ENDIAN - JausUnsignedShort reserved:2; - JausUnsignedShort version:6; - JausUnsignedShort expFlag:1; - JausUnsignedShort scFlag:1; - JausUnsignedShort ackNak:2; - JausUnsignedShort priority:4; - #elif JAUS_LITTLE_ENDIAN - JausUnsignedShort priority:4; - JausUnsignedShort ackNak:2; - JausUnsignedShort scFlag:1; - JausUnsignedShort expFlag:1; - JausUnsignedShort version:6; - JausUnsignedShort reserved:2; - #else - #error "Please define system endianess (see jaus.h)" - #endif - }properties; - - JausUnsignedShort commandCode; - - JausAddress destination; - - JausAddress source; - - JausUnsignedInteger dataSize; - - JausUnsignedInteger dataFlag; - - JausUnsignedShort sequenceNumber; - - // MESSAGE DATA MEMBERS GO HERE - - // Example from ReportGlobalPoseMessage - // - // JausUnsignedShort presenceVector; - // JausDouble latitudeDegrees; // Scaled Int (-90, 90) - // JausDouble longitudeDegrees; // Scaled Int (-180, 180) - // JausDouble elevationMeters; // Scaled Int (-10000, 35000) - // JausDouble positionRmsMeters; // Scaled UInt (0, 100) - // JausDouble rollRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - // JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - // JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - // JausDouble attitudeRmsRadians; // Scaled Short (0, JAUS_PI) - // JausUnsignedInteger timeStamp; - -}XxXxMessageStruct; - -typedef XxXxMessageStruct* XxXxMessage; - -JAUS_EXPORT XxXxMessage xXXXMessageCreate(void); -JAUS_EXPORT void xXXXMessageDestroy(XxXxMessage); - -JAUS_EXPORT JausBoolean xXXXMessageFromBuffer(XxXxMessage message, unsigned char* buffer, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean xXXXMessageToBuffer(XxXxMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT XxXxMessage xXXXMessageFromJausMessage(JausMessage jausMessage); -JAUS_EXPORT JausMessage xXXXMessageToJausMessage(XxXxMessage message); - -JAUS_EXPORT unsigned int xXXXMessageSize(XxXxMessage message); - -#endif // XXXX_MESSAGE_H diff --git a/lib/openjaus/libjaus/include/type/jausByte.h b/lib/openjaus/libjaus/include/type/jausByte.h deleted file mode 100644 index f1d868550dd9e28d8c8ee7e498e1e10b87356dbd..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausByte.h +++ /dev/null @@ -1,72 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausByte.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausByte funtionality, this should be primarily used -// through the JausType file and its methods - -#ifndef JAUS_BYTE_H -#define JAUS_BYTE_H - -#include "jaus.h" - -#define JAUS_BYTE_SIZE_BYTES 1 // size - -#define JAUS_BYTE_RANGE 255.0 -#define JAUS_BYTE_MAX_VALUE 255 -#define JAUS_BYTE_MIN_VALUE 0 - -#define JAUS_BYTE_PRESENCE_VECTOR_ALL_ON 255 - -typedef unsigned char JausByte; - -JAUS_EXPORT JausByte newJausByte(unsigned char val); - -JAUS_EXPORT JausBoolean jausByteFromBuffer(JausByte *jByte, unsigned char *buf, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean jausByteToBuffer(JausByte input, unsigned char *buf, unsigned int bufferSizeBytes); - -JAUS_EXPORT JausByte jausByteFromDouble(double val, double min, double max); -JAUS_EXPORT double jausByteToDouble(JausByte input, double min, double max); - -JAUS_EXPORT JausBoolean jausByteIsBitSet(JausByte byte, int bit); -JAUS_EXPORT JausBoolean jausByteSetBit(JausByte *byte, int bit); -JAUS_EXPORT JausBoolean jausByteClearBit(JausByte *byte, int bit); - -#endif //JAUS_BYTE_H diff --git a/lib/openjaus/libjaus/include/type/jausDouble.h b/lib/openjaus/libjaus/include/type/jausDouble.h deleted file mode 100644 index 91ca03b179a4f60c3efed8b25131acd3ae7532fe..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausDouble.h +++ /dev/null @@ -1,59 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausDouble.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausDouble funtionality, this should be primarily used -// through the JausType file and its methods - -#ifndef JAUS_DOUBLE_H -#define JAUS_DOUBLE_H - -#include "jaus.h" - -#define JAUS_DOUBLE_SIZE_BYTES 8 - -typedef double JausDouble; - -JAUS_EXPORT JausDouble newJausDouble(double val); - -JAUS_EXPORT JausBoolean jausDoubleFromBuffer(JausDouble *jDouble, unsigned char *buf, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean jausDoubleToBuffer(JausDouble input, unsigned char *buf, unsigned int bufferSizeBytes); - -#endif // JAUS_DOUBLE_H diff --git a/lib/openjaus/libjaus/include/type/jausEventLimit.h b/lib/openjaus/libjaus/include/type/jausEventLimit.h deleted file mode 100644 index 8b5fe307dd772a2b80c9e67c89e4bf43650e2523..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausEventLimit.h +++ /dev/null @@ -1,112 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausEventLimit.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes the stucture and functionality associated with an -// EventLimit for use with the Jaus Events Message Set -#ifndef EVENT_LIMITS_H -#define EVENT_LIMITS_H - -typedef struct -{ - enum - { - EVENT_LIMIT_UNDEFINED_TYPE = -1, - EVENT_LIMIT_BYTE_TYPE = 0, - EVENT_LIMIT_SHORT_TYPE = 1, - EVENT_LIMIT_INTEGER_TYPE = 2, - EVENT_LIMIT_LONG_TYPE = 3, - EVENT_LIMIT_UNSIGNED_SHORT_TYPE = 4, - EVENT_LIMIT_UNSIGNED_INTEGER_TYPE = 5, - EVENT_LIMIT_UNSIGNED_LONG_TYPE = 6, - EVENT_LIMIT_FLOAT_TYPE = 7, - EVENT_LIMIT_DOUBLE_TYPE = 8, - EVENT_LIMIT_RGB_TYPE = 9 - }dataType; - - union - { - JausByte byteValue; - JausShort shortValue; - JausInteger integerValue; - JausLong longValue; - JausUnsignedShort unsignedShortValue; - JausUnsignedInteger unsignedIntegerValue; - JausUnsignedLong unsignedLongValue; - JausFloat floatValue; - JausDouble doubleValue; - struct - { - JausByte redValue; - JausByte greenValue; - JausByte blueValue; - }rgb; - }value; -}JausEventLimitStruct; - -typedef JausEventLimitStruct *JausEventLimit; - -typedef struct JausEventListStruct -{ - void *eventMessage; - JausByte eventId; - JausEventLimit previousLimitValue; -}JausEventStruct; - -typedef JausEventStruct *JausEvent; - -// JausEventLimit Constructor -JAUS_EXPORT JausEventLimit jausEventLimitCreate(); - -// JausEventLimit Destructor -JAUS_EXPORT void jausEventLimitDestroy(JausEventLimit limit); - -// JausEventLimit Constructor (from Buffer) -JAUS_EXPORT JausBoolean jausEventLimitFromBuffer(JausEventLimit *limit, unsigned char *buffer, unsigned int bufferSizeBytes); - -// JausEventLimit To Buffer -JAUS_EXPORT JausBoolean jausEventLimitToBuffer(JausEventLimit limit, unsigned char *buffer, unsigned int bufferSizeBytes); - -JAUS_EXPORT unsigned int jausEventLimitSize(JausEventLimit limit); - -JAUS_EXPORT JausEvent jausEventCreate(); -JAUS_EXPORT void jausEventDestroy(JausEvent event); - -#endif diff --git a/lib/openjaus/libjaus/include/type/jausFloat.h b/lib/openjaus/libjaus/include/type/jausFloat.h deleted file mode 100644 index 291c6ecc92174315ab811255c8419dd0f543e43e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausFloat.h +++ /dev/null @@ -1,59 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausFloat.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausFloat funtionality, this should be primarily used -// through the JausType file and its methods - -#ifndef JAUS_FLOAT_H -#define JAUS_FLOAT_H - -#include "jaus.h" - -#define JAUS_FLOAT_SIZE_BYTES 4 - -typedef float JausFloat; - -JAUS_EXPORT JausFloat newJausFloat(float val); - -JAUS_EXPORT JausBoolean jausFloatFromBuffer(JausFloat *jFloat, unsigned char *buf, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean jausFloatToBuffer(JausFloat input, unsigned char *buf, unsigned int bufferSizeBytes); - -#endif // JAUS_FLOAT_H diff --git a/lib/openjaus/libjaus/include/type/jausGeometryPointLLA.h b/lib/openjaus/libjaus/include/type/jausGeometryPointLLA.h deleted file mode 100644 index 71de0fe4615be0b4a54124f8738b9e91ffd865bc..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausGeometryPointLLA.h +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausGeometryPointLLA.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3 -// -// Date: 08/14/07 -// -// Description: This file defines the functions of a JausGeometryPoint Object - -#ifndef JAUS_GEOMETRY_POINT_LLA_H -#define JAUS_GEOMETRY_POINT_LLA_H - -typedef struct{ - double latitudeRadians; - double longitudeRadians; - double altitudeMeters; -} JausGeometryPointLLAStruct; - -typedef JausGeometryPointLLAStruct *JausGeometryPointLLA; - -JAUS_EXPORT JausGeometryPointLLA jausGeometryPointLLACreate(void); -JAUS_EXPORT void jausGeometryPointLLADestroy(JausGeometryPointLLA); - -#endif diff --git a/lib/openjaus/libjaus/include/type/jausGeometryPointXYZ.h b/lib/openjaus/libjaus/include/type/jausGeometryPointXYZ.h deleted file mode 100644 index a42d8b14e0ff52a85d716fce34309fcf5c7d8632..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausGeometryPointXYZ.h +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausGeometryPointXYZ.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3 -// -// Date: 08/14/07 -// -// Description: This file defines the functions of a JausGeometryPoint Object - -#ifndef JAUS_GEOMETRY_POINT_XYZ_H -#define JAUS_GEOMETRY_POINT_XYZ_H - -typedef struct{ - double x; - double y; - double z; -} JausGeometryPointXYZStruct; - -typedef JausGeometryPointXYZStruct *JausGeometryPointXYZ; - -JAUS_EXPORT JausGeometryPointXYZ jausGeometryPointXYZCreate(void); -JAUS_EXPORT void jausGeometryPointXYZDestroy(JausGeometryPointXYZ); - -#endif diff --git a/lib/openjaus/libjaus/include/type/jausInteger.h b/lib/openjaus/libjaus/include/type/jausInteger.h deleted file mode 100644 index 3645fdbb40e66b45406dd6b11d1e1ca458fa4129..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausInteger.h +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausInteger.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausInteger funtionality, this should be primarily used -// through the JausType file and its methods - -#ifndef JAUS_INTEGER_H -#define JAUS_INTEGER_H - -#include "jaus.h" - -#define JAUS_INTEGER_SIZE_BYTES 4 //size - -#define JAUS_INTEGER_RANGE 4294967294.0 // NOTE: This range is incorrect, but is as defined by Jaus -#define JAUS_INTEGER_MAX_VALUE 2147483647 -#define JAUS_INTEGER_MIN_VALUE -2147483648 - -typedef int JausInteger; - -JAUS_EXPORT JausInteger newJausInteger(int val); - -JAUS_EXPORT JausBoolean jausIntegerFromBuffer(JausInteger *jInteger, unsigned char *buf, unsigned int bufferSizeBytes); -JausBoolean jausIntegerToBuffer(JausInteger input, unsigned char *buf, unsigned int bufferSizeBytes); - -JAUS_EXPORT double jausIntegerToDouble(JausInteger input, double min, double max); -JAUS_EXPORT JausInteger jausIntegerFromDouble(double value, double min, double max); - -#endif // JAUS_INTEGER_H diff --git a/lib/openjaus/libjaus/include/type/jausLong.h b/lib/openjaus/libjaus/include/type/jausLong.h deleted file mode 100644 index 7d611185dacbcbb89e9701695bcc685326f193ab..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausLong.h +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausLong.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausLong funtionality, this should be primarily used -// through the JausType file and its methods - -#ifndef JAUS_LONG_H -#define JAUS_LONG_H - -#include "jaus.h" - -#define JAUS_LONG_SIZE_BYTES 8 // size - -#define JAUS_LONG_RANGE (double) 18446744073709551614.0 -#define JAUS_LONG_MAX_VALUE 9223372036854775807L -#define JAUS_LONG_MIN_VALUE -9223372036854775807L - -typedef long long JausLong; - -JAUS_EXPORT JausLong newJausLong(long long val); - -JAUS_EXPORT JausBoolean jausLongFromBuffer(JausLong *jLong, unsigned char *buf, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean jausLongToBuffer(JausLong input, unsigned char *buf, unsigned int bufferSizeBytes); - -JAUS_EXPORT double jausLongToDouble(JausLong input, double min, double max); -JAUS_EXPORT JausLong jausLongFromDouble(double value, double min, double max); - -#endif // JAUS_LONG_H diff --git a/lib/openjaus/libjaus/include/type/jausMissionCommand.h b/lib/openjaus/libjaus/include/type/jausMissionCommand.h deleted file mode 100644 index f2b4408b2cc05bf93835344a99c7ec9afa84841e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausMissionCommand.h +++ /dev/null @@ -1,85 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausMissionCommand.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes all the functionality associated with a JausMissionCommand. -// JausMissionCommands are used to support the storage and transfer of mission through the planning message set. -// Modified by: Luke Roseberry (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS. -#ifndef JAUS_MISSION_COMMAND_H -#define JAUS_MISSION_COMMAND_H - -#include "jaus.h" - - -#ifndef MISSION_BLOCKING_TYPES -#define MISSION_BLOCKING_TYPES -#define NON_BLOCKING 0 -#define BLOCKING 1 -#endif - -// ************************************************************************************************************************************ -// JausMissionCommand -// ************************************************************************************************************************************ -typedef struct -{ - JausUnsignedShort uid; // Unique Jaus Message Id - JausMessage message; //The jaus message - JausByte blocking; //Indecates if this message is blocking 0 - NonBlocking, 1 - Blocking - //struct JausMissionCommandStruct* next; -}JausMissionCommandStruct; -typedef JausMissionCommandStruct *JausMissionCommand; -; -// JausMissionCommand Constructor -JAUS_EXPORT JausMissionCommand missionCommandCreate(void); - -// JausMissionCommand Constructor (from Buffer) -JAUS_EXPORT JausBoolean missionCommandFromBuffer(JausMissionCommand* messagePointer, unsigned char *buffer, unsigned int bufferSizeBytes); - -// JausMissionCommand To Buffer -JAUS_EXPORT JausBoolean missionCommandToBuffer(JausMissionCommand message, unsigned char *buffer, unsigned int bufferSizeBytes); - -// JausMissionCommand Destructor -JAUS_EXPORT void missionCommandDestroy(JausMissionCommand object); - -// JausMissionCommand Buffer Size -JAUS_EXPORT unsigned int missionCommandSize(JausMissionCommand object); - -#endif // JAUSMISSIONCOMMAND_H diff --git a/lib/openjaus/libjaus/include/type/jausMissionTask.h b/lib/openjaus/libjaus/include/type/jausMissionTask.h deleted file mode 100644 index 775f976cc5d77dff63d8b35d1e13fc8c68cbdc1f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausMissionTask.h +++ /dev/null @@ -1,84 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausMissionTask.h -// -// Written By: Luke Roseberry (MountainTop Technology, Inc) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes all the functionality associated with a JausMissionTask. -// JausMissionTasks are used to support the storage and transfer of mission through the planning message set. -// -// Modified by: Luke Roseberry (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS. - -#ifndef JAUS_MISSION_TASK_H -#define JAUS_MISSION_TASK_H - -#include "jaus.h" -#include "string.h" - -#include "type/jausMissionCommand.h" - -// ************************************************************************************************************************************ -// JausMissionTask -// ************************************************************************************************************************************ -typedef struct -{ - JausUnsignedShort taskId; // Unique Id for this task - JausArray commands; //List of JausMissionCommand structures for messages - JausArray children; //List of JausMissionTask structures signifying the children tasks of this task - - JausInteger bufferOffset; //Internal variable used for ToBuffer processing -}JausMissionTaskStruct; -typedef JausMissionTaskStruct *JausMissionTask; - -// JausMissionTask Constructor -JAUS_EXPORT JausMissionTask missionTaskCreate(void); - -// JausMissionTask Constructor (from Buffer) -JAUS_EXPORT JausBoolean missionTaskFromBuffer(JausMissionTask *messagePointer, unsigned char *buffer, unsigned int bufferSizeBytes); - -// JausMissionTask To Buffer -JAUS_EXPORT JausBoolean missionTaskToBuffer(JausMissionTask task, unsigned char *buffer, unsigned int bufferSizeBytes); - -// JausMissionTask Destructor -JAUS_EXPORT void missionTaskDestroy(JausMissionTask object); - -// JausMissionTask Buffer Size -JAUS_EXPORT unsigned int missionTaskSize(JausMissionTask object); - -#endif // JAUSMISSIONTASK_H diff --git a/lib/openjaus/libjaus/include/type/jausShort.h b/lib/openjaus/libjaus/include/type/jausShort.h deleted file mode 100644 index b41ace598dc990f153b35b14133765281ebb147d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausShort.h +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausShort.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausShort functionality, this should be primarily used -// through the JausType file and its methods - -#ifndef JAUS_SHORT_H -#define JAUS_SHORT_H - -#include "jaus.h" - -#define JAUS_SHORT_SIZE_BYTES 2 //size bytes - -#define JAUS_SHORT_RANGE 65534.0 // NOTE: This range is incorrect, but is as defined by Jaus -#define JAUS_SHORT_MAX_VALUE 32767 -#define JAUS_SHORT_MIN_VALUE -32768 - -typedef short JausShort; - -JAUS_EXPORT JausShort newJausShort(short val); - -JAUS_EXPORT JausBoolean jausShortFromBuffer(JausShort *jShort, unsigned char *buf, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean jausShortToBuffer(JausShort input, unsigned char *buf, unsigned int bufferSizeBytes); - -JAUS_EXPORT double jausShortToDouble(JausShort input, double min, double max); -JAUS_EXPORT JausShort jausShortFromDouble(double value, double min, double max); - -#endif // JAUS_SHORT_H diff --git a/lib/openjaus/libjaus/include/type/jausTime.h b/lib/openjaus/libjaus/include/type/jausTime.h deleted file mode 100644 index 9d173c28c99deec58d8b7eed9717930a811ef975..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausTime.h +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausTime.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a JausTime object - -#ifndef JAUS_TIME_H -#define JAUS_TIME_H - -#include "jaus.h" - -#define JAUS_TIME_STAMP_SIZE_BYTES JAUS_UNSIGNED_INTEGER_SIZE_BYTES // size -#define JAUS_DATE_STAMP_SIZE_BYTES JAUS_UNSIGNED_SHORT_SIZE_BYTES // size - -// Bit Shift Defines -#define JAUS_TIME_STAMP_MILLISEC_SHIFT 0 -#define JAUS_TIME_STAMP_SECOND_SHIFT 10 -#define JAUS_TIME_STAMP_MINUTE_SHIFT 16 -#define JAUS_TIME_STAMP_HOUR_SHIFT 22 -#define JAUS_TIME_STAMP_DAY_SHIFT 27 -#define JAUS_DATE_STAMP_DAY_SHIFT 0 -#define JAUS_DATE_STAMP_MONTH_SHIFT 5 -#define JAUS_DATE_STAMP_YEAR_SHIFT 9 - -// Bit Mask Defines -#define JAUS_TIME_STAMP_MILLISEC_MASK 0x3FF // 10 bits -#define JAUS_TIME_STAMP_SECOND_MASK 0x3F // 6 bits -#define JAUS_TIME_STAMP_MINUTE_MASK 0x3F // 6 bits -#define JAUS_TIME_STAMP_HOUR_MASK 0x1F // 5 bits -#define JAUS_TIME_STAMP_DAY_MASK 0x1F // 5 bits -#define JAUS_DATE_STAMP_DAY_MASK 0x1F // 5 bits -#define JAUS_DATE_STAMP_MONTH_MASK 0x0F // 4 bits -#define JAUS_DATE_STAMP_YEAR_MASK 0x7F // 7 bits - -typedef struct -{ - JausUnsignedInteger timeStamp; - JausUnsignedShort dateStamp; - - JausUnsignedShort millisec; - JausUnsignedShort second; - JausUnsignedShort minute; - JausUnsignedShort hour; - JausUnsignedShort day; - JausUnsignedShort month; - JausUnsignedShort year; - -}JausTimeStruct; - -typedef JausTimeStruct *JausTime; - -JAUS_EXPORT JausTime jausTimeCreate(void); -JAUS_EXPORT void jausTimeDestroy(JausTime time); -JAUS_EXPORT JausTime jausTimeClone(JausTime time); -JAUS_EXPORT JausBoolean jausTimeCopy(JausTime dstTime, JausTime srcTime); - -JAUS_EXPORT JausBoolean jausTimeSetCurrentTime(JausTime time); -JAUS_EXPORT JausBoolean jausTimeToString(JausTime time, char *buffer, size_t buffSize); - -JAUS_EXPORT JausBoolean jausTimeStampFromBuffer(JausTime input, unsigned char *buf, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean jausTimeStampToBuffer(JausTime input, unsigned char *buf, unsigned int bufferSizeBytes); - -JAUS_EXPORT JausBoolean jausDateStampFromBuffer(JausTime input, unsigned char *buf, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean jausDateStampToBuffer(JausTime input, unsigned char *buf, unsigned int bufferSizeBytes); - -JAUS_EXPORT JausUnsignedInteger jausTimeGetTimeStamp(JausTime time); -JAUS_EXPORT JausUnsignedShort jausTimeGetDateStamp(JausTime time); - -#endif diff --git a/lib/openjaus/libjaus/include/type/jausType.h b/lib/openjaus/libjaus/include/type/jausType.h deleted file mode 100644 index e8ecc5385d8a6787f291836c4df74779b588e3d3..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausType.h +++ /dev/null @@ -1,67 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausType.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausTypes and allows the user to use the JausType structure -// as a place-holder for any one type. This allows functions to operate on all JausTypes based on the -// individual type flags. - -#ifndef JAUS_TYPE_H -#define JAUS_TYPE_H - -//Individual Jaus Types -#include "jausByte.h" -#include "jausShort.h" -#include "jausInteger.h" -#include "jausLong.h" -#include "jausUnsignedShort.h" -#include "jausUnsignedInteger.h" -#include "jausUnsignedLong.h" -#include "jausFloat.h" -#include "jausDouble.h" -#include "jausEventLimit.h" -#include "jausWorldModelVectorObject.h" -#include "jausWorldModelFeatureClass.h" -#include "jausGeometryPointLLA.h" -#include "jausGeometryPointXYZ.h" -#include "jausTime.h" - -#endif - diff --git a/lib/openjaus/libjaus/include/type/jausUnsignedInteger.h b/lib/openjaus/libjaus/include/type/jausUnsignedInteger.h deleted file mode 100644 index 66ccddd82ad2a6ce42a6a6533be059733f50e78b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausUnsignedInteger.h +++ /dev/null @@ -1,72 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausUnsignedInteger.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausUnsignedInteger funtionality, this should be primarily used -// through the JausType file and its methods - -#ifndef JAUS_UNSIGNED_INTEGER_H -#define JAUS_UNSIGNED_INTEGER_H - -#include "jaus.h" - -#define JAUS_UNSIGNED_INTEGER_SIZE_BYTES 4 - -#define JAUS_UNSIGNED_INTEGER_RANGE 4294967294.0 // NOTE: This range is incorrect, but is as defined by Jaus -#define JAUS_UNSIGNED_INTEGER_MAX_VALUE 4294967295L -#define JAUS_UNSIGNED_INTEGER_MIN_VALUE 0 - -#define JAUS_INTEGER_PRESENCE_VECTOR_ALL_ON 4294967295L - -typedef unsigned int JausUnsignedInteger; - -JAUS_EXPORT JausUnsignedInteger newJausUnsignedInteger(unsigned int val); - -JAUS_EXPORT JausBoolean jausUnsignedIntegerFromBuffer(JausUnsignedInteger *jUint, unsigned char *buf, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean jausUnsignedIntegerToBuffer(JausUnsignedInteger input, unsigned char *buf, unsigned int bufferSizeBytes); - -JAUS_EXPORT double jausUnsignedIntegerToDouble(JausUnsignedInteger input, double min, double max); -JAUS_EXPORT JausUnsignedInteger jausUnsignedIntegerFromDouble(double value, double min, double max); - -JAUS_EXPORT JausBoolean jausUnsignedIntegerIsBitSet(JausUnsignedInteger input, int bit); -JAUS_EXPORT JausBoolean jausUnsignedIntegerSetBit(JausUnsignedInteger *input, int bit); -JAUS_EXPORT JausBoolean jausUnsignedIntegerClearBit(JausUnsignedInteger *input, int bit); - -#endif // JAUS_UNSIGNED_INTEGER_H diff --git a/lib/openjaus/libjaus/include/type/jausUnsignedLong.h b/lib/openjaus/libjaus/include/type/jausUnsignedLong.h deleted file mode 100644 index e77f3c5a7bf840aa3b6f4f24b7737f51bb0e9920..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausUnsignedLong.h +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausUnsignedLong.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausUnsignedLong funtionality, this should be primarily used -// through the JausType file and its methods - -#ifndef JAUS_UNSIGNED_LONG_H -#define JAUS_UNSIGNED_LONG_H - -#include "jaus.h" - -#define JAUS_UNSIGNED_LONG_SIZE_BYTES 8 - -#define JAUS_UNSIGNED_LONG_RANGE (double) 1.8446744073709552e19 -#define JAUS_UNSIGNED_LONG_MAX_VALUE 1.8446744073709553e+19L -#define JAUS_UNSIGNED_LONG_MIN_VALUE 0 - -typedef unsigned long long JausUnsignedLong; - -JAUS_EXPORT JausUnsignedLong newJausUnsignedLong(unsigned long long val); - -JAUS_EXPORT JausBoolean jausUnsignedLongFromBuffer(JausUnsignedLong *jULong, unsigned char *buf, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean jausUnsignedLongToBuffer(JausUnsignedLong input, unsigned char *buf, unsigned int bufferSizeBytes); - -JAUS_EXPORT double jausUnsignedLongToDouble(JausUnsignedLong input, double min, double max); -JAUS_EXPORT JausUnsignedLong jausUnsignedLongFromDouble(double value, double min, double max); - -#endif // JAUS_UNSIGNED_LONG_H diff --git a/lib/openjaus/libjaus/include/type/jausUnsignedShort.h b/lib/openjaus/libjaus/include/type/jausUnsignedShort.h deleted file mode 100644 index 3017c4dbf82bfa168518e7d4c88df638bef45388..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausUnsignedShort.h +++ /dev/null @@ -1,72 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausUnsignedShort.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausUnsignedShort funtionality, this should be primarily used -// through the JausType file and its methods - -#ifndef JAUS_UNSIGNED_SHORT_H -#define JAUS_UNSIGNED_SHORT_H - -#include "jaus.h" - -#define JAUS_UNSIGNED_SHORT_SIZE_BYTES 2 - -#define JAUS_UNSIGNED_SHORT_RANGE 65535.0 // NOTE: This range is incorrect, but is as defined by Jaus -#define JAUS_UNSIGNED_SHORT_MAX_VALUE 65535 -#define JAUS_UNSIGNED_SHORT_MIN_VALUE 0 - -#define JAUS_SHORT_PRESENCE_VECTOR_ALL_ON 65535 - -typedef unsigned short JausUnsignedShort; - -JAUS_EXPORT JausUnsignedShort newJausUnsignedShort(unsigned short val); - -JAUS_EXPORT JausBoolean jausUnsignedShortFromBuffer(JausUnsignedShort *jUShort, unsigned char *buf, unsigned int bufferSizeBytes); -JAUS_EXPORT JausBoolean jausUnsignedShortToBuffer(JausUnsignedShort input, unsigned char *buf, unsigned int bufferSizeBytes); - -JAUS_EXPORT double jausUnsignedShortToDouble(JausUnsignedShort input, double min, double max); -JAUS_EXPORT JausUnsignedShort jausUnsignedShortFromDouble(double value, double min, double max); - -JAUS_EXPORT JausBoolean jausUnsignedShortIsBitSet(JausUnsignedShort input, int bit); -JAUS_EXPORT JausBoolean jausUnsignedShortSetBit(JausUnsignedShort *input, int bit); -JAUS_EXPORT JausBoolean jausUnsignedShortClearBit(JausUnsignedShort *input, int bit); - -#endif // JAUS_UNSIGNED_SHORT_H diff --git a/lib/openjaus/libjaus/include/type/jausWorldModelFeatureClass.h b/lib/openjaus/libjaus/include/type/jausWorldModelFeatureClass.h deleted file mode 100644 index 77e8a2b60d45a0789b1f08f805046ad231068981..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausWorldModelFeatureClass.h +++ /dev/null @@ -1,133 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausWorldModelFeatureClass.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes all the functionality associated with a JausWorldModelFeatureClass. -// FeatureClasses are used to support metadata and attributes associated with objects in the JausWorldModel message set. - -#ifndef JAUS_WM_FEATURE_CLASS_H -#define JAUS_WM_FEATURE_CLASS_H - -#define JAUS_WM_FC_METADATA_STRING_LENGTH 65535 - -#include "jaus.h" -#include "string.h" - -// ************************************************************************************************************************************ -// JausWorldModelFeatureClassAttribute -// ************************************************************************************************************************************ -typedef struct -{ - JausByte dataType; // Enumeration, see above - union // Union of possible type values - { - JausByte byteValue; - JausShort shortValue; - JausInteger integerValue; - JausLong longValue; - JausUnsignedShort unsignedShortValue; - JausUnsignedInteger unsignedIntegerValue; - JausUnsignedLong unsignedLongValue; - JausFloat floatValue; - JausDouble doubleValue; - struct - { - JausByte redValue; - JausByte greenValue; - JausByte blueValue; - }rgb; - }data; -}JausWorldModelFeatureClassAttributeStruct; -typedef JausWorldModelFeatureClassAttributeStruct *JausWorldModelFeatureClassAttribute; - -// JausWorldModelFeatureClassAttribute Constructor -JAUS_EXPORT JausWorldModelFeatureClassAttribute featureClassAttributeCreate(void); - -// JausWorldModelFeatureClassAttribute Constructor (from Buffer) -JAUS_EXPORT JausWorldModelFeatureClassAttribute featureClassAttributeFromBuffer(unsigned char *buffer, unsigned int bufferSizeBytes); - -// JausWorldModelFeatureClassAttribute Destructor -JAUS_EXPORT void featureClassAttributeDestroy(JausWorldModelFeatureClassAttribute attribute); - -// JausWorldModelFeatureClassAttribute To Buffer -JAUS_EXPORT JausBoolean featureClassAttributeToBuffer(JausWorldModelFeatureClassAttribute attribute, unsigned char *buffer, unsigned int bufferSizeBytes); - -// JausWorldModelFeatureClassAttribute Buffer Size -JAUS_EXPORT unsigned int featureClassAttributeSizeBytes(JausWorldModelFeatureClassAttribute attribute); - -// JausWorldModelFeatureClassAttribute Copy -JAUS_EXPORT JausWorldModelFeatureClassAttribute featureClassAttributeCopy(JausWorldModelFeatureClassAttribute attribute); - -// JausWorldModelFeatureClassAttribute ToString -JAUS_EXPORT int featureClassAttributeToString(JausWorldModelFeatureClassAttribute attribute, char *string, size_t stringLength); - -// JausWorldModelFeatureClassAttribute GetValue -JAUS_EXPORT JausUnsignedLong featureClassAttributeGetValue(JausWorldModelFeatureClassAttribute attribute); - -// ************************************************************************************************************************************ -// FeatureClass -// ************************************************************************************************************************************ -typedef struct -{ - JausUnsignedShort id; // Enumeration, defined by system - char metaData[JAUS_WM_FC_METADATA_STRING_LENGTH]; // String of Metadata information defined for this Feature Class - JausWorldModelFeatureClassAttribute attribute; // Feature Class Attribute data type and value -}JausWorldModelFeatureClassStruct; -typedef JausWorldModelFeatureClassStruct *JausWorldModelFeatureClass; - -// JausWorldModelFeatureClass Constructor -JAUS_EXPORT JausWorldModelFeatureClass featureClassCreate(void); - -// JausWorldModelFeatureClass Constructor (from Buffer) -JAUS_EXPORT JausWorldModelFeatureClass featureClassFromBuffer(unsigned char *buffer, unsigned int bufferSizeBytes); - -// JausWorldModelFeatureClass Destructor -JAUS_EXPORT void featureClassDestroy(JausWorldModelFeatureClass fcClass); - -// JausWorldModelFeatureClass To Buffer -JAUS_EXPORT JausBoolean featureClassToBuffer(JausWorldModelFeatureClass fcClass, unsigned char *buffer, unsigned int bufferSizeBytes); - -// JausWorldModelFeatureClass Buffer Size -JAUS_EXPORT unsigned int featureClassSizeBytes(JausWorldModelFeatureClass fcClass); - -// JausWorldModelFeatureClass Copy -JAUS_EXPORT JausWorldModelFeatureClass featureClassCopy(JausWorldModelFeatureClass fcClass); - -#endif diff --git a/lib/openjaus/libjaus/include/type/jausWorldModelVectorObject.h b/lib/openjaus/libjaus/include/type/jausWorldModelVectorObject.h deleted file mode 100644 index f659f54fa9c6a3a7a221d297b7bc5ff95146d583..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/include/type/jausWorldModelVectorObject.h +++ /dev/null @@ -1,110 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausWorldModelVectorObject.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes all the functionality associated with a JausWorldModelVectorObject. -// JausWorldModelVectorObjects are used to support the storage and transfer of vector objects using the World Model message set. - -#ifndef JAUS_WM_VECTOR_OBJECT_H -#define JAUS_WM_VECTOR_OBJECT_H - -#include "jaus.h" -#include "string.h" - -// Vector Object types as defined in WMVKS Document v1.3 -#ifndef JAUS_WM_OBJECT_TYPES -#define JAUS_WM_OBJECT_TYPES -#define JAUS_WM_UNKNOWN_TYPE 255 -#define JAUS_WM_POINT_TYPE 0 -#define JAUS_WM_LINE_TYPE 1 -#define JAUS_WM_POLYGON_TYPE 2 -#endif - -// Attribute Data Types as defined in WMVKS Document v1.3 -#ifndef JAUS_WM_OBJECT_DATA_TYPE -#define JAUS_WM_OBJECT_DATA_TYPE -#define JAUS_WM_OBJECT_DEFAULT_DATA 255 -#define JAUS_WM_OBJECT_BYTE_DATA 0 -#define JAUS_WM_OBJECT_SHORT_DATA 1 -#define JAUS_WM_OBJECT_INTEGER_DATA 2 -#define JAUS_WM_OBJECT_LONG_DATA 3 -#define JAUS_WM_OBJECT_UNSIGNED_SHORT_DATA 4 -#define JAUS_WM_OBJECT_UNSIGNED_INTEGER_DATA 5 -#define JAUS_WM_OBJECT_UNSIGNED_LONG_DATA 6 -#define JAUS_WM_OBJECT_FLOAT_DATA 7 -#define JAUS_WM_OBJECT_DOUBLE_DATA 8 -#define JAUS_WM_OBJECT_RGB_DATA 9 -#endif - -// ************************************************************************************************************************************ -// JausWorldModelVectorObject -// ************************************************************************************************************************************ -typedef struct -{ - JausUnsignedShort id; // Unique Object Id - JausByte type; // Enumeration, see above - JausFloat bufferMeters; // Buffer Size in meters - JausArray featureClasses; // Dynamic Array of FeatureClass data - JausArray dataPoints; // Dynamic Array of PointLla data -}JausWorldModelVectorObjectStruct; -typedef JausWorldModelVectorObjectStruct *JausWorldModelVectorObject; - -// JausWorldModelVectorObject Constructor -JAUS_EXPORT JausWorldModelVectorObject vectorObjectCreate(void); - -// JausWorldModelVectorObject Constructor (from Buffer) -JAUS_EXPORT JausWorldModelVectorObject vectorObjectFromBuffer(unsigned char *buffer, unsigned int bufferSizeBytes, JausBoolean objectBuffered); - -// JausWorldModelVectorObject To Buffer -JAUS_EXPORT JausBoolean vectorObjectToBuffer(JausWorldModelVectorObject object, unsigned char *buffer, unsigned int bufferSizeBytes, JausBoolean objectBuffered); - -// JausWorldModelVectorObject Destructor -JAUS_EXPORT void vectorObjectDestroy(JausWorldModelVectorObject object); - -// JausWorldModelVectorObject Buffer Size -JAUS_EXPORT unsigned int vectorObjectSizeBytes(JausWorldModelVectorObject object, JausBoolean objectBuffered); - -// JausWorldModelVectorObject To String -JAUS_EXPORT int vectorObjectTypeToString(JausWorldModelVectorObject object, char *string, size_t stringLength); - -// JausWorldModelVectorObject Copy -JAUS_EXPORT JausWorldModelVectorObject vectorObjectCopy(JausWorldModelVectorObject input); - -#endif // VECTOROBJECT_H diff --git a/lib/openjaus/libjaus/lib/linux/libjaus.a b/lib/openjaus/libjaus/lib/linux/libjaus.a deleted file mode 100644 index 99780ab4521d69fd0ce599954485472fb6ce2565..0000000000000000000000000000000000000000 Binary files a/lib/openjaus/libjaus/lib/linux/libjaus.a and /dev/null differ diff --git a/lib/openjaus/libjaus/lib/mac/libjaus.a b/lib/openjaus/libjaus/lib/mac/libjaus.a deleted file mode 100644 index 006ff3b6ff49987fa76c5b9b5b453661986a80df..0000000000000000000000000000000000000000 Binary files a/lib/openjaus/libjaus/lib/mac/libjaus.a and /dev/null differ diff --git a/lib/openjaus/libjaus/libjaus.pro b/lib/openjaus/libjaus/libjaus.pro deleted file mode 100644 index 73e0d0e5686484f5c4af764dcf554cc76857e6f7..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/libjaus.pro +++ /dev/null @@ -1,501 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Sa Mai 2 12:07:27 2009 -###################################################################### - -TEMPLATE = lib -QT -= gui -CONFIG += static - -macx { -TARGET = lib/mac/jaus -} - -linux-g++ { -TARGET = lib/linux/jaus -} - -win32 { -TARGET = lib/win32/jaus -} - -VERSION = 3.3.0a - -BASEDIR = . -BUILDDIR = Build -LANGUAGE = C++ - -OBJECTS_DIR = $$BUILDDIR/obj -MOC_DIR = $$BUILDDIR/moc - -DEPENDPATH += . \ - include \ - src \ - include/message \ - include/type \ - src/message \ - src/type \ - include/message/command/communications \ - include/message/command/core \ - include/message/command/environment \ - include/message/command/event \ - include/message/command/manipulator \ - include/message/command/payload \ - include/message/command/planning \ - include/message/command/platform \ - include/message/command/worldModel \ - include/message/inform/communications \ - include/message/inform/core \ - include/message/inform/dynamicConfiguration \ - include/message/inform/environment \ - include/message/inform/event \ - include/message/inform/manipulator \ - include/message/inform/payload \ - include/message/inform/planning \ - include/message/inform/platform \ - include/message/inform/worldModel \ - include/message/query/communications \ - include/message/query/core \ - include/message/query/dynamicConfiguration \ - include/message/query/environment \ - include/message/query/event \ - include/message/query/manipulator \ - include/message/query/payload \ - include/message/query/planning \ - include/message/query/platform \ - include/message/query/worldModel \ - src/message/command/communications \ - src/message/command/core \ - src/message/command/environment \ - src/message/command/event \ - src/message/command/manipulator \ - src/message/command/payload \ - src/message/command/planning \ - src/message/command/platform \ - src/message/command/worldModel \ - src/message/inform/communications \ - src/message/inform/core \ - src/message/inform/dynamicConfiguration \ - src/message/inform/environment \ - src/message/inform/event \ - src/message/inform/manipulator \ - src/message/inform/payload \ - src/message/inform/planning \ - src/message/inform/platform \ - src/message/inform/worldModel \ - src/message/query/communications \ - src/message/query/core \ - src/message/query/dynamicConfiguration \ - src/message/query/environment \ - src/message/query/event \ - src/message/query/manipulator \ - src/message/query/payload \ - src/message/query/planning \ - src/message/query/platform \ - src/message/query/worldModel -INCLUDEPATH += . \ - include \ - include/type \ - include/message \ - include/message/command/core \ - include/message/command/communications \ - include/message/command/environment \ - include/message/command/manipulator \ - include/message/command/platform \ - include/message/command/planning \ - include/message/command/worldModel \ - include/message/command/payload \ - include/message/command/event \ - include/message/inform/core \ - include/message/inform/communications \ - include/message/inform/environment \ - include/message/inform/manipulator \ - include/message/inform/platform \ - include/message/inform/planning \ - include/message/inform/dynamicConfiguration \ - include/message/inform/payload \ - include/message/inform/worldModel \ - include/message/inform/event \ - include/message/query/core \ - include/message/query/communications \ - include/message/query/environment \ - include/message/query/manipulator \ - include/message/query/platform \ - include/message/query/planning \ - include/message/query/dynamicConfiguration \ - include/message/query/payload \ - include/message/query/worldModel \ - include/message/query/event - -# Input -HEADERS += include/jaus.h \ - include/jausAddress.h \ - include/jausArray.h \ - include/jausComponent.h \ - include/jausNode.h \ - include/jausPayloadInterface.h \ - include/jausService.h \ - include/jausState.h \ - include/jausSubsystem.h \ - include/message/jausMessage.h \ - include/message/jausMessageHeaders.h \ - include/message/skeletonMessage.h \ - include/type/jausByte.h \ - include/type/jausDouble.h \ - include/type/jausEventLimit.h \ - include/type/jausFloat.h \ - include/type/jausGeometryPointLLA.h \ - include/type/jausGeometryPointXYZ.h \ - include/type/jausInteger.h \ - include/type/jausLong.h \ - include/type/jausMissionCommand.h \ - include/type/jausMissionTask.h \ - include/type/jausShort.h \ - include/type/jausTime.h \ - include/type/jausType.h \ - include/type/jausUnsignedInteger.h \ - include/type/jausUnsignedLong.h \ - include/type/jausUnsignedShort.h \ - include/type/jausWorldModelFeatureClass.h \ - include/type/jausWorldModelVectorObject.h \ - include/message/command/communications/setDataLinkSelectMessage.h \ - include/message/command/communications/setDataLinkStatusMessage.h \ - include/message/command/communications/setSelectedDataLinkStateMessage.h \ - include/message/command/core/activateServiceConnectionMessage.h \ - include/message/command/core/clearEmergencyMessage.h \ - include/message/command/core/confirmComponentControlMessage.h \ - include/message/command/core/confirmServiceConnectionMessage.h \ - include/message/command/core/createServiceConnectionMessage.h \ - include/message/command/core/rejectComponentControlMessage.h \ - include/message/command/core/releaseComponentControlMessage.h \ - include/message/command/core/requestComponentControlMessage.h \ - include/message/command/core/resetMessage.h \ - include/message/command/core/resumeMessage.h \ - include/message/command/core/setComponentAuthorityMessage.h \ - include/message/command/core/setEmergencyMessage.h \ - include/message/command/core/setTimeMessage.h \ - include/message/command/core/shutdownMessage.h \ - include/message/command/core/standbyMessage.h \ - include/message/command/core/suspendServiceConnectionMessage.h \ - include/message/command/core/terminateServiceConnectionMessage.h \ - include/message/command/environment/selectCameraMessage.h \ - include/message/command/environment/setCameraCapabilitiesMessage.h \ - include/message/command/environment/setCameraFormatOptionsMessage.h \ - include/message/command/environment/setCameraPoseMessage.h \ - include/message/command/event/cancelEventMessage.h \ - include/message/command/event/confirmEventRequestMessage.h \ - include/message/command/event/createEventMessage.h \ - include/message/command/event/rejectEventRequestMessage.h \ - include/message/command/event/updateEventMessage.h \ - include/message/command/manipulator/setEndEffectorPathMotionMessage.h \ - include/message/command/manipulator/setEndEffectorPoseMessage.h \ - include/message/command/manipulator/setEndEffectorVelocityStateMessage.h \ - include/message/command/manipulator/setJointEffortsMessage.h \ - include/message/command/manipulator/setJointMotionMessage.h \ - include/message/command/manipulator/setJointPositionsMessage.h \ - include/message/command/manipulator/setJointVelocitiesMessage.h \ - include/message/command/manipulator/setToolPointMessage.h \ - include/message/command/payload/setPayloadDataElementMessage.h \ - include/message/command/planning/abortMissionMessage.h \ - include/message/command/planning/pauseMissionMessage.h \ - include/message/command/planning/removeMessagesMessage.h \ - include/message/command/planning/replaceMessagesMessage.h \ - include/message/command/planning/resumeMissionMessage.h \ - include/message/command/planning/runMissionMessage.h \ - include/message/command/planning/spoolMissionMessage.h \ - include/message/command/platform/setDiscreteDevicesMessage.h \ - include/message/command/platform/setGlobalPathSegmentMessage.h \ - include/message/command/platform/setGlobalVectorMessage.h \ - include/message/command/platform/setGlobalWaypointMessage.h \ - include/message/command/platform/setLocalPathSegmentMessage.h \ - include/message/command/platform/setLocalVectorMessage.h \ - include/message/command/platform/setLocalWaypointMessage.h \ - include/message/command/platform/setTravelSpeedMessage.h \ - include/message/command/platform/setVelocityStateMessage.h \ - include/message/command/platform/setWrenchEffortMessage.h \ - include/message/command/worldModel/createVksObjectsMessage.h \ - include/message/command/worldModel/deleteVksObjectsMessage.h \ - include/message/command/worldModel/setVksFeatureClassMetadataMessage.h \ - include/message/command/worldModel/terminateVksDataTransferMessage.h \ - include/message/inform/communications/reportDataLinkStatusMessage.h \ - include/message/inform/communications/reportHeartbeatPulseMessage.h \ - include/message/inform/communications/reportSelectedDataLinkStatusMessage.h \ - include/message/inform/core/reportComponentAuthorityMessage.h \ - include/message/inform/core/reportComponentControlMessage.h \ - include/message/inform/core/reportComponentStatusMessage.h \ - include/message/inform/core/reportTimeMessage.h \ - include/message/inform/dynamicConfiguration/reportConfigurationMessage.h \ - include/message/inform/dynamicConfiguration/reportIdentificationMessage.h \ - include/message/inform/dynamicConfiguration/reportServicesMessage.h \ - include/message/inform/dynamicConfiguration/reportSubsystemListMessage.h \ - include/message/inform/environment/reportCameraCapabilitiesMessage.h \ - include/message/inform/environment/reportCameraCountMessage.h \ - include/message/inform/environment/reportCameraFormatOptionsMessage.h \ - include/message/inform/environment/reportCameraPoseMessage.h \ - include/message/inform/environment/reportImageMessage.h \ - include/message/inform/environment/reportRelativeObjectPositionMessage.h \ - include/message/inform/environment/reportSelectedCameraMessage.h \ - include/message/inform/event/eventMessage.h \ - include/message/inform/event/reportEventsMessage.h \ - include/message/inform/manipulator/reportJointEffortsMessage.h \ - include/message/inform/manipulator/reportJointForceTorquesMessage.h \ - include/message/inform/manipulator/reportJointPositionsMessage.h \ - include/message/inform/manipulator/reportJointVelocitiesMessage.h \ - include/message/inform/manipulator/reportManipulatorSpecificationsMessage.h \ - include/message/inform/manipulator/reportToolPointMessage.h \ - include/message/inform/payload/reportPayloadDataElementMessage.h \ - include/message/inform/payload/reportPayloadInterfaceMessage.h \ - include/message/inform/planning/reportMissionStatusMessage.h \ - include/message/inform/planning/reportSpoolingPreferenceMessage.h \ - include/message/inform/platform/reportDiscreteDevicesMessage.h \ - include/message/inform/platform/reportGlobalPathSegmentMessage.h \ - include/message/inform/platform/reportGlobalPoseMessage.h \ - include/message/inform/platform/reportGlobalVectorMessage.h \ - include/message/inform/platform/reportGlobalWaypointMessage.h \ - include/message/inform/platform/reportLocalPathSegmentMessage.h \ - include/message/inform/platform/reportLocalPoseMessage.h \ - include/message/inform/platform/reportLocalVectorMessage.h \ - include/message/inform/platform/reportLocalWaypointMessage.h \ - include/message/inform/platform/reportPathSegmentCountMessage.h \ - include/message/inform/platform/reportPlatformOperationalDataMessage.h \ - include/message/inform/platform/reportPlatformSpecificationsMessage.h \ - include/message/inform/platform/reportTravelSpeedMessage.h \ - include/message/inform/platform/reportVelocityStateMessage.h \ - include/message/inform/platform/reportWaypointCountMessage.h \ - include/message/inform/platform/reportWrenchEffortMessage.h \ - include/message/inform/worldModel/reportVksBoundsMessage.h \ - include/message/inform/worldModel/reportVksDataTransferTerminationMessage.h \ - include/message/inform/worldModel/reportVksFeatureClassMetadataMessage.h \ - include/message/inform/worldModel/reportVksObjectsCreationMessage.h \ - include/message/inform/worldModel/reportVksObjectsMessage.h \ - include/message/query/communications/queryDataLinkStatusMessage.h \ - include/message/query/communications/queryHeartbeatPulseMessage.h \ - include/message/query/communications/querySelectedDataLinkStatusMessage.h \ - include/message/query/core/queryComponentAuthorityMessage.h \ - include/message/query/core/queryComponentControlMessage.h \ - include/message/query/core/queryComponentStatusMessage.h \ - include/message/query/core/queryTimeMessage.h \ - include/message/query/dynamicConfiguration/queryConfigurationMessage.h \ - include/message/query/dynamicConfiguration/queryIdentificationMessage.h \ - include/message/query/dynamicConfiguration/queryServicesMessage.h \ - include/message/query/dynamicConfiguration/querySubsystemListMessage.h \ - include/message/query/environment/queryCameraCapabilitiesMessage.h \ - include/message/query/environment/queryCameraCountMessage.h \ - include/message/query/environment/queryCameraFormatOptionsMessage.h \ - include/message/query/environment/queryCameraPoseMessage.h \ - include/message/query/environment/queryImageMessage.h \ - include/message/query/environment/queryRelativeObjectPositionMessage.h \ - include/message/query/environment/querySelectedCameraMessage.h \ - include/message/query/event/queryEventsMessage.h \ - include/message/query/manipulator/queryJointEffortsMessage.h \ - include/message/query/manipulator/queryJointForceTorquesMessage.h \ - include/message/query/manipulator/queryJointPositionsMessage.h \ - include/message/query/manipulator/queryJointVelocitiesMessage.h \ - include/message/query/manipulator/queryManipulatorSpecificationsMessage.h \ - include/message/query/manipulator/queryToolPointMessage.h \ - include/message/query/payload/queryPayloadDataElementMessage.h \ - include/message/query/payload/queryPayloadInterfaceMessage.h \ - include/message/query/planning/queryMissionStatusMessage.h \ - include/message/query/planning/querySpoolingPreferenceMessage.h \ - include/message/query/platform/queryDiscreteDevicesMessage.h \ - include/message/query/platform/queryGlobalPathSegmentMessage.h \ - include/message/query/platform/queryGlobalPoseMessage.h \ - include/message/query/platform/queryGlobalVectorMessage.h \ - include/message/query/platform/queryGlobalWaypointMessage.h \ - include/message/query/platform/queryLocalPathSegmentMessage.h \ - include/message/query/platform/queryLocalPoseMessage.h \ - include/message/query/platform/queryLocalVectorMessage.h \ - include/message/query/platform/queryLocalWaypointMessage.h \ - include/message/query/platform/queryPathSegmentCountMessage.h \ - include/message/query/platform/queryPlatformOperationalDataMessage.h \ - include/message/query/platform/queryPlatformSpecificationsMessage.h \ - include/message/query/platform/queryTravelSpeedMessage.h \ - include/message/query/platform/queryVelocityStateMessage.h \ - include/message/query/platform/queryWaypointCountMessage.h \ - include/message/query/platform/queryWrenchEffortMessage.h \ - include/message/query/worldModel/queryVksBoundsMessage.h \ - include/message/query/worldModel/queryVksFeatureClassMetadataMessage.h \ - include/message/query/worldModel/queryVksObjectsMessage.h -SOURCES += src/jausAddress.c \ - src/jausArray.c \ - src/jausComponent.c \ - src/jausNode.c \ - src/jausPayloadInterface.c \ - src/jausService.c \ - src/jausState.c \ - src/jausSubsystem.c \ - src/message/jausMessage.c \ - src/type/jausByte.c \ - src/type/jausDouble.c \ - src/type/jausEventLimit.c \ - src/type/jausFloat.c \ - src/type/jausGeometryPointLLA.c \ - src/type/jausGeometryPointXYZ.c \ - src/type/jausInteger.c \ - src/type/jausLong.c \ - src/type/jausMissionCommand.c \ - src/type/jausMissionTask.c \ - src/type/jausShort.c \ - src/type/jausTime.c \ - src/type/jausUnsignedInteger.c \ - src/type/jausUnsignedLong.c \ - src/type/jausUnsignedShort.c \ - src/type/jausWorldModelFeatureClass.c \ - src/type/jausWorldModelVectorObject.c \ - src/message/command/communications/setDataLinkSelectMessage.c \ - src/message/command/communications/setDataLinkStatusMessage.c \ - src/message/command/communications/setSelectedDataLinkStateMessage.c \ - src/message/command/core/activateServiceConnectionMessage.c \ - src/message/command/core/clearEmergencyMessage.c \ - src/message/command/core/confirmComponentControlMessage.c \ - src/message/command/core/confirmServiceConnectionMessage.c \ - src/message/command/core/createServiceConnectionMessage.c \ - src/message/command/core/rejectComponentControlMessage.c \ - src/message/command/core/releaseComponentControlMessage.c \ - src/message/command/core/requestComponentControlMessage.c \ - src/message/command/core/resetMessage.c \ - src/message/command/core/resumeMessage.c \ - src/message/command/core/setComponentAuthorityMessage.c \ - src/message/command/core/setEmergencyMessage.c \ - src/message/command/core/setTimeMessage.c \ - src/message/command/core/shutdownMessage.c \ - src/message/command/core/standbyMessage.c \ - src/message/command/core/suspendServiceConnectionMessage.c \ - src/message/command/core/terminateServiceConnectionMessage.c \ - src/message/command/environment/selectCameraMessage.c \ - src/message/command/environment/setCameraCapabilitiesMessage.c \ - src/message/command/environment/setCameraFormatOptionsMessage.c \ - src/message/command/environment/setCameraPoseMessage.c \ - src/message/command/event/cancelEventMessage.c \ - src/message/command/event/confirmEventRequestMessage.c \ - src/message/command/event/createEventMessage.c \ - src/message/command/event/rejectEventRequestMessage.c \ - src/message/command/event/updateEventMessage.c \ - src/message/command/manipulator/setEndEffectorPathMotionMessage.c \ - src/message/command/manipulator/setEndEffectorPoseMessage.c \ - src/message/command/manipulator/setEndEffectorVelocityStateMessage.c \ - src/message/command/manipulator/setJointEffortsMessage.c \ - src/message/command/manipulator/setJointMotionMessage.c \ - src/message/command/manipulator/setJointPositionsMessage.c \ - src/message/command/manipulator/setJointVelocitiesMessage.c \ - src/message/command/manipulator/setToolPointMessage.c \ - src/message/command/payload/setPayloadDataElementMessage.c \ - src/message/command/planning/abortMissionMessage.c \ - src/message/command/planning/pauseMissionMessage.c \ - src/message/command/planning/removeMessagesMessage.c \ - src/message/command/planning/replaceMessagesMessage.c \ - src/message/command/planning/resumeMissionMessage.c \ - src/message/command/planning/runMissionMessage.c \ - src/message/command/planning/spoolMissionMessage.c \ - src/message/command/platform/setDiscreteDevicesMessage.c \ - src/message/command/platform/setGlobalPathSegmentMessage.c \ - src/message/command/platform/setGlobalVectorMessage.c \ - src/message/command/platform/setGlobalWaypointMessage.c \ - src/message/command/platform/setLocalPathSegmentMessage.c \ - src/message/command/platform/setLocalVectorMessage.c \ - src/message/command/platform/setLocalWaypointMessage.c \ - src/message/command/platform/setTravelSpeedMessage.c \ - src/message/command/platform/setVelocityStateMessage.c \ - src/message/command/platform/setWrenchEffortMessage.c \ - src/message/command/worldModel/createVksObjectsMessage.c \ - src/message/command/worldModel/deleteVksObjectsMessage.c \ - src/message/command/worldModel/setVksFeatureClassMetadataMessage.c \ - src/message/command/worldModel/terminateVksDataTransferMessage.c \ - src/message/inform/communications/reportDataLinkStatusMessage.c \ - src/message/inform/communications/reportHeartbeatPulseMessage.c \ - src/message/inform/communications/reportSelectedDataLinkStatusMessage.c \ - src/message/inform/core/reportComponentAuthorityMessage.c \ - src/message/inform/core/reportComponentControlMessage.c \ - src/message/inform/core/reportComponentStatusMessage.c \ - src/message/inform/core/reportTimeMessage.c \ - src/message/inform/dynamicConfiguration/reportConfigurationMessage.c \ - src/message/inform/dynamicConfiguration/reportIdentificationMessage.c \ - src/message/inform/dynamicConfiguration/reportServicesMessage.c \ - src/message/inform/dynamicConfiguration/reportSubsystemListMessage.c \ - src/message/inform/environment/reportCameraCapabilitiesMessage.c \ - src/message/inform/environment/reportCameraCountMessage.c \ - src/message/inform/environment/reportCameraFormatOptionsMessage.c \ - src/message/inform/environment/reportCameraPoseMessage.c \ - src/message/inform/environment/reportImageMessage.c \ - src/message/inform/environment/reportRelativeObjectPositionMessage.c \ - src/message/inform/environment/reportSelectedCameraMessage.c \ - src/message/inform/event/eventMessage.c \ - src/message/inform/event/reportEventsMessage.c \ - src/message/inform/manipulator/reportJointEffortsMessage.c \ - src/message/inform/manipulator/reportJointForceTorquesMessage.c \ - src/message/inform/manipulator/reportJointPositionsMessage.c \ - src/message/inform/manipulator/reportJointVelocitiesMessage.c \ - src/message/inform/manipulator/reportManipulatorSpecificationsMessage.c \ - src/message/inform/manipulator/reportToolPointMessage.c \ - src/message/inform/payload/reportPayloadDataElementMessage.c \ - src/message/inform/payload/reportPayloadInterfaceMessage.c \ - src/message/inform/planning/reportMissionStatusMessage.c \ - src/message/inform/planning/reportSpoolingPreferenceMessage.c \ - src/message/inform/platform/reportDiscreteDevicesMessage.c \ - src/message/inform/platform/reportGlobalPathSegmentMessage.c \ - src/message/inform/platform/reportGlobalPoseMessage.c \ - src/message/inform/platform/reportGlobalVectorMessage.c \ - src/message/inform/platform/reportGlobalWaypointMessage.c \ - src/message/inform/platform/reportLocalPathSegmentMessage.c \ - src/message/inform/platform/reportLocalPoseMessage.c \ - src/message/inform/platform/reportLocalVectorMessage.c \ - src/message/inform/platform/reportLocalWaypointMessage.c \ - src/message/inform/platform/reportPathSegmentCountMessage.c \ - src/message/inform/platform/reportPlatformOperationalDataMessage.c \ - src/message/inform/platform/reportPlatformSpecificationsMessage.c \ - src/message/inform/platform/reportTravelSpeedMessage.c \ - src/message/inform/platform/reportVelocityStateMessage.c \ - src/message/inform/platform/reportWaypointCountMessage.c \ - src/message/inform/platform/reportWrenchEffortMessage.c \ - src/message/inform/worldModel/reportVksBoundsMessage.c \ - src/message/inform/worldModel/reportVksDataTransferTerminationMessage.c \ - src/message/inform/worldModel/reportVksFeatureClassMetadataMessage.c \ - src/message/inform/worldModel/reportVksObjectsCreationMessage.c \ - src/message/inform/worldModel/reportVksObjectsMessage.c \ - src/message/query/communications/queryDataLinkStatusMessage.c \ - src/message/query/communications/queryHeartbeatPulseMessage.c \ - src/message/query/communications/querySelectedDataLinkStatusMessage.c \ - src/message/query/core/queryComponentAuthorityMessage.c \ - src/message/query/core/queryComponentControlMessage.c \ - src/message/query/core/queryComponentStatusMessage.c \ - src/message/query/core/queryTimeMessage.c \ - src/message/query/dynamicConfiguration/queryConfigurationMessage.c \ - src/message/query/dynamicConfiguration/queryIdentificationMessage.c \ - src/message/query/dynamicConfiguration/queryServicesMessage.c \ - src/message/query/dynamicConfiguration/querySubsystemListMessage.c \ - src/message/query/environment/queryCameraCapabilitiesMessage.c \ - src/message/query/environment/queryCameraCountMessage.c \ - src/message/query/environment/queryCameraFormatOptionsMessage.c \ - src/message/query/environment/queryCameraPoseMessage.c \ - src/message/query/environment/queryImageMessage.c \ - src/message/query/environment/queryRelativeObjectPositionMessage.c \ - src/message/query/environment/querySelectedCameraMessage.c \ - src/message/query/event/queryEventsMessage.c \ - src/message/query/manipulator/queryJointEffortsMessage.c \ - src/message/query/manipulator/queryJointForceTorquesMessage.c \ - src/message/query/manipulator/queryJointPositionsMessage.c \ - src/message/query/manipulator/queryJointVelocitiesMessage.c \ - src/message/query/manipulator/queryManipulatorSpecificationsMessage.c \ - src/message/query/manipulator/queryToolPointMessage.c \ - src/message/query/payload/queryPayloadDataElementMessage.c \ - src/message/query/payload/queryPayloadInterfaceMessage.c \ - src/message/query/planning/queryMissionStatusMessage.c \ - src/message/query/planning/querySpoolingPreferenceMessage.c \ - src/message/query/platform/queryDiscreteDevicesMessage.c \ - src/message/query/platform/queryGlobalPathSegmentMessage.c \ - src/message/query/platform/queryGlobalPoseMessage.c \ - src/message/query/platform/queryGlobalVectorMessage.c \ - src/message/query/platform/queryGlobalWaypointMessage.c \ - src/message/query/platform/queryLocalPathSegmentMessage.c \ - src/message/query/platform/queryLocalPoseMessage.c \ - src/message/query/platform/queryLocalVectorMessage.c \ - src/message/query/platform/queryLocalWaypointMessage.c \ - src/message/query/platform/queryPathSegmentCountMessage.c \ - src/message/query/platform/queryPlatformOperationalDataMessage.c \ - src/message/query/platform/queryPlatformSpecificationsMessage.c \ - src/message/query/platform/queryTravelSpeedMessage.c \ - src/message/query/platform/queryVelocityStateMessage.c \ - src/message/query/platform/queryWaypointCountMessage.c \ - src/message/query/platform/queryWrenchEffortMessage.c \ - src/message/query/worldModel/queryVksBoundsMessage.c \ - src/message/query/worldModel/queryVksFeatureClassMetadataMessage.c \ - src/message/query/worldModel/queryVksObjectsMessage.c diff --git a/lib/openjaus/libjaus/src/jausAddress.c b/lib/openjaus/libjaus/src/jausAddress.c deleted file mode 100644 index 66ee77d58af98a87a83d39c4e94cc6f8d1ecba3c..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/jausAddress.c +++ /dev/null @@ -1,146 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausAddress.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the basic functions for use with the JausAddress of each component - -#include -#include -#include "jaus.h" - -JausAddress jausAddressCreate(void) -{ - JausAddress address; - - address = (JausAddress)malloc( sizeof(struct JausAddressStruct) ); - if(address == NULL) - { - return NULL; - } - - // Init Values - address->instance = 0; - address->component = 0; - address->node = 0; - address->subsystem = 0; - - address->next = NULL; - - return address; -} - -void jausAddressDestroy(JausAddress address) -{ - free(address); -} - -JausAddress jausAddressClone(JausAddress input) -{ - JausAddress address; - - address = (JausAddress)malloc( sizeof(struct JausAddressStruct) ); - if(address == NULL) - { - return NULL; - } - - address->instance = input->instance; - address->component = input->component; - address->node = input->node; - address->subsystem = input->subsystem; - - address->next = input->next; - - return address; -} - -JausBoolean jausAddressCopy(JausAddress dst, JausAddress src) -{ - if(dst && src) - { - dst->subsystem = src->subsystem; - dst->node = src->node; - dst->component = src->component; - dst->instance = src->instance; - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean jausAddressEqual(JausAddress first, JausAddress second) -{ - return (JausBoolean) ( first->subsystem == second->subsystem && - first->node == second->node && - first->component == second->component && - first->instance == second->instance ); -} - - -int jausAddressToString(JausAddress address, char *buf) -{ - if(address) - { - return sprintf(buf, "%d.%d.%d.%d", address->subsystem, address->node, address->component, address->instance); - } - else - { - return sprintf(buf, "Invalid JAUS Address"); - } -} - - -JausBoolean jausAddressIsValid(JausAddress address) -{ - return (address && - address->subsystem != JAUS_INVALID_SUBSYSTEM_ID && - address->node != JAUS_INVALID_NODE_ID && - address->component != JAUS_INVALID_COMPONENT_ID && - address->instance != JAUS_INVALID_INSTANCE_ID); -} - -int jausAddressHash(JausAddress address) -{ - int hash = (address->subsystem << 24) | (address->node << 16) | (address->component << 8) | (address->instance); - return hash; -} - diff --git a/lib/openjaus/libjaus/src/jausArray.c b/lib/openjaus/libjaus/src/jausArray.c deleted file mode 100644 index b1941e325163538ef9902d224757349aaff38ab6..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/jausArray.c +++ /dev/null @@ -1,196 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausArray.c -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) and Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the attributes of a JausArray object - -#include -#include -#include "jaus.h" - -int jausArrayIncrement(JausArray); - -JausArray jausArrayCreate(void) -{ - JausArray jausArray; - - jausArray = (JausArray)malloc( sizeof(JausArrayStruct) ); - if(jausArray == NULL) - { - return NULL; - } - - jausArray->capacity = 8; - jausArray->capacityIncrement = 8; - - jausArray->elementCount = 0; - jausArray->elementData = (void **)malloc( sizeof(void *) * jausArray->capacity); - if(jausArray->elementData == NULL) - { - free(jausArray); - return NULL; - } - - return jausArray; -} - -void jausArrayDestroy(JausArray jausArray, void (*elementDestroy)(void *)) -{ - int i; - - if(jausArray == NULL) - { - return; - } - - if(elementDestroy != NULL) - { - i = jausArray->elementCount; - while(i--) - { - elementDestroy(jausArray->elementData[i]); - } - } - - free(jausArray->elementData); - free(jausArray); -} - -void jausArrayAdd(JausArray jausArray, void *element) -{ - jausArray->elementCount++; - if(jausArray->elementCount > jausArray->capacity) - { - jausArrayIncrement(jausArray); - } - - jausArray->elementData[jausArray->elementCount - 1] = element; -} - -int jausArrayIncrement(JausArray jausArray) -{ - int newCapacity = jausArray->capacity + jausArray->capacityIncrement; - void ** newElementData; - - newElementData = (void **)realloc((void *)jausArray->elementData, sizeof(void *) * newCapacity); - - if(newElementData == NULL) - { - return -1; - } - else - { - jausArray->elementData = newElementData; - jausArray->capacity = newCapacity; - return 0; - } -} - -int jausArrayContains(JausArray jausArray, void *testElement, int (*equals)(void *, void *)) -{ - int i; - - for(i = 0; i < jausArray->elementCount; i++) - { - if(equals(jausArray->elementData[i], testElement)) - { - return i; - } - } - - return -1; -} - -// Returns the element removed -void *jausArrayRemoveAt(JausArray jausArray, int index) -{ - int i; -// int newCapacity = jausArray->capacity - jausArray->capacityIncrement; - void *retValue; - - if(jausArray->elementCount <= index) - { - return NULL; - } - - retValue = jausArray->elementData[index]; - for(i = index; i < jausArray->elementCount - 1; i++) - { - jausArray->elementData[i] = jausArray->elementData[i+1]; - } - - // TODO: Check to see if we should shrink capacity - // jausArray->elementData = (void **)realloc((void *)jausArray->elementData, sizeof(void *) * newCapacity); - jausArray->elementCount--; - // jausArray->capacity = newCapacity; - - return retValue; -} - -// returns the element removed -void *jausArrayRemove(JausArray jausArray, void *testElement, int (*equals)(void *, void *)) -{ - int i; - - for(i = 0; i < jausArray->elementCount; i++) - { - if(equals(jausArray->elementData[i], testElement)) - { - return jausArrayRemoveAt(jausArray, i); - } - } - - return NULL; -} - -void jausArrayRemoveAll(JausArray jausArray, void (*elementDestroy)(void *)) -{ - int i; - - if(elementDestroy != NULL) - { - i = jausArray->elementCount; - while(i--) - { - elementDestroy(jausArray->elementData[i]); - } - jausArray->elementCount = 0; - } -} diff --git a/lib/openjaus/libjaus/src/jausComponent.c b/lib/openjaus/libjaus/src/jausComponent.c deleted file mode 100644 index 792e5d166990a77fdc7aed20f4b9036cf7ede92d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/jausComponent.c +++ /dev/null @@ -1,268 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausComponent.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines basic functions related to a JausComponent structure - -#include -#include -#include -#include -#include "jaus.h" - -JausComponent jausComponentCreate(void) -{ - JausComponent component; - - component = (JausComponent) calloc( 1, sizeof(JausComponentStruct) ); - if(component == NULL) - { - return NULL; - } - - // Init Values - component->identification = NULL; - component->address = jausAddressCreate(); - if(!component->address) - { - free(component); - return NULL; - } - - component->node = NULL; - component->state = JAUS_UNDEFINED_STATE; - component->authority = JAUS_DEFAULT_AUTHORITY; - component->services = jausServicesCreate(); - if(!component->services) - { - jausAddressDestroy(component->address); - free(component); - return NULL; - } - - component->controller.active = JAUS_FALSE; - component->controller.authority = JAUS_DEFAULT_AUTHORITY; - component->controller.state = JAUS_UNDEFINED_STATE; - component->controller.address = jausAddressCreate(); - if(!component->controller.address) - { - jausServicesDestroy(component->services); - jausAddressDestroy(component->address); - free(component); - return NULL; - } - - jausComponentUpdateTimestamp(component); - - return component; -} - -void jausComponentDestroy(JausComponent component) -{ - if(component) - { - jausServicesDestroy(component->services); - jausAddressDestroy(component->controller.address); - jausAddressDestroy(component->address); - if(component->identification) free(component->identification); - free(component); - } -} - -JausComponent jausComponentClone(JausComponent component) -{ - JausComponent clone; - size_t stringLength = 0; - - clone = (JausComponent)malloc( sizeof(JausComponentStruct) ); - if(clone == NULL) - { - return NULL; - } - - // Init Values - if(component->identification) - { - stringLength = strlen(component->identification) + 1; - clone->identification = malloc(stringLength); - sprintf(clone->identification, "%s", component->identification); - } - else - { - clone->identification = NULL; - } - - clone->address = jausAddressCreate(); - jausAddressCopy(clone->address, component->address); - clone->node = component->node; - clone->state = component->state; - clone->authority = component->authority; - - clone->controller.active = component->controller.active; - clone->controller.authority = component->controller.authority; - clone->controller.state = component->controller.state; - clone->controller.address = jausAddressCreate(); - jausAddressCopy(clone->controller.address, component->controller.address); - - clone->services = jausServicesClone(component->services); - - jausComponentUpdateTimestamp(clone); - - return clone; -} - -char *jausComponentGetTypeString(JausComponent component) -{ - switch(component->address->component) - { - case JAUS_NODE_MANAGER: - return "NodeManager"; - case JAUS_SYSTEM_COMMANDER: - return "SystemCommander"; - case JAUS_SUBSYSTEM_COMMANDER: - return "SubsystemCommander"; - case JAUS_COMMUNICATOR: - return "Communicator"; - case JAUS_GLOBAL_POSE_SENSOR: - return "GlobalPoseSensor"; - case JAUS_LOCAL_POSE_SENSOR: - return "LocalPosSensor"; - case JAUS_VELOCITY_STATE_SENSOR: - return "VelocityStateSensor"; - case JAUS_PRIMITIVE_DRIVER: - return "PrimitiveDriver"; - case JAUS_REFLEXIVE_DRIVER: - return "ReflexiveDriver"; - case JAUS_GLOBAL_VECTOR_DRIVER: - return "GlobalVectorDriver"; - case JAUS_LOCAL_VECTOR_DRIVER: - return "LocalVectorDriver"; - case JAUS_GLOBAL_WAYPOINT_DRIVER: - return "GlobalWaypointDriver"; - case JAUS_LOCAL_WAYPOINT_DRIVER: - return "LocalWaypointDriver"; - case JAUS_GLOBAL_PATH_SEGMENT_DRIVER: - return "GlobalPathSegmentDriver"; - case JAUS_LOCAL_PATH_SEGMENT_DRIVER: - return "LocalPathSegmentDriver"; - case JAUS_PRIMITIVE_MANIPULATOR: - return "PrimativeManipulator"; - case JAUS_MANIPULATOR_JOINT_POSITION_SENSOR: - return "ManipulatorJointPositionSensor"; - case JAUS_MANIPULATOR_JOINT_VELOCITY_SENSOR: - return "ManipulatorJointVelocitySensor"; - case JAUS_MANIPULATOR_JOINT_FORCE_TORQUE_SENSOR: - return "ManipulatorJointForce/TorqueSensor"; - case JAUS_MANIPULATOR_JOINT_POSITIONS_DRIVER: - return "ManipulatorJointPositionsDriver"; - case JAUS_MANIPULATOR_END_EFFECTOR_DRIVER: - return "ManipulatorEndEffectorDriver"; - case JAUS_MANIPULATOR_JOINT_VELOCITIES_DRIVER: - return "ManipulatorJointVelocitiesDriver"; - case JAUS_MANIPULATOR_END_EFFECTOR_VELOCITY_STATE_DRIVER: - return "ManipulatorEndEffectorVelocityStateDriver"; - case JAUS_MANIPULATOR_JOINT_MOVE_DRIVER: - return "ManipulatorJointMoveDriver"; - case JAUS_MANIPULATOR_END_EFFECTOR_DISCRETE_POSE_DRIVER: - return "ManipulatorEndEffectorDiscretePoseDriver"; - case JAUS_VISUAL_SENSOR: - return "VisualSensor"; - case JAUS_RANGE_SENSOR: - return "RangeSensor"; - default: - return "Experimental/UnknownComponent"; - } -} - -// Updates the input JausComponent's timestamp to the current time in seconds -void jausComponentUpdateTimestamp(JausComponent component) -{ - time(&component->timeStampSec); -} - -JausBoolean jausComponentHasIdentification(JausComponent cmpt) -{ - if(cmpt && cmpt->identification) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean jausComponentHasServices(JausComponent cmpt) -{ - if(cmpt && cmpt->services->elementCount > 0) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Test if the component has not been updated in COMPONENT_TIMEOUT_SEC seconds -JausBoolean jausComponentIsTimedOut(JausComponent component) -{ - time_t now; - time(&now); - - return difftime(now, component->timeStampSec) > COMPONENT_TIMEOUT_SEC? JAUS_TRUE : JAUS_FALSE; -} - -int jausComponentToString(JausComponent component, char *buf) -{ - if(component->identification) - { - return sprintf(buf, "%s (%s)-%d.%d", component->identification, - jausComponentGetTypeString(component), - component->address->component, - component->address->instance); - } - else - { - return sprintf(buf, "%s-%d.%d", jausComponentGetTypeString(component), - component->address->component, - component->address->instance); - } -} diff --git a/lib/openjaus/libjaus/src/jausNode.c b/lib/openjaus/libjaus/src/jausNode.c deleted file mode 100644 index dcea8501224c9bc2d28a303bbaf1666a2108afe0..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/jausNode.c +++ /dev/null @@ -1,173 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausNode.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#include -#include -#include -#include -#include "jaus.h" - -JausNode jausNodeCreate(void) -{ - JausNode node; - - node = (JausNode)malloc( sizeof(JausNodeStruct) ); - if(node == NULL) - { - return NULL; - } - - //Init Values - node->identification = NULL; - node->id = 0; - node->components = jausArrayCreate(); - node->subsystem = NULL; - - jausNodeUpdateTimestamp(node); - - return node; -} - -void jausNodeDestroy(JausNode node) -{ - jausArrayDestroy(node->components, (void *)jausComponentDestroy); - if(node->identification) free(node->identification); - free(node); -} - -JausNode jausNodeClone(JausNode node) -{ - JausNode clone; - JausComponent tempCmpt; - int i; - size_t stringLength; - - clone = (JausNode)malloc( sizeof(JausNodeStruct) ); - if(clone == NULL) - { - return NULL; - } - - //Init Values - if(node->identification) - { - stringLength = strlen(node->identification) + 1; - clone->identification = (char *) malloc(stringLength); - sprintf(clone->identification, "%s", node->identification); - } - else - { - clone->identification = NULL; - } - - clone->id = node->id; - clone->components = jausArrayCreate(); - for( i = 0; i < node->components->elementCount; i++) - { - tempCmpt = jausComponentClone(node->components->elementData[i]); - jausArrayAdd(clone->components, tempCmpt); - } - - clone->subsystem = node->subsystem; - - jausNodeUpdateTimestamp(clone); - - return clone; -} - -JausBoolean jausNodeFreeMemory(JausNode node) -{ - if(node->components == NULL) return JAUS_FALSE; - - free(node->components); - return JAUS_TRUE; -} - -void jausNodeUpdateTimestamp(JausNode node) -{ - time(&node->timeStampSec); -} - -JausBoolean jausNodeIsTimedOut(JausNode node) -{ - time_t now; - time(&now); - - return difftime(now, node->timeStampSec) > NODE_TIMEOUT_SEC? JAUS_TRUE : JAUS_FALSE; -} - -int jausNodeToString(JausNode node, char *buf) -{ - if(node->identification) - { - return sprintf(buf, "%s-%d", node->identification, node->id); - } - else - { - return sprintf(buf, "JausNode-%d", node->id); - } -} - -JausBoolean jausNodeHasIdentification(JausNode node) -{ - if(node && node->identification) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean jausNodeHasConfiguration(JausNode node) -{ - if(node && node->components->elementCount > 0) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} diff --git a/lib/openjaus/libjaus/src/jausPayloadInterface.c b/lib/openjaus/libjaus/src/jausPayloadInterface.c deleted file mode 100644 index 59cdd2c070dddd70df329446d8ccc09b4d066403..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/jausPayloadInterface.c +++ /dev/null @@ -1,2217 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausPayloadInterface.c -// -// Written By: Bob Touchton -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file provides the general support functionality ReportPayloadInterfacesMessage -// NOTE WELL: this message will also be used for general purpose information exchange - -#include -#include -#include "jaus.h" - -#define CORE_MESSAGE_SUPPORT 0 -#define NO_PRESENCE_VECTOR 0 - -//********************************************************// -// Report PayloadInterfaces Support -//********************************************************// - -// Command Interface Constructor -JausCommandInterface jausCommandInterfaceCreate(void) -{ - JausCommandInterface commandInterface; - - commandInterface = (JausCommandInterface) malloc(sizeof(JausCommandInterfaceStruct)); - if(commandInterface) - { - commandInterface->commandIdentifier = NULL; // null-terminated string - commandInterface->typeCode = 0; // per TYPE CODE table - commandInterface->units = 0; // per UNITS table - commandInterface->blockingFlag = 0; // bit-0 = 0 for non-blocking, 1 for non-blocking - commandInterface->minValue.longValue = 0; // minimum acceptable value - commandInterface->defaultValue.longValue = 0; // default value - commandInterface->maxValue.longValue = 0; // maximum acceptable value - commandInterface->enumerationLength = NO_ENUM; // length of NO_ENUM (=0) means no enumeration - commandInterface->enumeration = NULL; // enumeration content, comma delimited, NULL terminated - commandInterface->hmiRecommendation = 0; // per HMI table - commandInterface->hmiRecommendedPositionXPixels = 0; - commandInterface->hmiRecommendedPositionYPixels = 0; - commandInterface->hmiRecommendedPositionWidthPixels = 0; - commandInterface->hmiRecommendedPositionHeightPixels = 0; - commandInterface->currentValue.longValue = 0; - return commandInterface; - } - else - { - return NULL; - } -} - -// Information Interface Constructor -JausInformationInterface jausInformationInterfaceCreate(void) -{ - JausInformationInterface informationInterface; - - informationInterface = (JausInformationInterface) malloc(sizeof(JausInformationInterfaceStruct)); - if(informationInterface) - { - informationInterface->informationIdentifier = NULL; // null-terminated string - informationInterface->commandInterfaceAssociation = 0; // index number of the assoc. command interface, 0 if none - informationInterface->typeCode = 0; // per TYPE CODE table - informationInterface->units = 0; // per UNITS table - informationInterface->minValue.longValue = 0; // minimum acceptable value - informationInterface->defaultValue.longValue = 0; // default value - informationInterface->maxValue.longValue = 0; // maximum acceptable value - informationInterface->enumerationLength = NO_ENUM; // length of NO_ENUM (=0) means no enumeration - informationInterface->enumeration = NULL; // enumeration content, comma delimited, NULL terminated - informationInterface->hmiRecommendation = 0; // per HMI table - informationInterface->hmiRecommendedPositionXPixels = 0; - informationInterface->hmiRecommendedPositionYPixels = 0; - informationInterface->hmiRecommendedPositionWidthPixels = 0; - informationInterface->hmiRecommendedPositionHeightPixels = 0; - informationInterface->currentValue.longValue = 0; - return informationInterface; - } - else - { - return NULL; - } -} - -// Command Interface Destructor -void jausCommandInterfaceDestroy(JausCommandInterface commandInterface) -{ - if(commandInterface) - { - free(commandInterface); - commandInterface = NULL; - } -} - -// Information Interface Destructor -void jausInformationInterfaceDestroy(JausInformationInterface informationInterface) -{ - if(informationInterface) - { - free(informationInterface); - informationInterface = NULL; - } -} - -JausCommandInterface jausCommandInterfaceRetrieve(JausPayloadInterface payloadInterface, char* identifier) -{ - JausCommandInterface commandInterface; - int i = 0; - - // Loop through all services - for(i = 0; i < payloadInterface->jausCommandInterfaces->elementCount; i++) - { - commandInterface = (JausCommandInterface) payloadInterface->jausCommandInterfaces->elementData[i]; - if(!strcmp(commandInterface->commandIdentifier, identifier)) - { - return commandInterface; - } - } - return NULL; -} - -JausInformationInterface jausInformationInterfaceRetrieve(JausPayloadInterface payloadInterface, char* identifier) -{ - JausInformationInterface informationInterface; - int i = 0; - - // Loop through all services - for(i = 0; i < payloadInterface->jausInformationInterfaces->elementCount; i++) - { - informationInterface = (JausInformationInterface)payloadInterface->jausInformationInterfaces->elementData[i]; - if(!strcmp(informationInterface->informationIdentifier, identifier)) - { - return informationInterface; - } - } - return NULL; -} - -// ************************************************************************************************************************************ -// Report PayloadInterfaces End User Functions -// ************************************************************************************************************************************ - -// jausPayloadInterface Constructor -JausPayloadInterface jausPayloadInterfaceCreate(void) -{ - JausPayloadInterface payloadInterface; - - payloadInterface = (JausPayloadInterface) malloc(sizeof(JausPayloadInterfaceStruct)); - if(payloadInterface) - { - payloadInterface->presenceVector = NO_HMI; // defaults to no HMI elements in PV - payloadInterface->jausCommandInterfaces = jausArrayCreate(); // Dynamic Array of Input Commands - payloadInterface->jausInformationInterfaces = jausArrayCreate(); // Dynamic Array of Output Commands - return payloadInterface; - } - else - { - return NULL; - } -} - -// jausPayloadInterface Destructor -void jausPayloadInterfaceDestroy(JausPayloadInterface payloadInterface) -{ - if(payloadInterface) - { - jausArrayDestroy(payloadInterface->jausCommandInterfaces, (void *)jausCommandInterfaceDestroy); - jausArrayDestroy(payloadInterface->jausInformationInterfaces, (void *)jausInformationInterfaceDestroy); - free(payloadInterface); - payloadInterface = NULL; - } -} - -JausCommandInterface jausAddNewCommandInterface(JausPayloadInterface payloadInterface, char* identifier, JausByte typeCode) -{ - JausCommandInterface commandInterface; - - if(jausCommandInterfaceRetrieve(payloadInterface, identifier) ) - { - ////cError("%s:%d: command interface %s already exists\n", __FILE__, __LINE__, identifier); - return NULL; - } - - if( (commandInterface = jausCommandInterfaceCreate() ) ) - { - commandInterface->commandIdentifier = identifier; // null-terminated string - commandInterface->typeCode = typeCode; // per TYPE CODE table - jausArrayAdd(payloadInterface->jausCommandInterfaces, commandInterface); - return commandInterface; - } - else - { - ////cError("%s:%d: could not create command interface named %s\n", __FILE__, __LINE__, identifier); - return NULL; - } -} - -JausInformationInterface jausAddNewInformationInterface(JausPayloadInterface payloadInterface, char* identifier, JausByte typeCode) -{ - JausInformationInterface informationInterface; - - if(jausInformationInterfaceRetrieve(payloadInterface, identifier) ) - { - ////cError("%s:%d: information interface %s already exists\n", __FILE__, __LINE__, identifier); - return NULL; - } - - if( (informationInterface = jausInformationInterfaceCreate() ) ) - { - informationInterface->informationIdentifier = identifier; // null-terminated string - informationInterface->typeCode = typeCode; // per TYPE CODE table - jausArrayAdd(payloadInterface->jausInformationInterfaces, informationInterface); - return informationInterface; - } - else - { - ////cError("%s:%d: could not create information interface named %s\n", __FILE__, __LINE__, identifier); - return NULL; - } -} - -// NOTE: this function assumes end user is starting their index at 1, iaw the numbering scheme in the JAUS OPC ICD -char* jausGetCommandInterfaceIdentifierByIndex(JausPayloadInterface payloadInterface, int index, int* successFlag) -{ - JausCommandInterface commandInterface; - - if(payloadInterface->jausCommandInterfaces->elementCount >= index) - { - commandInterface = payloadInterface->jausCommandInterfaces->elementData[index - 1]; - return commandInterface->commandIdentifier; - } - else - { - ////cError("%s:%d: could not find a command interface with an index of %d\n", __FILE__, __LINE__, index); - if(*successFlag) *successFlag = FAILURE; - return "0"; - } -} - -// NOTE: this function assumes end user is starting their index at 1, iaw the numbering scheme in the JAUS OPC ICD -char* jausGetInformationInterfaceIdentifierByIndex(JausPayloadInterface payloadInterface, int index, int* successFlag) -{ - JausInformationInterface informationInterface; - - if(payloadInterface->jausInformationInterfaces->elementCount >= index) - { - informationInterface = (JausInformationInterface) payloadInterface->jausInformationInterfaces->elementData[index - 1]; - return informationInterface->informationIdentifier; - } - else - { - ////cError("%s:%d: could not find an information interface with an index of %d\n", __FILE__, __LINE__, index); - if(*successFlag) *successFlag = FAILURE; - return "0"; - } -} - -JausByte jausGetCommandInterfaceTypeCode(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return commandInterface->typeCode; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausByte jausGetInformationInterfaceTypeCode(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return informationInterface->typeCode; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausBoolean jausSetCommandInterfaceUnits(JausPayloadInterface payloadInterface, char* identifier, JausByte units) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - commandInterface->units = units; - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -JausByte jausGetCommandInterfaceUnits(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return commandInterface->units; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausBoolean jausSetCommandInterfaceBlockingFlag(JausPayloadInterface payloadInterface, char* identifier) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - commandInterface->blockingFlag = commandInterface->blockingFlag | 0x01; - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -JausBoolean jausClearCommandInterfaceBlockingFlag(JausPayloadInterface payloadInterface, char* identifier) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - commandInterface->blockingFlag = commandInterface->blockingFlag & 0xFE; - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -// returns True if blocking flag is set to "blocking", else returns false -JausBoolean jausGetCommandInterfaceBlockingFlag(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - if(commandInterface->blockingFlag & 0x01) return JAUS_TRUE; - else return JAUS_FALSE; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return JAUS_FALSE; - } -} - -JausBoolean jausSetCommandInterfaceMinMax(JausPayloadInterface payloadInterface, char* identifier, JausTypeCode minValue, JausTypeCode maxValue) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - commandInterface->minValue = minValue; - commandInterface->maxValue = maxValue; - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -JausTypeCode jausGetCommandInterfaceMin(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausTypeCode failCode = {0}; - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return commandInterface->minValue; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return failCode; - } -} - -JausTypeCode jausGetCommandInterfaceMax(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausTypeCode failCode = {0}; - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return commandInterface->maxValue; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return failCode; - } -} - -JausBoolean jausSetCommandInterfaceDefault(JausPayloadInterface payloadInterface, char* identifier, JausTypeCode defaultValue) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - commandInterface->defaultValue = defaultValue; - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -JausTypeCode jausGetCommandInterfaceDefault(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausTypeCode failCode = {0}; - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return commandInterface->defaultValue; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return failCode; - } -} - -JausBoolean jausSetCommandInterfaceEnumeration(JausPayloadInterface payloadInterface, char* identifier, char* enumeration) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - commandInterface->enumeration = enumeration; // no validation on enum formatting - commandInterface->enumerationLength = (int)strlen(enumeration) + 1; // include the NULL character - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -char* jausGetCommandInterfaceEnumeration(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return commandInterface->enumeration; // no validation on enum formatting - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return "0"; - } -} - -JausUnsignedShort jausGetCommandInterfaceEnumerationLength(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return commandInterface->enumerationLength; // includes the NULL character - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausBoolean jausSetCommandInterfaceHmiRecommendation(JausPayloadInterface payloadInterface, char* identifier, JausByte hmiRecommendation) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - commandInterface->hmiRecommendation = hmiRecommendation; - jausByteSetBit(&payloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_RECOMMENDATION_BIT);//update PV - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -JausByte jausGetCommandInterfaceHmiRecommendation(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return commandInterface->hmiRecommendation; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -// NOTE: recommended HMI positioning must be set as a group -JausBoolean jausSetCommandInterfaceHmiParameters(JausPayloadInterface payloadInterface, char* identifier, JausUnsignedShort xPixels, JausUnsignedShort yPixels, JausUnsignedShort widthPixels, JausUnsignedShort heightPixels) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - commandInterface->hmiRecommendedPositionXPixels = xPixels; - commandInterface->hmiRecommendedPositionYPixels = yPixels; - commandInterface->hmiRecommendedPositionWidthPixels = widthPixels; - commandInterface->hmiRecommendedPositionHeightPixels = heightPixels; - //update PV - jausByteSetBit(&payloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_XPOS_BIT); - jausByteSetBit(&payloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_YPOS_BIT); - jausByteSetBit(&payloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_WIDTH_BIT); - jausByteSetBit(&payloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_HEIGHT_BIT); - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -JausUnsignedShort jausGetCommandInterfaceHmiXPositionPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return commandInterface->hmiRecommendedPositionXPixels; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausUnsignedShort jausGetCommandInterfaceHmiYPositionPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return commandInterface->hmiRecommendedPositionYPixels; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausUnsignedShort jausGetCommandInterfaceHmiWidthPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return commandInterface->hmiRecommendedPositionWidthPixels; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausUnsignedShort jausGetCommandInterfaceHmiHeightPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausCommandInterface commandInterface; - - if( (commandInterface = jausCommandInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return commandInterface->hmiRecommendedPositionHeightPixels; - } - else - { - ////cError("%s:%d: could not find command interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausBoolean jausSetInformationInterfaceUnits(JausPayloadInterface payloadInterface, char* identifier, JausByte units) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - informationInterface->units = units; - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -JausByte jausGetInformationInterfaceUnits(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return informationInterface->units; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausBoolean jausSetInformationInterfaceCommandInterfaceAssoc(JausPayloadInterface payloadInterface, char* identifier, JausByte commandInterfaceAssociation) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - informationInterface->commandInterfaceAssociation = commandInterfaceAssociation; // no validation - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -JausByte jausGetInformationInterfaceCommandInterfaceAssoc(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return informationInterface->commandInterfaceAssociation; // no validation - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausBoolean jausSetInformationInterfaceMinMax(JausPayloadInterface payloadInterface, char* identifier, JausTypeCode minValue, JausTypeCode maxValue) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - informationInterface->minValue = minValue; - informationInterface->maxValue = maxValue; - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -JausTypeCode jausGetInformationInterfaceMin(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausTypeCode failCode = {0}; - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return informationInterface->minValue; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return failCode; - } -} - -JausTypeCode jausGetInformationInterfaceMax(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausTypeCode failCode = {0}; - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return informationInterface->maxValue; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return failCode; - } -} - -JausBoolean jausSetInformationInterfaceDefault(JausPayloadInterface payloadInterface, char* identifier, JausTypeCode defaultValue) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - informationInterface->defaultValue = defaultValue; - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -JausTypeCode jausGetInformationInterfaceDefault(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausTypeCode failCode = {0}; - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return informationInterface->defaultValue; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return failCode; - } -} - -JausBoolean jausSetInformationInterfaceEnumeration(JausPayloadInterface payloadInterface, char* identifier, char* enumeration) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - informationInterface->enumeration = enumeration; // no validation on enum formatting - informationInterface->enumerationLength = (int)strlen(enumeration) + 1; // include the NULL character - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -char* jausGetInformationInterfaceEnumeration(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return informationInterface->enumeration; // no validation on enum formatting - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return "0"; - } -} - -JausUnsignedShort jausGetInformationInterfaceEnumerationLength(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return informationInterface->enumerationLength; // includes the NULL character - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausBoolean jausSetInformationInterfaceHmiRecommendation(JausPayloadInterface payloadInterface, char* identifier, JausByte hmiRecommendation) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - informationInterface->hmiRecommendation = hmiRecommendation; - jausByteSetBit(&payloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_RECOMMENDATION_BIT);//update PV - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -JausByte jausGetInformationInterfaceHmiRecommendation(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return informationInterface->hmiRecommendation; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -// NOTE: recommended HMI positioning must be set as a group -JausBoolean jausSetInformationInterfaceHmiParameters(JausPayloadInterface payloadInterface, char* identifier, JausUnsignedShort xPixels, JausUnsignedShort yPixels, JausUnsignedShort widthPixels, JausUnsignedShort heightPixels) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - informationInterface->hmiRecommendedPositionXPixels = xPixels; - informationInterface->hmiRecommendedPositionYPixels = yPixels; - informationInterface->hmiRecommendedPositionWidthPixels = widthPixels; - informationInterface->hmiRecommendedPositionHeightPixels = heightPixels; - //update PV - jausByteSetBit(&payloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_XPOS_BIT); - jausByteSetBit(&payloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_YPOS_BIT); - jausByteSetBit(&payloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_WIDTH_BIT); - jausByteSetBit(&payloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_HEIGHT_BIT); - return JAUS_TRUE; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - return JAUS_FALSE; - } -} - -JausUnsignedShort jausGetInformationInterfaceHmiXPositionPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return informationInterface->hmiRecommendedPositionXPixels; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausUnsignedShort jausGetInformationInterfaceHmiYPositionPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return informationInterface->hmiRecommendedPositionYPixels; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausUnsignedShort jausGetInformationInterfaceHmiWidthPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return informationInterface->hmiRecommendedPositionWidthPixels; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -JausUnsignedShort jausGetInformationInterfaceHmiHeightPixels(JausPayloadInterface payloadInterface, char* identifier, int* successFlag) -{ - JausInformationInterface informationInterface; - - if( (informationInterface = jausInformationInterfaceRetrieve(payloadInterface, identifier) ) ) - { - return informationInterface->hmiRecommendedPositionHeightPixels; - } - else - { - ////cError("%s:%d: could not find information interface named %s\n", __FILE__, __LINE__, identifier); - if(*successFlag) *successFlag = FAILURE; - return 0; - } -} - -// decodes the Type Code value and returns the number of bytes required for Min, Max, and Default fields -int jausMinMaxDefaultSizeBytes(JausByte typeCodeEnum) -{ - switch((int) typeCodeEnum) - { - case TYPE_CODE_SHORT: - return JAUS_SHORT_SIZE_BYTES; - break; - - case TYPE_CODE_INTEGER: - return JAUS_INTEGER_SIZE_BYTES; - break; - - case TYPE_CODE_LONG: - return JAUS_LONG_SIZE_BYTES; - break; - - case TYPE_CODE_BYTE: - return JAUS_BYTE_SIZE_BYTES; - break; - - case TYPE_CODE_U_SHORT: - return JAUS_UNSIGNED_SHORT_SIZE_BYTES; - break; - - case TYPE_CODE_U_INTEGER: - return JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - break; - - case TYPE_CODE_U_LONG: - return JAUS_UNSIGNED_LONG_SIZE_BYTES; - break; - - case TYPE_CODE_FLOAT: - return JAUS_FLOAT_SIZE_BYTES; - break; - - case TYPE_CODE_DOUBLE: - return JAUS_DOUBLE_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_U_BYTE: // min, max, defaut uses float for scaled fields - return JAUS_FLOAT_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_SHORT: // min, max, defaut uses float for scaled fields - return JAUS_FLOAT_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_U_SHORT: // min, max, defaut uses float for scaled fields - return JAUS_FLOAT_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_INTEGER: // min, max, defaut uses float for scaled fields - return JAUS_FLOAT_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_U_INTEGER: // min, max, defaut uses float for scaled fields - return JAUS_FLOAT_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_LONG: // min, max, defaut uses float for scaled fields - return JAUS_FLOAT_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_U_LONG: // min, max, defaut uses float for scaled fields - return JAUS_FLOAT_SIZE_BYTES; - break; - - case TYPE_CODE_ENUM: - return JAUS_BYTE_SIZE_BYTES; - break; - - case TYPE_CODE_BOOLEAN: - return JAUS_BYTE_SIZE_BYTES;// booleans are treated as a byte - break; - - case TYPE_CODE_STRING: // min, max, default uses a byte for a string field - return JAUS_BYTE_SIZE_BYTES; - break; - - case TYPE_CODE_U_BYTE_TUPLE: - return 2 * JAUS_BYTE_SIZE_BYTES; - break; - - case TYPE_CODE_U_SHORT_TUPLE: - return 2 * JAUS_UNSIGNED_SHORT_SIZE_BYTES; - break; - - case TYPE_CODE_U_INTEGER_TUPLE: - return 2 * JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - break; - - default: - return 0; - break; - } -} - -// determines how to pack fields that have a JausTypeCode data type -int jausMinMaxDefaultToBuffer(JausTypeCode field, unsigned char* buffer, unsigned int bufferSizeBytes, JausByte typeCodeEnum) -{ - switch((int) typeCodeEnum) - { - case TYPE_CODE_SHORT: - if(jausShortToBuffer(field.shortValue, buffer, bufferSizeBytes) ) return JAUS_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_INTEGER: - if(jausIntegerToBuffer(field.integerValue, buffer, bufferSizeBytes) ) return JAUS_INTEGER_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_LONG: - if(jausLongToBuffer(field.longValue, buffer, bufferSizeBytes) ) return JAUS_LONG_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_BYTE: - if(jausByteToBuffer(field.byteValue, buffer, bufferSizeBytes) ) return JAUS_BYTE_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_SHORT: - if(jausUnsignedShortToBuffer(field.uShortValue, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_INTEGER: - if(jausUnsignedIntegerToBuffer(field.uIntegerValue, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_LONG: - if(jausUnsignedLongToBuffer(field.uLongValue, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_LONG_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_FLOAT: - if(jausFloatToBuffer(field.floatValue, buffer, bufferSizeBytes) ) return JAUS_FLOAT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_DOUBLE: - if(jausDoubleToBuffer(field.longFloatValue, buffer, bufferSizeBytes) ) return JAUS_DOUBLE_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_U_BYTE: // min, max, defaut uses float for scaled fields - if(jausFloatToBuffer(field.floatValue, buffer, bufferSizeBytes) ) return JAUS_FLOAT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_SHORT: // min, max, defaut uses float for scaled fields - if(jausFloatToBuffer(field.floatValue, buffer, bufferSizeBytes) ) return JAUS_FLOAT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_U_SHORT: // min, max, defaut uses float for scaled fields - if(jausFloatToBuffer(field.floatValue, buffer, bufferSizeBytes) ) return JAUS_FLOAT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_INTEGER: // min, max, defaut uses float for scaled fields - if(jausFloatToBuffer(field.floatValue, buffer, bufferSizeBytes) ) return JAUS_FLOAT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_U_INTEGER: // min, max, defaut uses float for scaled fields - if(jausFloatToBuffer(field.floatValue, buffer, bufferSizeBytes) ) return JAUS_FLOAT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_LONG: // min, max, defaut uses float for scaled fields - if(jausFloatToBuffer(field.floatValue, buffer, bufferSizeBytes) ) return JAUS_FLOAT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_U_LONG: // min, max, defaut uses float for scaled fields - if(jausFloatToBuffer(field.floatValue, buffer, bufferSizeBytes) ) return JAUS_FLOAT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_ENUM: - if(jausUnsignedShortToBuffer(field.uShortValue, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_BOOLEAN: - if(jausByteToBuffer(field.booleanValue, buffer, bufferSizeBytes) ) return JAUS_BYTE_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_STRING: // min, max, default uses a byte for a string field - if(jausByteToBuffer(field.byteValue, buffer, bufferSizeBytes) ) return JAUS_BYTE_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_BYTE_TUPLE: - if(!jausByteToBuffer(field.byteTuple.one, buffer, bufferSizeBytes)) return 0; - buffer += JAUS_BYTE_SIZE_BYTES; - if(jausByteToBuffer(field.byteTuple.two, buffer, bufferSizeBytes) ) return 2 * JAUS_BYTE_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_SHORT_TUPLE: - if(!jausUnsignedShortToBuffer(field.shortTuple.one, buffer, bufferSizeBytes)) return 0; - buffer += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - if(jausUnsignedShortToBuffer(field.shortTuple.two, buffer, bufferSizeBytes) ) return 2 * JAUS_UNSIGNED_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_INTEGER_TUPLE: - if(!jausUnsignedIntegerToBuffer(field.integerTuple.one, buffer, bufferSizeBytes)) return 0; - buffer += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - if(jausUnsignedIntegerToBuffer(field.integerTuple.two, buffer, bufferSizeBytes) ) return 2 * JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - else return 0; - break; - - default: - return 0; - break; - } - -} - -// determines how to unpack fields that have a JausTypeCode data type -JausBoolean jausMinMaxDefaultFromBuffer(JausTypeCode *field, unsigned char* buffer, unsigned int bufferSizeBytes, JausByte typeCodeEnum) -{ - JausByte tempByte; - switch((int) typeCodeEnum) - { - case TYPE_CODE_SHORT: - if(jausShortFromBuffer(&field->shortValue, buffer, bufferSizeBytes) ) - { - - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_INTEGER: - if(jausIntegerFromBuffer(&field->integerValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_LONG: - if(jausLongFromBuffer(&field->longValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_BYTE: - if(jausByteFromBuffer(&field->byteValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_SHORT: - if(jausUnsignedShortFromBuffer(&field->uShortValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_INTEGER: - if(jausUnsignedIntegerFromBuffer(&field->uIntegerValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_LONG: - if(jausUnsignedLongFromBuffer(&field->uLongValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_FLOAT: - if(jausFloatFromBuffer(&field->floatValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_DOUBLE: - if(jausDoubleFromBuffer(&field->longFloatValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_U_BYTE: // min, max, defaut uses float for scaled fields - if(jausFloatFromBuffer(&field->floatValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_SHORT: // min, max, defaut uses float for scaled fields - if(jausFloatFromBuffer(&field->floatValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_U_SHORT: // min, max, defaut uses float for scaled fields - if(jausFloatFromBuffer(&field->floatValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_INTEGER: // min, max, defaut uses float for scaled fields - if(jausFloatFromBuffer(&field->floatValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_U_INTEGER: // min, max, defaut uses float for scaled fields - if(jausFloatFromBuffer(&field->floatValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_LONG: // min, max, defaut uses float for scaled fields - if(jausFloatFromBuffer(&field->floatValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_U_LONG: // min, max, defaut uses float for scaled fields - if(jausFloatFromBuffer(&field->floatValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_ENUM: - if(jausUnsignedShortFromBuffer(&field->uShortValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_BOOLEAN: - if(jausByteFromBuffer(&tempByte, buffer, bufferSizeBytes) ) - { - if(tempByte) - { - field->booleanValue = JAUS_TRUE; - } - else - { - field->booleanValue = JAUS_FALSE; - } - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_STRING: // min, max, default uses a byte for a string field - if(jausByteFromBuffer(&field->byteValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_BYTE_TUPLE: - if(!jausByteFromBuffer(&field->byteTuple.one, buffer, bufferSizeBytes)) return JAUS_FALSE; - buffer += JAUS_BYTE_SIZE_BYTES; - if(jausByteFromBuffer(&field->byteTuple.two, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_SHORT_TUPLE: - if(!jausUnsignedShortFromBuffer(&field->shortTuple.one, buffer, bufferSizeBytes)) return JAUS_FALSE; - buffer += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - if(jausUnsignedShortFromBuffer(&field->shortTuple.two, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_INTEGER_TUPLE: - if(!jausUnsignedIntegerFromBuffer(&field->integerTuple.one, buffer, bufferSizeBytes)) return JAUS_FALSE; - buffer += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - if(jausUnsignedIntegerFromBuffer(&field->integerTuple.two, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - default: - return JAUS_FALSE; - break; - } - -} - -// determines how to pack current value field based on JausTypeCode; returns bytes packed -int jausInformationValueToBuffer(JausInformationInterface informationInterface, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - JausByte tempByte; - JausUnsignedShort tempUShort; - JausShort tempShort; - JausUnsignedInteger tempUInt; - JausInteger tempInt; - JausUnsignedLong tempULong; - JausLong tempLong; - switch((int) informationInterface->typeCode) - { - case TYPE_CODE_SHORT: - if(jausShortToBuffer(informationInterface->currentValue.shortValue, buffer, bufferSizeBytes) ) return JAUS_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_INTEGER: - if(jausIntegerToBuffer(informationInterface->currentValue.integerValue, buffer, bufferSizeBytes) ) return JAUS_INTEGER_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_LONG: - if(jausLongToBuffer(informationInterface->currentValue.longValue, buffer, bufferSizeBytes) ) return JAUS_LONG_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_BYTE: - if(jausByteToBuffer(informationInterface->currentValue.byteValue, buffer, bufferSizeBytes) ) return JAUS_BYTE_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_SHORT: - if(jausUnsignedShortToBuffer(informationInterface->currentValue.uShortValue, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_INTEGER: - if(jausUnsignedIntegerToBuffer(informationInterface->currentValue.uIntegerValue, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_LONG: - if(jausUnsignedLongToBuffer(informationInterface->currentValue.uLongValue, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_LONG_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_FLOAT: - if(jausFloatToBuffer(informationInterface->currentValue.floatValue, buffer, bufferSizeBytes) ) return JAUS_FLOAT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_DOUBLE: - if(jausDoubleToBuffer(informationInterface->currentValue.longFloatValue, buffer, bufferSizeBytes) ) return JAUS_DOUBLE_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_U_BYTE: - tempByte = jausByteFromDouble(informationInterface->currentValue.floatValue, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - if(jausByteToBuffer(tempByte, buffer, bufferSizeBytes) ) return JAUS_BYTE_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_SHORT: - tempShort = jausShortFromDouble(informationInterface->currentValue.floatValue, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - if(jausShortToBuffer(tempShort, buffer, bufferSizeBytes) ) return JAUS_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_U_SHORT: - tempUShort = jausUnsignedShortFromDouble(informationInterface->currentValue.floatValue, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - if(jausUnsignedShortToBuffer(tempUShort, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_INTEGER: - tempInt = jausIntegerFromDouble(informationInterface->currentValue.floatValue, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - if(jausIntegerToBuffer(tempInt, buffer, bufferSizeBytes) ) return JAUS_INTEGER_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_U_INTEGER: - tempUInt = jausUnsignedIntegerFromDouble(informationInterface->currentValue.floatValue, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - if(jausUnsignedIntegerToBuffer(tempUInt, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_LONG: - tempLong = jausLongFromDouble(informationInterface->currentValue.floatValue, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - if(jausLongToBuffer(tempLong, buffer, bufferSizeBytes) ) return JAUS_LONG_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_U_LONG: - tempULong = jausUnsignedIntegerFromDouble(informationInterface->currentValue.floatValue, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - if(jausUnsignedLongToBuffer(tempULong, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_LONG_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_ENUM: - if(jausUnsignedShortToBuffer(informationInterface->currentValue.uShortValue, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_BOOLEAN: - if(informationInterface->currentValue.booleanValue == JAUS_TRUE) - { - if(jausByteToBuffer(0x01, buffer, bufferSizeBytes) ) return JAUS_BYTE_SIZE_BYTES; - } - else if(jausByteToBuffer(0x00, buffer, bufferSizeBytes) ) - { - return JAUS_BYTE_SIZE_BYTES; - } - else return 0; - break; - - case TYPE_CODE_STRING: - if(jausUnsignedShortToBuffer(informationInterface->currentValue.string.length, buffer, bufferSizeBytes) ) - { - memcpy(buffer, informationInterface->currentValue.string.value, informationInterface->currentValue.string.length); - return JAUS_UNSIGNED_SHORT_SIZE_BYTES + informationInterface->currentValue.string.length; - } - else return 0; - break; - - case TYPE_CODE_U_BYTE_TUPLE: - if(!jausByteToBuffer(informationInterface->currentValue.byteTuple.one, buffer, bufferSizeBytes)) return 0; - buffer += JAUS_BYTE_SIZE_BYTES; - if(jausByteToBuffer(informationInterface->currentValue.byteTuple.two, buffer, bufferSizeBytes) ) return 2 * JAUS_BYTE_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_SHORT_TUPLE: - if(!jausUnsignedShortToBuffer(informationInterface->currentValue.shortTuple.one, buffer, bufferSizeBytes)) return 0; - buffer += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - if(jausUnsignedShortToBuffer(informationInterface->currentValue.shortTuple.two, buffer, bufferSizeBytes) ) return 2 * JAUS_UNSIGNED_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_INTEGER_TUPLE: - if(!jausUnsignedIntegerToBuffer(informationInterface->currentValue.integerTuple.one, buffer, bufferSizeBytes)) return 0; - buffer += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - if(jausUnsignedIntegerToBuffer(informationInterface->currentValue.integerTuple.two, buffer, bufferSizeBytes) ) return 2 * JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - else return 0; - break; - - default: - return 0; - break; - } - return 0; -} - -// determines how to pack current value field based on JausTypeCode; returns bytes packed -int jausCommandValueToBuffer(JausCommandInterface commandInterface, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - JausByte tempByte; - JausUnsignedShort tempUShort; - JausShort tempShort; - JausUnsignedInteger tempUInt; - JausInteger tempInt; - JausUnsignedLong tempULong; - JausLong tempLong; - switch((int) commandInterface->typeCode) - { - case TYPE_CODE_SHORT: - if(jausShortToBuffer(commandInterface->currentValue.shortValue, buffer, bufferSizeBytes) ) return JAUS_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_INTEGER: - if(jausIntegerToBuffer(commandInterface->currentValue.integerValue, buffer, bufferSizeBytes) ) return JAUS_INTEGER_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_LONG: - if(jausLongToBuffer(commandInterface->currentValue.longValue, buffer, bufferSizeBytes) ) return JAUS_LONG_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_BYTE: - if(jausByteToBuffer(commandInterface->currentValue.byteValue, buffer, bufferSizeBytes) ) return JAUS_BYTE_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_SHORT: - if(jausUnsignedShortToBuffer(commandInterface->currentValue.uShortValue, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_INTEGER: - if(jausUnsignedIntegerToBuffer(commandInterface->currentValue.uIntegerValue, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_LONG: - if(jausUnsignedLongToBuffer(commandInterface->currentValue.uLongValue, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_LONG_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_FLOAT: - if(jausFloatToBuffer(commandInterface->currentValue.floatValue, buffer, bufferSizeBytes) ) return JAUS_FLOAT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_DOUBLE: - if(jausDoubleToBuffer(commandInterface->currentValue.longFloatValue, buffer, bufferSizeBytes) ) return JAUS_DOUBLE_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_U_BYTE: - tempByte = jausByteFromDouble(commandInterface->currentValue.floatValue, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - if(jausByteToBuffer(tempByte, buffer, bufferSizeBytes) ) return JAUS_BYTE_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_SHORT: - tempShort = jausShortFromDouble(commandInterface->currentValue.floatValue, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - if(jausShortToBuffer(tempShort, buffer, bufferSizeBytes) ) return JAUS_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_U_SHORT: - tempUShort = jausUnsignedShortFromDouble(commandInterface->currentValue.floatValue, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - if(jausUnsignedShortToBuffer(tempUShort, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_INTEGER: - tempInt = jausIntegerFromDouble(commandInterface->currentValue.floatValue, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - if(jausIntegerToBuffer(tempInt, buffer, bufferSizeBytes) ) return JAUS_INTEGER_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_U_INTEGER: - tempUInt = jausUnsignedIntegerFromDouble(commandInterface->currentValue.floatValue, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - if(jausUnsignedIntegerToBuffer(tempUInt, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_LONG: - tempLong = jausLongFromDouble(commandInterface->currentValue.floatValue, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - if(jausLongToBuffer(tempLong, buffer, bufferSizeBytes) ) return JAUS_LONG_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_SCALED_U_LONG: - tempULong = jausUnsignedIntegerFromDouble(commandInterface->currentValue.floatValue, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - if(jausUnsignedLongToBuffer(tempULong, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_LONG_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_ENUM: - if(jausUnsignedShortToBuffer(commandInterface->currentValue.uShortValue, buffer, bufferSizeBytes) ) return JAUS_UNSIGNED_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_BOOLEAN: - if(commandInterface->currentValue.booleanValue == JAUS_TRUE) - { - if(jausByteToBuffer(0x01, buffer, bufferSizeBytes) ) return JAUS_BYTE_SIZE_BYTES; - } - else if(jausByteToBuffer(0x00, buffer, bufferSizeBytes) ) - { - return JAUS_BYTE_SIZE_BYTES; - } - else return 0; - break; - - case TYPE_CODE_STRING: - if(jausUnsignedShortToBuffer(commandInterface->currentValue.string.length, buffer, bufferSizeBytes) ) - { - memcpy(buffer, commandInterface->currentValue.string.value, commandInterface->currentValue.string.length); - return JAUS_UNSIGNED_SHORT_SIZE_BYTES + commandInterface->currentValue.string.length; - } - else return 0; - break; - - case TYPE_CODE_U_BYTE_TUPLE: - if(!jausByteToBuffer(commandInterface->currentValue.byteTuple.one, buffer, bufferSizeBytes)) return 0; - buffer += JAUS_BYTE_SIZE_BYTES; - if(jausByteToBuffer(commandInterface->currentValue.byteTuple.two, buffer, bufferSizeBytes) ) return 2 * JAUS_BYTE_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_SHORT_TUPLE: - if(!jausUnsignedShortToBuffer(commandInterface->currentValue.shortTuple.one, buffer, bufferSizeBytes)) return 0; - buffer += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - if(jausUnsignedShortToBuffer(commandInterface->currentValue.shortTuple.two, buffer, bufferSizeBytes) ) return 2 * JAUS_UNSIGNED_SHORT_SIZE_BYTES; - else return 0; - break; - - case TYPE_CODE_U_INTEGER_TUPLE: - if(!jausUnsignedIntegerToBuffer(commandInterface->currentValue.integerTuple.one, buffer, bufferSizeBytes)) return 0; - buffer += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - if(jausUnsignedIntegerToBuffer(commandInterface->currentValue.integerTuple.two, buffer, bufferSizeBytes) ) return 2 * JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - else return 0; - break; - - default: - return 0; - break; - } - return 0; -} - -// determines how to unpack current value field based on JausTypeCode -JausBoolean jausInformationValueFromBuffer(JausInformationInterface informationInterface, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - JausByte tempByte; - JausUnsignedShort tempUShort; - JausShort tempShort; - JausUnsignedInteger tempUInt; - JausInteger tempInt; - JausUnsignedLong tempULong; - JausLong tempLong; - switch((int) informationInterface->typeCode) - { - case TYPE_CODE_SHORT: - if(jausShortFromBuffer(&informationInterface->currentValue.shortValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_INTEGER: - if(jausIntegerFromBuffer(&informationInterface->currentValue.integerValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_LONG: - if(jausLongFromBuffer(&informationInterface->currentValue.longValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_BYTE: - if(jausByteFromBuffer(&informationInterface->currentValue.byteValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_SHORT: - if(jausUnsignedShortFromBuffer(&informationInterface->currentValue.uShortValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_INTEGER: - if(jausUnsignedIntegerFromBuffer(&informationInterface->currentValue.uIntegerValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_LONG: - if(jausUnsignedLongFromBuffer(&informationInterface->currentValue.uLongValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_FLOAT: - if(jausFloatFromBuffer(&informationInterface->currentValue.floatValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_DOUBLE: - if(jausDoubleFromBuffer(&informationInterface->currentValue.longFloatValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_U_BYTE: - if(jausByteFromBuffer(&tempByte, buffer, bufferSizeBytes) ) - { - informationInterface->currentValue.floatValue = (float) jausByteToDouble(tempByte, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_SHORT: - if(jausShortFromBuffer(&tempShort, buffer, bufferSizeBytes) ) - { - informationInterface->currentValue.floatValue = (float) jausShortToDouble(tempShort, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_U_SHORT: - if(jausUnsignedShortFromBuffer(&tempUShort, buffer, bufferSizeBytes) ) - { - informationInterface->currentValue.floatValue = (float) jausUnsignedShortToDouble(tempUShort, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_INTEGER: - if(jausIntegerFromBuffer(&tempInt, buffer, bufferSizeBytes) ) - { - informationInterface->currentValue.floatValue = (float) jausIntegerToDouble(tempInt, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_U_INTEGER: - if(jausUnsignedIntegerFromBuffer(&tempUInt, buffer, bufferSizeBytes) ) - { - informationInterface->currentValue.floatValue = (float) jausUnsignedIntegerToDouble(tempUInt, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_LONG: - if(jausLongFromBuffer(&tempLong, buffer, bufferSizeBytes) ) - { - informationInterface->currentValue.floatValue = (float) jausLongToDouble(tempLong, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_U_LONG: - if(jausUnsignedLongFromBuffer(&tempULong, buffer, bufferSizeBytes) ) - { - informationInterface->currentValue.floatValue = (float) jausUnsignedLongToDouble(tempULong, informationInterface->minValue.floatValue, informationInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_ENUM: - if(jausByteFromBuffer(&informationInterface->currentValue.enumValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_BOOLEAN: - if(jausByteFromBuffer(&tempByte, buffer, bufferSizeBytes) ) - { - if(tempByte) - { - informationInterface->currentValue.booleanValue = JAUS_TRUE; - } - else - { - informationInterface->currentValue.booleanValue = JAUS_FALSE; - } - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_STRING: - if(jausUnsignedShortFromBuffer(&informationInterface->currentValue.string.length, buffer, bufferSizeBytes) ) - { - if(informationInterface->currentValue.string.length) - { - memcpy(informationInterface->currentValue.string.value, buffer, informationInterface->currentValue.string.length); - return JAUS_TRUE; - } - else return JAUS_FALSE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_BYTE_TUPLE: - if(!jausByteFromBuffer(&informationInterface->currentValue.byteTuple.one, buffer, bufferSizeBytes)) return JAUS_FALSE; - buffer += JAUS_BYTE_SIZE_BYTES; - if(jausByteFromBuffer(&informationInterface->currentValue.byteTuple.two, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_SHORT_TUPLE: - if(!jausUnsignedShortFromBuffer(&informationInterface->currentValue.shortTuple.one, buffer, bufferSizeBytes)) return JAUS_FALSE; - buffer += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - if(jausUnsignedShortFromBuffer(&informationInterface->currentValue.shortTuple.two, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_INTEGER_TUPLE: - if(!jausUnsignedIntegerFromBuffer(&informationInterface->currentValue.integerTuple.one, buffer, bufferSizeBytes)) return JAUS_FALSE; - buffer += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - if(jausUnsignedIntegerFromBuffer(&informationInterface->currentValue.integerTuple.two, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - default: - return JAUS_FALSE; - break; - } - -} - -// determines how to unpack current value field based on JausTypeCode -JausBoolean jausCommandValueFromBuffer(JausCommandInterface commandInterface, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - JausByte tempByte; - JausUnsignedShort tempUShort; - JausShort tempShort; - JausUnsignedInteger tempUInt; - JausInteger tempInt; - JausUnsignedLong tempULong; - JausLong tempLong; - switch((int) commandInterface->typeCode) - { - case TYPE_CODE_SHORT: - if(jausShortFromBuffer(&commandInterface->currentValue.shortValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_INTEGER: - if(jausIntegerFromBuffer(&commandInterface->currentValue.integerValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_LONG: - if(jausLongFromBuffer(&commandInterface->currentValue.longValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_BYTE: - if(jausByteFromBuffer(&commandInterface->currentValue.byteValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_SHORT: - if(jausUnsignedShortFromBuffer(&commandInterface->currentValue.uShortValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_INTEGER: - if(jausUnsignedIntegerFromBuffer(&commandInterface->currentValue.uIntegerValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_LONG: - if(jausUnsignedLongFromBuffer(&commandInterface->currentValue.uLongValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_FLOAT: - if(jausFloatFromBuffer(&commandInterface->currentValue.floatValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_DOUBLE: - if(jausDoubleFromBuffer(&commandInterface->currentValue.longFloatValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_U_BYTE: - if(jausByteFromBuffer(&tempByte, buffer, bufferSizeBytes) ) - { - commandInterface->currentValue.floatValue = (float) jausByteToDouble(tempByte, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_SHORT: - if(jausShortFromBuffer(&tempShort, buffer, bufferSizeBytes) ) - { - commandInterface->currentValue.floatValue = (float) jausShortToDouble(tempShort, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_U_SHORT: - if(jausUnsignedShortFromBuffer(&tempUShort, buffer, bufferSizeBytes) ) - { - commandInterface->currentValue.floatValue = (float) jausUnsignedShortToDouble(tempUShort, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_INTEGER: - if(jausIntegerFromBuffer(&tempInt, buffer, bufferSizeBytes) ) - { - commandInterface->currentValue.floatValue = (float) jausIntegerToDouble(tempInt, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_U_INTEGER: - if(jausUnsignedIntegerFromBuffer(&tempUInt, buffer, bufferSizeBytes) ) - { - commandInterface->currentValue.floatValue = (float) jausUnsignedIntegerToDouble(tempUInt, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_LONG: - if(jausLongFromBuffer(&tempLong, buffer, bufferSizeBytes) ) - { - commandInterface->currentValue.floatValue = (float) jausLongToDouble(tempLong, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_SCALED_U_LONG: - if(jausUnsignedLongFromBuffer(&tempULong, buffer, bufferSizeBytes) ) - { - commandInterface->currentValue.floatValue = (float) jausUnsignedLongToDouble(tempULong, commandInterface->minValue.floatValue, commandInterface->maxValue.floatValue); - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_ENUM: - if(jausByteFromBuffer(&commandInterface->currentValue.enumValue, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_BOOLEAN: - if(jausByteFromBuffer(&tempByte, buffer, bufferSizeBytes) ) - { - if(tempByte) - { - commandInterface->currentValue.booleanValue = JAUS_TRUE; - } - else - { - commandInterface->currentValue.booleanValue = JAUS_FALSE; - } - return JAUS_TRUE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_STRING: - if(jausUnsignedShortFromBuffer(&commandInterface->currentValue.string.length, buffer, bufferSizeBytes) ) - { - if(commandInterface->currentValue.string.length) - { - memcpy(commandInterface->currentValue.string.value, buffer, commandInterface->currentValue.string.length); - return JAUS_TRUE; - } - else return JAUS_FALSE; - } - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_BYTE_TUPLE: - if(!jausByteFromBuffer(&commandInterface->currentValue.byteTuple.one, buffer, bufferSizeBytes)) return JAUS_FALSE; - buffer += JAUS_BYTE_SIZE_BYTES; - if(jausByteFromBuffer(&commandInterface->currentValue.byteTuple.two, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_SHORT_TUPLE: - if(!jausUnsignedShortFromBuffer(&commandInterface->currentValue.shortTuple.one, buffer, bufferSizeBytes)) return JAUS_FALSE; - buffer += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - if(jausUnsignedShortFromBuffer(&commandInterface->currentValue.shortTuple.two, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - case TYPE_CODE_U_INTEGER_TUPLE: - if(!jausUnsignedIntegerFromBuffer(&commandInterface->currentValue.integerTuple.one, buffer, bufferSizeBytes)) return JAUS_FALSE; - buffer += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - if(jausUnsignedIntegerFromBuffer(&commandInterface->currentValue.integerTuple.two, buffer, bufferSizeBytes) ) return JAUS_TRUE; - else return JAUS_FALSE; - break; - - default: - return JAUS_FALSE; - break; - } - -} - -// decodes the Type Code value and returns the number of bytes required for currentValue field -int jausInformationValueSizeBytes(JausInformationInterface informationInterface) -{ - switch((int) informationInterface->typeCode) - { - case TYPE_CODE_SHORT: - return JAUS_SHORT_SIZE_BYTES; - break; - - case TYPE_CODE_INTEGER: - return JAUS_INTEGER_SIZE_BYTES; - break; - - case TYPE_CODE_LONG: - return JAUS_LONG_SIZE_BYTES; - break; - - case TYPE_CODE_BYTE: - return JAUS_BYTE_SIZE_BYTES; - break; - - case TYPE_CODE_U_SHORT: - return JAUS_UNSIGNED_SHORT_SIZE_BYTES; - break; - - case TYPE_CODE_U_INTEGER: - return JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - break; - - case TYPE_CODE_U_LONG: - return JAUS_UNSIGNED_LONG_SIZE_BYTES; - break; - - case TYPE_CODE_FLOAT: - return JAUS_FLOAT_SIZE_BYTES; - break; - - case TYPE_CODE_DOUBLE: - return JAUS_DOUBLE_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_U_BYTE: - return JAUS_BYTE_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_SHORT: - return JAUS_SHORT_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_U_SHORT: - return JAUS_UNSIGNED_SHORT_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_INTEGER: - return JAUS_INTEGER_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_U_INTEGER: - return JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_LONG: - return JAUS_LONG_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_U_LONG: - return JAUS_UNSIGNED_LONG_SIZE_BYTES; - break; - - case TYPE_CODE_ENUM: - return JAUS_BYTE_SIZE_BYTES * 2; //enum is defined as 2 bytes - break; - - case TYPE_CODE_BOOLEAN: - return JAUS_BYTE_SIZE_BYTES;// booleans are treated as a byte - break; - - case TYPE_CODE_STRING: // strings use an unsigned short followed by a null terminated string - return JAUS_UNSIGNED_SHORT_SIZE_BYTES + informationInterface->currentValue.string.length; - break; - - case TYPE_CODE_U_BYTE_TUPLE: - return 2 * JAUS_BYTE_SIZE_BYTES; - break; - - case TYPE_CODE_U_SHORT_TUPLE: - return 2 * JAUS_UNSIGNED_SHORT_SIZE_BYTES; - break; - - case TYPE_CODE_U_INTEGER_TUPLE: - return 2 * JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - break; - - default: - return 0; - break; - } -} - -// decodes the Type Code value and returns the number of bytes required for currentValue field -int jausCommandValueSizeBytes(JausCommandInterface commandInterface) -{ - switch((int) commandInterface->typeCode) - { - case TYPE_CODE_SHORT: - return JAUS_SHORT_SIZE_BYTES; - break; - - case TYPE_CODE_INTEGER: - return JAUS_INTEGER_SIZE_BYTES; - break; - - case TYPE_CODE_LONG: - return JAUS_LONG_SIZE_BYTES; - break; - - case TYPE_CODE_BYTE: - return JAUS_BYTE_SIZE_BYTES; - break; - - case TYPE_CODE_U_SHORT: - return JAUS_UNSIGNED_SHORT_SIZE_BYTES; - break; - - case TYPE_CODE_U_INTEGER: - return JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - break; - - case TYPE_CODE_U_LONG: - return JAUS_UNSIGNED_LONG_SIZE_BYTES; - break; - - case TYPE_CODE_FLOAT: - return JAUS_FLOAT_SIZE_BYTES; - break; - - case TYPE_CODE_DOUBLE: - return JAUS_DOUBLE_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_U_BYTE: - return JAUS_BYTE_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_SHORT: - return JAUS_SHORT_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_U_SHORT: - return JAUS_UNSIGNED_SHORT_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_INTEGER: - return JAUS_INTEGER_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_U_INTEGER: - return JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_LONG: - return JAUS_LONG_SIZE_BYTES; - break; - - case TYPE_CODE_SCALED_U_LONG: - return JAUS_UNSIGNED_LONG_SIZE_BYTES; - break; - - case TYPE_CODE_ENUM: - return JAUS_BYTE_SIZE_BYTES * 2; //enum is defined as 2 bytes - break; - - case TYPE_CODE_BOOLEAN: - return JAUS_BYTE_SIZE_BYTES;// booleans are treated as a byte - break; - - case TYPE_CODE_STRING: // strings use an unsigned short followed by a null terminated string - return JAUS_UNSIGNED_SHORT_SIZE_BYTES + commandInterface->currentValue.string.length; - break; - - case TYPE_CODE_U_BYTE_TUPLE: - return 2 * JAUS_BYTE_SIZE_BYTES; - break; - - case TYPE_CODE_U_SHORT_TUPLE: - return 2 * JAUS_UNSIGNED_SHORT_SIZE_BYTES; - break; - - case TYPE_CODE_U_INTEGER_TUPLE: - return 2 * JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - break; - - default: - return 0; - break; - } -} - diff --git a/lib/openjaus/libjaus/src/jausService.c b/lib/openjaus/libjaus/src/jausService.c deleted file mode 100644 index d3c0f60232e5bd709037572edb177435cca6d6d6..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/jausService.c +++ /dev/null @@ -1,359 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausService.c -// -// Written By: Bob Touchton, inspired by Danny Kent -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file provides the general support functionality ReportServicesMessage - -#include -#include -#include "jaus.h" - -//********************************************************// -// Report Services Support -//********************************************************// - -// Services Vector Constructor -JausArray jausServicesCreate(void) -{ - JausArray jausServices; - jausServices = jausArrayCreate(); - if(jausServices) - { - return jausServices; - } - else - { - return NULL; - } -} - -// Services Vector Destructor -void jausServicesDestroy(JausArray jausServices) -{ - jausArrayDestroy(jausServices, (void *)jausServiceDestroy); -} - -JausArray jausServicesClone(JausArray sourceServices) -{ - JausArray destinationServices; - JausService sourceService, destinationService; - JausCommand sourceCommand; - int i = 0; - - destinationServices = jausArrayCreate(); - if(!destinationServices) return NULL; - - for(i = 0; i < sourceServices->elementCount; i++) - { - sourceService = (JausService) sourceServices->elementData[i]; - destinationService = jausServiceCreate(sourceService->type); - - jausServiceAddService(destinationServices, destinationService); - - // Duplicate Input Commands from sourceService to destinationService - sourceCommand = sourceService->inputCommandList; - while(sourceCommand) - { - if(!jausServiceAddInputCommand(destinationService, sourceCommand->commandCode, sourceCommand->presenceVector)) - { - jausServicesDestroy(destinationServices); - return NULL; - } - sourceCommand = sourceCommand->next; - } - - // Duplicate Output Commands from sourceService to destinationService - sourceCommand = sourceService->outputCommandList; - while(sourceCommand) - { - if(!jausServiceAddOutputCommand(destinationService, sourceCommand->commandCode, sourceCommand->presenceVector)) - { - jausServicesDestroy(destinationServices); - return NULL; - } - sourceCommand = sourceCommand->next; - } - } - - return destinationServices; -} - -// jausService Constructor -JausService jausServiceCreate(JausUnsignedShort type) -{ - JausService service; - service = (JausService) malloc(sizeof(struct JausServiceStruct)); - if(service) - { - service->type = type; // Service Type (default to Core Messages) - service->inputCommandList = NULL; // List of Input Commands - service->inputCommandCount = 0; - service->outputCommandList = NULL; // List of Output Commands - service->outputCommandCount = 0; - service->next = NULL; - - return service; - } - else - { - return NULL; - } -} - -// jausService Destructor -void jausServiceDestroy(JausService service) -{ - JausCommand tempCommand; - - if(service) - { - while(service->inputCommandList) - { - tempCommand = service->inputCommandList; - service->inputCommandList = tempCommand->next; - jausCommandDestroy(tempCommand); - }; - - while(service->outputCommandList) - { - tempCommand = service->outputCommandList; - service->outputCommandList = tempCommand->next; - jausCommandDestroy(tempCommand); - }; - - free(service); - service = NULL; - } -} - -// jausCommand Constructor -JausCommand jausCommandCreate(void) -{ - JausCommand command; - - command = (JausCommand) malloc(sizeof(struct JausCommandStruct)); - if(command) - { - command->commandCode = newJausUnsignedShort(0); // Command Code (default to zero) - command->presenceVector = newJausUnsignedInteger(JAUS_INTEGER_PRESENCE_VECTOR_ALL_ON); // Presence Vector - return command; - } - else - { - return NULL; - } -} - -// jausCommand Destructor -void jausCommandDestroy(JausCommand command) -{ - if(command) - { - free(command); - command = NULL; - } -} - -// ************************************************************************************************************************************ -// Report Services End User Functions -// ************************************************************************************************************************************ - -// Use this function to blast the default core services into the jausServices structure -// NOTE: This only adds those command codes that are explicitly coded into the core libraries and cmpt.c by default. -// Users will need to add any additional core messages that they handle, e.g.: -// service = jausServiceRetrieveService(jausServices, CORE_MESSAGE_SUPPORT); -// jausServiceAddInputCommand(service, JAUS_SOME_OTHER_CORE_MESSAGE, SOME_PRESENCE_VECTOR); - -JausBoolean jausServiceAddCoreServices(JausArray jausServices) -{ - JausService service; - - // create a new service for core message support - service = jausServiceCreate(CORE_MESSAGE_SUPPORT); - - // add each supported core input message - jausServiceAddInputCommand(service, JAUS_SET_COMPONENT_AUTHORITY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_SHUTDOWN, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_STANDBY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_RESUME, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_RESET, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_SET_EMERGENCY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CLEAR_EMERGENCY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CREATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CONFIRM_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_ACTIVATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_SUSPEND_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_TERMINATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_REQUEST_COMPONENT_CONTROL, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_RELEASE_COMPONENT_CONTROL, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CONFIRM_COMPONENT_CONTROL, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_REJECT_COMPONENT_CONTROL, NO_PRESENCE_VECTOR); -// jausServiceAddInputCommand(service, JAUS_SET_TIME, 0xFF); - jausServiceAddInputCommand(service, JAUS_QUERY_COMPONENT_AUTHORITY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_QUERY_COMPONENT_STATUS, NO_PRESENCE_VECTOR); -// jausServiceAddInputCommand(service, JAUS_QUERY_TIME, 0xFF); - jausServiceAddInputCommand(service, JAUS_REPORT_COMPONENT_AUTHORITY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_REPORT_COMPONENT_STATUS, NO_PRESENCE_VECTOR); -// jausServiceAddInputCommand(service, JAUS_REPORT_TIME, 0xFF); - jausServiceAddInputCommand(service, JAUS_QUERY_IDENTIFICATION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_REPORT_CONFIGURATION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_REPORT_SERVICES, NO_PRESENCE_VECTOR); - - // add each supported core output message - jausServiceAddOutputCommand(service, JAUS_CREATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_CONFIRM_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_TERMINATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_CONFIRM_COMPONENT_CONTROL, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REJECT_COMPONENT_CONTROL, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_COMPONENT_AUTHORITY, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_COMPONENT_STATUS, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_IDENTIFICATION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_QUERY_CONFIGURATION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_QUERY_SERVICES, NO_PRESENCE_VECTOR); - - // add the service to the component's services jausArray - if(jausServiceAddService(jausServices, service)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean jausServiceAddInputCommand(JausService service, JausUnsignedShort commandCode, JausUnsignedInteger presenceVector) -{ - JausCommand command; - JausCommand tempCommand; - - command = jausCommandCreate(); - if(command && service && service->inputCommandCount < JAUS_BYTE_MAX_VALUE) - { - command->commandCode = commandCode; - command->presenceVector = presenceVector; - command->next = NULL; - - if(service->inputCommandList) - { - tempCommand = service->inputCommandList; - while(tempCommand->next) - { - tempCommand = tempCommand->next; - } - tempCommand->next = command; - } - else - { - service->inputCommandList = command; - } - service->inputCommandCount++; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean jausServiceAddOutputCommand(JausService service, JausUnsignedShort commandCode, JausUnsignedInteger presenceVector) -{ - JausCommand command; - JausCommand tempCommand; - - command = jausCommandCreate(); - if(command && service && service->outputCommandCount < JAUS_BYTE_MAX_VALUE) - { - command->commandCode = commandCode; - command->presenceVector = presenceVector; - command->next = NULL; - - if(service->outputCommandList) - { - tempCommand = service->outputCommandList; - while(tempCommand->next) - { - tempCommand = tempCommand->next; - } - tempCommand->next = command; - } - else - { - service->outputCommandList = command; - } - service->outputCommandCount++; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean jausServiceAddService(JausArray jausServices, JausService service) -{ - if(jausServiceRetrieveService(jausServices, service->type) == NULL) - { - jausArrayAdd(jausServices, service); - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -JausService jausServiceRetrieveService(JausArray jausServices, JausUnsignedShort serviceType) -{ - // iterate thru jausServices until a match is found with serviceType. return matching service, else NULL - int i = 0; - JausService candidateService; - for(i = 0; i < jausServices->elementCount; i++) - { - candidateService = (JausService) jausServices->elementData[i]; - if(candidateService->type == serviceType) - { - return candidateService; - } - } - return NULL; -} diff --git a/lib/openjaus/libjaus/src/jausState.c b/lib/openjaus/libjaus/src/jausState.c deleted file mode 100644 index f2962cc301a3491289b374c487621241bbc473b7..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/jausState.c +++ /dev/null @@ -1,72 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausState.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#include -#include "jaus.h" - -int jausStateToString(JausState state, char *buf) -{ - return sprintf(buf, "%s", jausStateGetString(state)); -} - -char *jausStateGetString(JausState state) -{ - static char *jausStateString[7] = { "Initialize", - "Ready", - "Standby", - "Shutdown", - "Failure", - "Emergency", - "Undefined" - }; - - // If the state is unknown or out of bounds - if(state < JAUS_INITIALIZE_STATE || state > JAUS_EMERGENCY_STATE) - { - return jausStateString[6]; - } - else - { - return jausStateString[state]; - } -} diff --git a/lib/openjaus/libjaus/src/jausSubsystem.c b/lib/openjaus/libjaus/src/jausSubsystem.c deleted file mode 100644 index 08373d4a0ca3510b64357e733aa3aba59533a272..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/jausSubsystem.c +++ /dev/null @@ -1,295 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausSubsystem.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#include -#include -#include -#include -#include "jaus.h" - -JausSubsystem jausSubsystemCreate(void) -{ - JausSubsystem subsystem; - - subsystem = (JausSubsystem)malloc( sizeof(JausSubsystemStruct) ); - if(subsystem == NULL) - { - return NULL; - } - - //Init Values - subsystem->id = 0; - subsystem->identification = NULL; - subsystem->nodes = jausArrayCreate(); - jausSubsystemUpdateTimestamp(subsystem); - - return subsystem; -} - -void jausSubsystemDestroy(JausSubsystem subsystem) -{ - jausArrayDestroy(subsystem->nodes, (void *)jausNodeDestroy); - if(subsystem->identification) free(subsystem->identification); - free(subsystem); -} - -JausSubsystem jausSubsystemClone(JausSubsystem subsystem) -{ - JausSubsystem clone; - JausNode tempNode; - size_t stringLength; - int i; - - clone = (JausSubsystem)malloc( sizeof(JausSubsystemStruct) ); - if(clone == NULL) - { - return NULL; - } - - //Init Values - clone->id = subsystem->id; - if(subsystem->identification) - { - stringLength = strlen(subsystem->identification) + 1; - clone->identification = (char *) malloc(stringLength); - sprintf(clone->identification, "%s", subsystem->identification); - } - else - { - clone->identification = NULL; - } - - clone->nodes = jausArrayCreate(); - for( i = 0; i < subsystem->nodes->elementCount; i++) - { - tempNode = jausNodeClone(subsystem->nodes->elementData[i]); - jausArrayAdd(clone->nodes, tempNode); - } - - jausSubsystemUpdateTimestamp(clone); - - return clone; -} - -void jausSubsystemUpdateTimestamp(JausSubsystem subsystem) -{ - time(&subsystem->timeStampSec); -} - -JausBoolean jausSubsystemIsTimedOut(JausSubsystem subsystem) -{ - time_t now; - time(&now); - - return difftime(now, subsystem->timeStampSec) > SUBSYSTEM_TIMEOUT_SEC? JAUS_TRUE : JAUS_FALSE; -} - -JausBoolean jausSubsystemFreeMemory(JausSubsystem subsystem) -{ - if(subsystem->nodes == NULL) - { - return JAUS_FALSE; - } - else - { - jausArrayDestroy(subsystem->nodes, free); - } - - return JAUS_TRUE; -} - -JausBoolean jausSubsystemHasIdentification(JausSubsystem subs) -{ - if(subs && subs->identification) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean jausSubsystemHasConfiguration(JausSubsystem subs) -{ - if(subs && subs->nodes->elementCount > 0) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -int jausSubsystemToString(JausSubsystem subsystem, char *buf) -{ - if(subsystem->identification == NULL) - { - return sprintf(buf, "JausSubsystem-%d", subsystem->id); - } - else - { - return sprintf(buf, "%s-%d", subsystem->identification, subsystem->id); - } -} - -int jausSubsystemTableToString(JausSubsystem subsystem, char *buf) -{ - int i = 0; - int j = 0; - int k = 0; - char tempBuf[256] = {0}; - JausNode node; - JausComponent comp; - JausService service; - - jausSubsystemToString(subsystem, tempBuf); - sprintf(buf, "%s\n", tempBuf); - - for(i = 0; i < subsystem->nodes->elementCount; i++) - { - node = (JausNode)subsystem->nodes->elementData[i]; - - jausNodeToString(node, tempBuf); - - strcat(buf, " "); - strcat(buf, tempBuf); - strcat(buf, "\n"); - - for(j = 0; j < node->components->elementCount; j++) - { - comp = (JausComponent)node->components->elementData[j]; - - memset(tempBuf, 0, 256); - - jausComponentToString(comp, tempBuf); - - strcat(buf, " "); - strcat(buf, tempBuf); - strcat(buf,"\n"); - - memset(tempBuf, 0, 256); - - sprintf(tempBuf, " Services (%d):", comp->services->elementCount); - strcat(buf, tempBuf); - - for(k = 0; k < comp->services->elementCount; k++) - { - service = (JausService) comp->services->elementData[k]; - sprintf(tempBuf, " %d,", service->type); - strcat(buf, tempBuf); - } - - strcat(buf, "\n"); - } - } - - return (int)strlen(buf); -} - -int jausSubsystemTableToDetailedString(JausSubsystem subsystem, char *buf) -{ - int i = 0; - int j = 0; - int k = 0; - char tempBuf[256] = {0}; - JausNode node; - JausComponent comp; - JausService service; - JausCommand command; - - jausSubsystemToString(subsystem, tempBuf); - sprintf(buf, "%s\n", tempBuf); - - for(i = 0; i < subsystem->nodes->elementCount; i++) - { - node = (JausNode)subsystem->nodes->elementData[i]; - - jausNodeToString(node, tempBuf); - - strcat(buf, " "); - strcat(buf, tempBuf); - strcat(buf, "\n"); - - for(j = 0; j < node->components->elementCount; j++) - { - comp = (JausComponent)node->components->elementData[j]; - - memset(tempBuf, 0, 256); - - jausComponentToString(comp, tempBuf); - - strcat(buf, " "); - strcat(buf, tempBuf); - strcat(buf, "\n"); - - for(k = 0; k < comp->services->elementCount; k++) - { - service = (JausService) comp->services->elementData[k]; - sprintf(tempBuf, " Service Type: %d\n", service->type); - strcat(buf, tempBuf); - - strcat(buf, " INPUT:\n"); - command = service->inputCommandList; - while(command) - { - sprintf(tempBuf, " %s (0x%04X)\n", jausCommandCodeString(command->commandCode), command->presenceVector); - strcat(buf, tempBuf); - command = command->next; - } - - strcat(buf, " OUTPUT:\n"); - command = service->outputCommandList; - while(command) - { - sprintf(tempBuf, " %s (0x%04X)\n", jausCommandCodeString(command->commandCode), command->presenceVector); - strcat(buf, tempBuf); - command = command->next; - }; - } - } - } - - return (int)strlen(buf); -} diff --git a/lib/openjaus/libjaus/src/message/command/communications/setDataLinkSelectMessage.c b/lib/openjaus/libjaus/src/message/command/communications/setDataLinkSelectMessage.c deleted file mode 100644 index b15727bf1f5cb8008ca3e080f6922e620af6e1d1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/communications/setDataLinkSelectMessage.c +++ /dev/null @@ -1,354 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setDataLinkSelectMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetDataLinkSelectMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_DATA_LINK_SELECT; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(SetDataLinkSelectMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetDataLinkSelectMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetDataLinkSelectMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetDataLinkSelectMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetDataLinkSelectMessage message); -static void dataDestroy(SetDataLinkSelectMessage message); -static unsigned int dataSize(SetDataLinkSelectMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetDataLinkSelectMessage message) -{ - - message->dataLinkId = newJausByte(0); // Data link on by default -} - -// Destructs the message-specific fields -static void dataDestroy(SetDataLinkSelectMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetDataLinkSelectMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - if(!jausByteFromBuffer(&message->dataLinkId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetDataLinkSelectMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->dataLinkId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetDataLinkSelectMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetDataLinkSelectMessage setDataLinkSelectMessageCreate(void) -{ - SetDataLinkSelectMessage message; - - message = (SetDataLinkSelectMessage)malloc( sizeof(SetDataLinkSelectMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setDataLinkSelectMessageDestroy(SetDataLinkSelectMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setDataLinkSelectMessageFromBuffer(SetDataLinkSelectMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setDataLinkSelectMessageToBuffer(SetDataLinkSelectMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setDataLinkSelectMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetDataLinkSelectBuffer failed - } - } -} - -SetDataLinkSelectMessage setDataLinkSelectMessageFromJausMessage(JausMessage jausMessage) -{ - SetDataLinkSelectMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetDataLinkSelectMessage)malloc( sizeof(SetDataLinkSelectMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setDataLinkSelectMessageToJausMessage(SetDataLinkSelectMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setDataLinkSelectMessageSize(SetDataLinkSelectMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetDataLinkSelectMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetDataLinkSelectMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/communications/setDataLinkStatusMessage.c b/lib/openjaus/libjaus/src/message/command/communications/setDataLinkStatusMessage.c deleted file mode 100644 index 757189104f2c4bbb7d9be1b88c55f3cb10aab64f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/communications/setDataLinkStatusMessage.c +++ /dev/null @@ -1,360 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setDataLinkStatusMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetDataLinkStatusMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_DATA_LINK_STATUS; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(SetDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetDataLinkStatusMessage message); -static void dataDestroy(SetDataLinkStatusMessage message); -static unsigned int dataSize(SetDataLinkStatusMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetDataLinkStatusMessage message) -{ - - message->state = JAUS_DATA_LINK_ON; // Data link on by default -} - -// Destructs the message-specific fields -static void dataDestroy(SetDataLinkStatusMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausByte tempByte = 0; - - if(bufferSizeBytes == message->dataSize) - { - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->state = tempByte; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausByte tempByte; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - tempByte = (message->state < 0) ? JAUS_BYTE_MIN_VALUE : message->state; - - if(!jausByteToBuffer(((JausByte)message->state), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetDataLinkStatusMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetDataLinkStatusMessage setDataLinkStatusMessageCreate(void) -{ - SetDataLinkStatusMessage message; - - message = (SetDataLinkStatusMessage)malloc( sizeof(SetDataLinkStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setDataLinkStatusMessageDestroy(SetDataLinkStatusMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setDataLinkStatusMessageFromBuffer(SetDataLinkStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setDataLinkStatusMessageToBuffer(SetDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setDataLinkStatusMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetDataLinkStatusBuffer failed - } - } -} - -SetDataLinkStatusMessage setDataLinkStatusMessageFromJausMessage(JausMessage jausMessage) -{ - SetDataLinkStatusMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetDataLinkStatusMessage)malloc( sizeof(SetDataLinkStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setDataLinkStatusMessageToJausMessage(SetDataLinkStatusMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setDataLinkStatusMessageSize(SetDataLinkStatusMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/communications/setSelectedDataLinkStateMessage.c b/lib/openjaus/libjaus/src/message/command/communications/setSelectedDataLinkStateMessage.c deleted file mode 100644 index e3195a4e463d497ee9174dcfba9dc5ac54ea43cc..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/communications/setSelectedDataLinkStateMessage.c +++ /dev/null @@ -1,361 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setSelectedDataLinkStateMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetSelectedDataLinkStateMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_SELECTED_DATA_LINK_STATE; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(SetSelectedDataLinkStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetSelectedDataLinkStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetSelectedDataLinkStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetSelectedDataLinkStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetSelectedDataLinkStateMessage message); -static void dataDestroy(SetSelectedDataLinkStateMessage message); -static unsigned int dataSize(SetSelectedDataLinkStateMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetSelectedDataLinkStateMessage message) -{ - - message->dataLinkId = newJausByte(0); // Data link on by default - message->state = newJausByte(0); // Data link on by default -} - -// Destructs the message-specific fields -static void dataDestroy(SetSelectedDataLinkStateMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetSelectedDataLinkStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - if(!jausByteFromBuffer(&message->dataLinkId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->state, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetSelectedDataLinkStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->dataLinkId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(message->state, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetSelectedDataLinkStateMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetSelectedDataLinkStateMessage setSelectedDataLinkStateMessageCreate(void) -{ - SetSelectedDataLinkStateMessage message; - - message = (SetSelectedDataLinkStateMessage)malloc( sizeof(SetSelectedDataLinkStateMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setSelectedDataLinkStateMessageDestroy(SetSelectedDataLinkStateMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setSelectedDataLinkStateMessageFromBuffer(SetSelectedDataLinkStateMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setSelectedDataLinkStateMessageToBuffer(SetSelectedDataLinkStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setSelectedDataLinkStateMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetSelectedDataLinkStateBuffer failed - } - } -} - -SetSelectedDataLinkStateMessage setSelectedDataLinkStateMessageFromJausMessage(JausMessage jausMessage) -{ - SetSelectedDataLinkStateMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetSelectedDataLinkStateMessage)malloc( sizeof(SetSelectedDataLinkStateMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setSelectedDataLinkStateMessageToJausMessage(SetSelectedDataLinkStateMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setSelectedDataLinkStateMessageSize(SetSelectedDataLinkStateMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetSelectedDataLinkStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetSelectedDataLinkStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/activateServiceConnectionMessage.c b/lib/openjaus/libjaus/src/message/command/core/activateServiceConnectionMessage.c deleted file mode 100644 index 9d5de82c0090f186727cb959d891e1462ecce997..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/activateServiceConnectionMessage.c +++ /dev/null @@ -1,357 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: activateServiceConnectionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ActivateServiceConnectionMessage - - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_ACTIVATE_SERVICE_CONNECTION; -static const int maxDataSizeBytes = 3; - -static JausBoolean headerFromBuffer(ActivateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ActivateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ActivateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ActivateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ActivateServiceConnectionMessage message); -static unsigned int dataSize(ActivateServiceConnectionMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ActivateServiceConnectionMessage message) -{ - message->properties.scFlag = JAUS_SERVICE_CONNECTION_MESSAGE; - // Set initial values of message fields - message->serviceConnectionCommandCode = newJausUnsignedShort(0); - message->instanceId = newJausByte(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ActivateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->serviceConnectionCommandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->instanceId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ActivateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->serviceConnectionCommandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteToBuffer(message->instanceId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(ActivateServiceConnectionMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ActivateServiceConnectionMessage activateServiceConnectionMessageCreate(void) -{ - ActivateServiceConnectionMessage message; - - message = (ActivateServiceConnectionMessage)malloc( sizeof(ActivateServiceConnectionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void activateServiceConnectionMessageDestroy(ActivateServiceConnectionMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean activateServiceConnectionMessageFromBuffer(ActivateServiceConnectionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean activateServiceConnectionMessageToBuffer(ActivateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < activateServiceConnectionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToActivateServiceConnectionBuffer failed - } - } -} - -ActivateServiceConnectionMessage activateServiceConnectionMessageFromJausMessage(JausMessage jausMessage) -{ - ActivateServiceConnectionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ActivateServiceConnectionMessage)malloc( sizeof(ActivateServiceConnectionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage activateServiceConnectionMessageToJausMessage(ActivateServiceConnectionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int activateServiceConnectionMessageSize(ActivateServiceConnectionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ActivateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ActivateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/clearEmergencyMessage.c b/lib/openjaus/libjaus/src/message/command/core/clearEmergencyMessage.c deleted file mode 100644 index cf72651f801aab899bd72b19fe9ba490953db59a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/clearEmergencyMessage.c +++ /dev/null @@ -1,355 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: clearEmergencyMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ClearEmergencyMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_CLEAR_EMERGENCY; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(ClearEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ClearEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ClearEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ClearEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ClearEmergencyMessage message); -static unsigned int dataSize(ClearEmergencyMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ClearEmergencyMessage message) -{ - // Set initial values of message fields - message->clearEmergency = JAUS_FALSE; -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ClearEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort emergencyCode = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&emergencyCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - message->clearEmergency = jausUnsignedShortIsBitSet(emergencyCode, JAUS_CLEAR_EMERGENCY_BF_CLEAR_EMERGENCY_BIT)? JAUS_TRUE : JAUS_FALSE; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ClearEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort emergencyCode = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(message->clearEmergency) jausUnsignedShortSetBit(&emergencyCode, JAUS_CLEAR_EMERGENCY_BF_CLEAR_EMERGENCY_BIT); - - if(!jausUnsignedShortToBuffer(emergencyCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(ClearEmergencyMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ClearEmergencyMessage clearEmergencyMessageCreate(void) -{ - ClearEmergencyMessage message; - - message = (ClearEmergencyMessage)malloc( sizeof(ClearEmergencyMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void clearEmergencyMessageDestroy(ClearEmergencyMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean clearEmergencyMessageFromBuffer(ClearEmergencyMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean clearEmergencyMessageToBuffer(ClearEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < clearEmergencyMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToClearEmergencyBuffer failed - } - } -} - -ClearEmergencyMessage clearEmergencyMessageFromJausMessage(JausMessage jausMessage) -{ - ClearEmergencyMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ClearEmergencyMessage)malloc( sizeof(ClearEmergencyMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage clearEmergencyMessageToJausMessage(ClearEmergencyMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int clearEmergencyMessageSize(ClearEmergencyMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ClearEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ClearEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/confirmComponentControlMessage.c b/lib/openjaus/libjaus/src/message/command/core/confirmComponentControlMessage.c deleted file mode 100644 index ab6829b587b9e5f7686d033999f5e044fcbd7e00..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/confirmComponentControlMessage.c +++ /dev/null @@ -1,352 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: confirmComponentControlMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ConfirmComponentControlMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_CONFIRM_COMPONENT_CONTROL; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(ConfirmComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ConfirmComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ConfirmComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ConfirmComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ConfirmComponentControlMessage message); -static unsigned int dataSize(ConfirmComponentControlMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ConfirmComponentControlMessage message) -{ - // Set initial values of message fields - message->responseCode = JAUS_CONTROL_ACCEPTED; -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ConfirmComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausByte tempByte = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->responseCode = tempByte; - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ConfirmComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(((JausByte)message->responseCode), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - } - - return index; -} - -static unsigned int dataSize(ConfirmComponentControlMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ConfirmComponentControlMessage confirmComponentControlMessageCreate(void) -{ - ConfirmComponentControlMessage message; - - message = (ConfirmComponentControlMessage)malloc( sizeof(ConfirmComponentControlMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void confirmComponentControlMessageDestroy(ConfirmComponentControlMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean confirmComponentControlMessageFromBuffer(ConfirmComponentControlMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean confirmComponentControlMessageToBuffer(ConfirmComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < confirmComponentControlMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToConfirmComponentControlBuffer failed - } - } -} - -ConfirmComponentControlMessage confirmComponentControlMessageFromJausMessage(JausMessage jausMessage) -{ - ConfirmComponentControlMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ConfirmComponentControlMessage)malloc( sizeof(ConfirmComponentControlMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage confirmComponentControlMessageToJausMessage(ConfirmComponentControlMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int confirmComponentControlMessageSize(ConfirmComponentControlMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ConfirmComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ConfirmComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/confirmServiceConnectionMessage.c b/lib/openjaus/libjaus/src/message/command/core/confirmServiceConnectionMessage.c deleted file mode 100644 index cf24db8731270a7a05cef557fbaee386698d3814..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/confirmServiceConnectionMessage.c +++ /dev/null @@ -1,384 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: confirmServiceConnectionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ConfirmServiceConnectionMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_CONFIRM_SERVICE_CONNECTION; -static const int maxDataSizeBytes = 6; - -static JausBoolean headerFromBuffer(ConfirmServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ConfirmServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ConfirmServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ConfirmServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ConfirmServiceConnectionMessage message); -static unsigned int dataSize(ConfirmServiceConnectionMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ConfirmServiceConnectionMessage message) -{ - message->properties.scFlag = JAUS_SERVICE_CONNECTION_MESSAGE; - - // Set initial values of message fields - message->serviceConnectionCommandCode = newJausUnsignedShort(0); - message->instanceId = newJausByte(0); - message->confirmedPeriodicUpdateRateHertz = newJausDouble(0); - message->responseCode = JAUS_SC_COMMAND_NOT_SUPPORTED; -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ConfirmServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - JausByte tempByte = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->serviceConnectionCommandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->instanceId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Int to double, 0 min, 1092 max - message->confirmedPeriodicUpdateRateHertz = jausUnsignedShortToDouble(tempUShort, 0, 1092); - - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->responseCode= tempByte; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ConfirmServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->serviceConnectionCommandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteToBuffer(message->instanceId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Int from double, 0 min, 1092 max - tempUShort = jausUnsignedShortFromDouble(message->confirmedPeriodicUpdateRateHertz, 0, 1092); - - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteToBuffer(((JausByte)message->responseCode), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - } - - return index; -} - -static unsigned int dataSize(ConfirmServiceConnectionMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ConfirmServiceConnectionMessage confirmServiceConnectionMessageCreate(void) -{ - ConfirmServiceConnectionMessage message; - - message = (ConfirmServiceConnectionMessage)malloc( sizeof(ConfirmServiceConnectionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void confirmServiceConnectionMessageDestroy(ConfirmServiceConnectionMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean confirmServiceConnectionMessageFromBuffer(ConfirmServiceConnectionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean confirmServiceConnectionMessageToBuffer(ConfirmServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < confirmServiceConnectionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToConfirmServiceConnectionBuffer failed - } - } -} - -ConfirmServiceConnectionMessage confirmServiceConnectionMessageFromJausMessage(JausMessage jausMessage) -{ - ConfirmServiceConnectionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ConfirmServiceConnectionMessage)malloc( sizeof(ConfirmServiceConnectionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage confirmServiceConnectionMessageToJausMessage(ConfirmServiceConnectionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int confirmServiceConnectionMessageSize(ConfirmServiceConnectionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ConfirmServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ConfirmServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/createServiceConnectionMessage.c b/lib/openjaus/libjaus/src/message/command/core/createServiceConnectionMessage.c deleted file mode 100644 index 26c31932bbfe5a3610db2dc1f4b0f8f9c6c3559e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/createServiceConnectionMessage.c +++ /dev/null @@ -1,372 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: createServiceConnectionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a CreateServiceConnectionMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_CREATE_SERVICE_CONNECTION; -static const int maxDataSizeBytes = 8; - -static JausBoolean headerFromBuffer(CreateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(CreateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(CreateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(CreateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(CreateServiceConnectionMessage message); -static unsigned int dataSize(CreateServiceConnectionMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(CreateServiceConnectionMessage message) -{ - message->properties.scFlag = JAUS_SERVICE_CONNECTION_MESSAGE; - // Set initial values of message fields - message->serviceConnectionCommandCode = newJausUnsignedShort(0); - message->requestedPeriodicUpdateRateHertz = newJausDouble(0); - message->presenceVector = newJausUnsignedInteger(JAUS_INTEGER_PRESENCE_VECTOR_ALL_ON); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(CreateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->serviceConnectionCommandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled UShort to double, 0 min, 1092 max - message->requestedPeriodicUpdateRateHertz = jausUnsignedShortToDouble(tempUShort, 0, 1092); - - if(!jausUnsignedIntegerFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(CreateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->serviceConnectionCommandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Int from double, 0 min, 1092 max - tempUShort = jausUnsignedShortFromDouble(message->requestedPeriodicUpdateRateHertz, 0, 1092); - - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedIntegerToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(CreateServiceConnectionMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -CreateServiceConnectionMessage createServiceConnectionMessageCreate(void) -{ - CreateServiceConnectionMessage message; - - message = (CreateServiceConnectionMessage)malloc( sizeof(CreateServiceConnectionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void createServiceConnectionMessageDestroy(CreateServiceConnectionMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean createServiceConnectionMessageFromBuffer(CreateServiceConnectionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean createServiceConnectionMessageToBuffer(CreateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < createServiceConnectionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToCreateServiceConnectionBuffer failed - } - } -} - -CreateServiceConnectionMessage createServiceConnectionMessageFromJausMessage(JausMessage jausMessage) -{ - CreateServiceConnectionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (CreateServiceConnectionMessage)malloc( sizeof(CreateServiceConnectionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage createServiceConnectionMessageToJausMessage(CreateServiceConnectionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int createServiceConnectionMessageSize(CreateServiceConnectionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(CreateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(CreateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/rejectComponentControlMessage.c b/lib/openjaus/libjaus/src/message/command/core/rejectComponentControlMessage.c deleted file mode 100644 index fe0db533020a27d9e609046134a66eed92bb1610..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/rejectComponentControlMessage.c +++ /dev/null @@ -1,345 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: rejectComponentControlMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a RejectComponentControlMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REJECT_COMPONENT_CONTROL; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(RejectComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(RejectComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(RejectComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(RejectComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(RejectComponentControlMessage message); -static unsigned int dataSize(RejectComponentControlMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(RejectComponentControlMessage message) -{ - // Set initial values of message fields - // No Fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(RejectComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -// int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Fields - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(RejectComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - } - - return index; -} - -static unsigned int dataSize(RejectComponentControlMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -RejectComponentControlMessage rejectComponentControlMessageCreate(void) -{ - RejectComponentControlMessage message; - - message = (RejectComponentControlMessage)malloc( sizeof(RejectComponentControlMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void rejectComponentControlMessageDestroy(RejectComponentControlMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean rejectComponentControlMessageFromBuffer(RejectComponentControlMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean rejectComponentControlMessageToBuffer(RejectComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < rejectComponentControlMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToRejectComponentControlBuffer failed - } - } -} - -RejectComponentControlMessage rejectComponentControlMessageFromJausMessage(JausMessage jausMessage) -{ - RejectComponentControlMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (RejectComponentControlMessage)malloc( sizeof(RejectComponentControlMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage rejectComponentControlMessageToJausMessage(RejectComponentControlMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int rejectComponentControlMessageSize(RejectComponentControlMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(RejectComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(RejectComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/releaseComponentControlMessage.c b/lib/openjaus/libjaus/src/message/command/core/releaseComponentControlMessage.c deleted file mode 100644 index 712c6f331ddcf4a243e6cbcd1666394bbbc09b58..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/releaseComponentControlMessage.c +++ /dev/null @@ -1,345 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: releaseComponentControlMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReleaseComponentControlMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_RELEASE_COMPONENT_CONTROL; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(ReleaseComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReleaseComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReleaseComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReleaseComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReleaseComponentControlMessage message); -static unsigned int dataSize(ReleaseComponentControlMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReleaseComponentControlMessage message) -{ - // Set initial values of message fields - // No Fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReleaseComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -// int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Fields - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReleaseComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - } - - return index; -} - -static unsigned int dataSize(ReleaseComponentControlMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReleaseComponentControlMessage releaseComponentControlMessageCreate(void) -{ - ReleaseComponentControlMessage message; - - message = (ReleaseComponentControlMessage)malloc( sizeof(ReleaseComponentControlMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void releaseComponentControlMessageDestroy(ReleaseComponentControlMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean releaseComponentControlMessageFromBuffer(ReleaseComponentControlMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean releaseComponentControlMessageToBuffer(ReleaseComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < releaseComponentControlMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReleaseComponentControlBuffer failed - } - } -} - -ReleaseComponentControlMessage releaseComponentControlMessageFromJausMessage(JausMessage jausMessage) -{ - ReleaseComponentControlMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReleaseComponentControlMessage)malloc( sizeof(ReleaseComponentControlMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage releaseComponentControlMessageToJausMessage(ReleaseComponentControlMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int releaseComponentControlMessageSize(ReleaseComponentControlMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReleaseComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReleaseComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/requestComponentControlMessage.c b/lib/openjaus/libjaus/src/message/command/core/requestComponentControlMessage.c deleted file mode 100644 index 5ebea0fc1507f2dadc1e1b80c608130df9179329..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/requestComponentControlMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: requestComponentControlMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a RequestComponentControlMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REQUEST_COMPONENT_CONTROL; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(RequestComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(RequestComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(RequestComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(RequestComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(RequestComponentControlMessage message); -static unsigned int dataSize(RequestComponentControlMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(RequestComponentControlMessage message) -{ - // Set initial values of message fields - message->authorityCode = newJausByte(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(RequestComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->authorityCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(RequestComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->authorityCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(RequestComponentControlMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -RequestComponentControlMessage requestComponentControlMessageCreate(void) -{ - RequestComponentControlMessage message; - - message = (RequestComponentControlMessage)malloc( sizeof(RequestComponentControlMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void requestComponentControlMessageDestroy(RequestComponentControlMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean requestComponentControlMessageFromBuffer(RequestComponentControlMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean requestComponentControlMessageToBuffer(RequestComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < requestComponentControlMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToRequestComponentControlBuffer failed - } - } -} - -RequestComponentControlMessage requestComponentControlMessageFromJausMessage(JausMessage jausMessage) -{ - RequestComponentControlMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (RequestComponentControlMessage)malloc( sizeof(RequestComponentControlMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage requestComponentControlMessageToJausMessage(RequestComponentControlMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int requestComponentControlMessageSize(RequestComponentControlMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(RequestComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(RequestComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/resetMessage.c b/lib/openjaus/libjaus/src/message/command/core/resetMessage.c deleted file mode 100644 index ff9504e0d8d755a1264e8e1c1bfbf72079b66a66..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/resetMessage.c +++ /dev/null @@ -1,345 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: resetMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ResetMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_RESET; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(ResetMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ResetMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ResetMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ResetMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ResetMessage message); -static unsigned int dataSize(ResetMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ResetMessage message) -{ - //No Data -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ResetMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -// int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - //No Data - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ResetMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - buffer = NULL; - } - - return index; -} - -static unsigned int dataSize(ResetMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ResetMessage resetMessageCreate(void) -{ - ResetMessage message; - - message = (ResetMessage)malloc( sizeof(ResetMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void resetMessageDestroy(ResetMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean resetMessageFromBuffer(ResetMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean resetMessageToBuffer(ResetMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < resetMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToResetBuffer failed - } - } -} - -ResetMessage resetMessageFromJausMessage(JausMessage jausMessage) -{ - ResetMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ResetMessage)malloc( sizeof(ResetMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage resetMessageToJausMessage(ResetMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int resetMessageSize(ResetMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ResetMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ResetMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/resumeMessage.c b/lib/openjaus/libjaus/src/message/command/core/resumeMessage.c deleted file mode 100644 index 21e1f620fb3eb9e40793bcf555c535d7af9e9b2a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/resumeMessage.c +++ /dev/null @@ -1,346 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: resumeMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ResumeMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_RESUME; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(ResumeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ResumeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ResumeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ResumeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ResumeMessage message); -static unsigned int dataSize(ResumeMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ResumeMessage message) -{ - // Set initial values of message fields - // No Data -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ResumeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -// int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Data - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ResumeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - buffer = NULL; - } - - return index; -} - -static unsigned int dataSize(ResumeMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ResumeMessage resumeMessageCreate(void) -{ - ResumeMessage message; - - message = (ResumeMessage)malloc( sizeof(ResumeMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void resumeMessageDestroy(ResumeMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean resumeMessageFromBuffer(ResumeMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean resumeMessageToBuffer(ResumeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < resumeMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToResumeBuffer failed - } - } -} - -ResumeMessage resumeMessageFromJausMessage(JausMessage jausMessage) -{ - ResumeMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ResumeMessage)malloc( sizeof(ResumeMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage resumeMessageToJausMessage(ResumeMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int resumeMessageSize(ResumeMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ResumeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ResumeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/setComponentAuthorityMessage.c b/lib/openjaus/libjaus/src/message/command/core/setComponentAuthorityMessage.c deleted file mode 100644 index a1ba08dac209162f83798d0d3b0e3d5955f5c805..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/setComponentAuthorityMessage.c +++ /dev/null @@ -1,348 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setComponentAuthorityMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetComponentAuthorityMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_COMPONENT_AUTHORITY; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(SetComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetComponentAuthorityMessage message); -static unsigned int dataSize(SetComponentAuthorityMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetComponentAuthorityMessage message) -{ - message->authorityCode = newJausByte(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer( &(message->authorityCode), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->authorityCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(SetComponentAuthorityMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetComponentAuthorityMessage setComponentAuthorityMessageCreate(void) -{ - SetComponentAuthorityMessage message; - - message = (SetComponentAuthorityMessage)malloc( sizeof(SetComponentAuthorityMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void setComponentAuthorityMessageDestroy(SetComponentAuthorityMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setComponentAuthorityMessageFromBuffer(SetComponentAuthorityMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setComponentAuthorityMessageToBuffer(SetComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setComponentAuthorityMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetComponentAuthorityBuffer failed - } - } -} - -SetComponentAuthorityMessage setComponentAuthorityMessageFromJausMessage(JausMessage jausMessage) -{ - SetComponentAuthorityMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetComponentAuthorityMessage)malloc( sizeof(SetComponentAuthorityMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setComponentAuthorityMessageToJausMessage(SetComponentAuthorityMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int setComponentAuthorityMessageSize(SetComponentAuthorityMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/setEmergencyMessage.c b/lib/openjaus/libjaus/src/message/command/core/setEmergencyMessage.c deleted file mode 100644 index 61a1db0007007fdcc02118f1abbbe5fa077b8512..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/setEmergencyMessage.c +++ /dev/null @@ -1,353 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setEmergencyMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetEmergencyMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_EMERGENCY; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(SetEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetEmergencyMessage message); -static unsigned int dataSize(SetEmergencyMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetEmergencyMessage message) -{ - // Set initial values of message fields - message->transitionToEmergency = JAUS_FALSE; -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort emergencyCode = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&emergencyCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - message->transitionToEmergency = jausUnsignedShortIsBitSet(emergencyCode, JAUS_SET_EMERGENCY_BF_TRANSITION_TO_EMERGENCY_BIT)? JAUS_TRUE : JAUS_FALSE; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort emergencyCode = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(message->transitionToEmergency) jausUnsignedShortSetBit(&emergencyCode, JAUS_SET_EMERGENCY_BF_TRANSITION_TO_EMERGENCY_BIT); - - if(!jausUnsignedShortToBuffer(emergencyCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(SetEmergencyMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetEmergencyMessage setEmergencyMessageCreate(void) -{ - SetEmergencyMessage message; - - message = (SetEmergencyMessage)malloc( sizeof(SetEmergencyMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void setEmergencyMessageDestroy(SetEmergencyMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setEmergencyMessageFromBuffer(SetEmergencyMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setEmergencyMessageToBuffer(SetEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setEmergencyMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetEmergencyBuffer failed - } - } -} - -SetEmergencyMessage setEmergencyMessageFromJausMessage(JausMessage jausMessage) -{ - SetEmergencyMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetEmergencyMessage)malloc( sizeof(SetEmergencyMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setEmergencyMessageToJausMessage(SetEmergencyMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int setEmergencyMessageSize(SetEmergencyMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetEmergencyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/setTimeMessage.c b/lib/openjaus/libjaus/src/message/command/core/setTimeMessage.c deleted file mode 100644 index 558be1319c718240400e532a22f4804e381d63fe..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/setTimeMessage.c +++ /dev/null @@ -1,401 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setTimeMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetTimeMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_TIME; -static const int maxDataSizeBytes = 7; - -static JausBoolean headerFromBuffer(SetTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetTimeMessage message); -static void dataDestroy(SetTimeMessage message); -static unsigned int dataSize(SetTimeMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetTimeMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->time = jausTimeCreate(); -} - -// Destructs the message-specific fields -static void dataDestroy(SetTimeMessage message) -{ - // Free message fields - jausTimeDestroy(message->time); -} - - -// Return boolean of success -static JausBoolean dataFromBuffer(SetTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Unpack according to Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->time = jausTimeCreate(); - - if(jausByteIsBitSet(message->presenceVector, JAUS_TIME_PV_TIME_STAMP_BIT)) - { - if(!jausTimeStampFromBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_TIME_PV_DATE_STAMP_BIT)) - { - if(!jausDateStampFromBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_DATE_STAMP_SIZE_BYTES; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Pack According to Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_TIME_PV_TIME_STAMP_BIT)) - { - if(!jausTimeStampToBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_TIME_PV_DATE_STAMP_BIT)) - { - if(!jausDateStampToBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_DATE_STAMP_SIZE_BYTES; - } - } - - return index; -} - -static unsigned int dataSize(SetTimeMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_TIME_PV_TIME_STAMP_BIT)) - { - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_TIME_PV_DATE_STAMP_BIT)) - { - index += JAUS_DATE_STAMP_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetTimeMessage setTimeMessageCreate(void) -{ - SetTimeMessage message; - - message = (SetTimeMessage)malloc( sizeof(SetTimeMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void setTimeMessageDestroy(SetTimeMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setTimeMessageFromBuffer(SetTimeMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setTimeMessageToBuffer(SetTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setTimeMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetTimeBuffer failed - } - } -} - -SetTimeMessage setTimeMessageFromJausMessage(JausMessage jausMessage) -{ - SetTimeMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetTimeMessage)malloc( sizeof(SetTimeMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setTimeMessageToJausMessage(SetTimeMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int setTimeMessageSize(SetTimeMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/shutdownMessage.c b/lib/openjaus/libjaus/src/message/command/core/shutdownMessage.c deleted file mode 100644 index fdcf6f4c8340d9e65b017454339eee034ba72577..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/shutdownMessage.c +++ /dev/null @@ -1,346 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: shutdownMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ShutdownMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SHUTDOWN; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(ShutdownMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ShutdownMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ShutdownMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ShutdownMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ShutdownMessage message); -static unsigned int dataSize(ShutdownMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ShutdownMessage message) -{ - // Set initial values of message fields - // No Message Fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ShutdownMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -// int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Message Fields - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ShutdownMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - buffer = NULL; - } - - return index; -} - -static unsigned int dataSize(ShutdownMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ShutdownMessage shutdownMessageCreate(void) -{ - ShutdownMessage message; - - message = (ShutdownMessage)malloc( sizeof(ShutdownMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void shutdownMessageDestroy(ShutdownMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean shutdownMessageFromBuffer(ShutdownMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean shutdownMessageToBuffer(ShutdownMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < shutdownMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToShutdownBuffer failed - } - } -} - -ShutdownMessage shutdownMessageFromJausMessage(JausMessage jausMessage) -{ - ShutdownMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ShutdownMessage)malloc( sizeof(ShutdownMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage shutdownMessageToJausMessage(ShutdownMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int shutdownMessageSize(ShutdownMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ShutdownMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ShutdownMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/standbyMessage.c b/lib/openjaus/libjaus/src/message/command/core/standbyMessage.c deleted file mode 100644 index 31c9bc3f8b1578d79814b5395310a843d75a7398..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/standbyMessage.c +++ /dev/null @@ -1,343 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: standbyMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a StandbyMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_STANDBY; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(StandbyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(StandbyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(StandbyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(StandbyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(StandbyMessage message); -static unsigned int dataSize(StandbyMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(StandbyMessage message) -{ - // Set initial values of message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(StandbyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -// int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(StandbyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - buffer = NULL; - } - - return index; -} - -static unsigned int dataSize(StandbyMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -StandbyMessage standbyMessageCreate(void) -{ - StandbyMessage message; - - message = (StandbyMessage)malloc( sizeof(StandbyMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void standbyMessageDestroy(StandbyMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean standbyMessageFromBuffer(StandbyMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean standbyMessageToBuffer(StandbyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < standbyMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToStandbyBuffer failed - } - } -} - -StandbyMessage standbyMessageFromJausMessage(JausMessage jausMessage) -{ - StandbyMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (StandbyMessage)malloc( sizeof(StandbyMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage standbyMessageToJausMessage(StandbyMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int standbyMessageSize(StandbyMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(StandbyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(StandbyMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/suspendServiceConnectionMessage.c b/lib/openjaus/libjaus/src/message/command/core/suspendServiceConnectionMessage.c deleted file mode 100644 index fa8d982ad9cefa9707407efbca75f0462b6378dc..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/suspendServiceConnectionMessage.c +++ /dev/null @@ -1,357 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: suspendServiceConnectionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SuspendServiceConnectionMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SUSPEND_SERVICE_CONNECTION; -static const int maxDataSizeBytes = 3; - -static JausBoolean headerFromBuffer(SuspendServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SuspendServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SuspendServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SuspendServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SuspendServiceConnectionMessage message); -static unsigned int dataSize(SuspendServiceConnectionMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SuspendServiceConnectionMessage message) -{ - message->properties.scFlag = JAUS_SERVICE_CONNECTION_MESSAGE; - // Set initial values of message fields - message->serviceConnectionCommandCode = newJausUnsignedShort(0); - message->instanceId = newJausByte(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SuspendServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->serviceConnectionCommandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->instanceId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SuspendServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->serviceConnectionCommandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteToBuffer(message->instanceId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(SuspendServiceConnectionMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SuspendServiceConnectionMessage suspendServiceConnectionMessageCreate(void) -{ - SuspendServiceConnectionMessage message; - - message = (SuspendServiceConnectionMessage)malloc( sizeof(SuspendServiceConnectionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void suspendServiceConnectionMessageDestroy(SuspendServiceConnectionMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean suspendServiceConnectionMessageFromBuffer(SuspendServiceConnectionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean suspendServiceConnectionMessageToBuffer(SuspendServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < suspendServiceConnectionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSuspendServiceConnectionBuffer failed - } - } -} - -SuspendServiceConnectionMessage suspendServiceConnectionMessageFromJausMessage(JausMessage jausMessage) -{ - SuspendServiceConnectionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SuspendServiceConnectionMessage)malloc( sizeof(SuspendServiceConnectionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage suspendServiceConnectionMessageToJausMessage(SuspendServiceConnectionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int suspendServiceConnectionMessageSize(SuspendServiceConnectionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SuspendServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SuspendServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/core/terminateServiceConnectionMessage.c b/lib/openjaus/libjaus/src/message/command/core/terminateServiceConnectionMessage.c deleted file mode 100644 index 450b79bf555633f723161c6ac80cd16695ee5e92..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/core/terminateServiceConnectionMessage.c +++ /dev/null @@ -1,357 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: terminateServiceConnectionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a TerminateServiceConnectionMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_TERMINATE_SERVICE_CONNECTION; -static const int maxDataSizeBytes = 3; - -static JausBoolean headerFromBuffer(TerminateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(TerminateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(TerminateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(TerminateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(TerminateServiceConnectionMessage message); -static unsigned int dataSize(TerminateServiceConnectionMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(TerminateServiceConnectionMessage message) -{ - message->properties.scFlag = JAUS_SERVICE_CONNECTION_MESSAGE; - // Set initial values of message fields - message->serviceConnectionCommandCode = newJausUnsignedShort(0); - message->instanceId = newJausByte(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(TerminateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->serviceConnectionCommandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->instanceId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(TerminateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->serviceConnectionCommandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteToBuffer(message->instanceId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(TerminateServiceConnectionMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -TerminateServiceConnectionMessage terminateServiceConnectionMessageCreate(void) -{ - TerminateServiceConnectionMessage message; - - message = (TerminateServiceConnectionMessage)malloc( sizeof(TerminateServiceConnectionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void terminateServiceConnectionMessageDestroy(TerminateServiceConnectionMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean terminateServiceConnectionMessageFromBuffer(TerminateServiceConnectionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean terminateServiceConnectionMessageToBuffer(TerminateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < terminateServiceConnectionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToTerminateServiceConnectionBuffer failed - } - } -} - -TerminateServiceConnectionMessage terminateServiceConnectionMessageFromJausMessage(JausMessage jausMessage) -{ - TerminateServiceConnectionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (TerminateServiceConnectionMessage)malloc( sizeof(TerminateServiceConnectionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage terminateServiceConnectionMessageToJausMessage(TerminateServiceConnectionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int terminateServiceConnectionMessageSize(TerminateServiceConnectionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(TerminateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(TerminateServiceConnectionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/environment/selectCameraMessage.c b/lib/openjaus/libjaus/src/message/command/environment/selectCameraMessage.c deleted file mode 100644 index f9e82a7c8f6ca0adf13767a3d1b8d13702c5061d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/environment/selectCameraMessage.c +++ /dev/null @@ -1,357 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: selectCameraMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SelectCameraMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SELECT_CAMERA; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(SelectCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SelectCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SelectCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SelectCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SelectCameraMessage message); -static void dataDestroy(SelectCameraMessage message); -static unsigned int dataSize(SelectCameraMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SelectCameraMessage message) -{ - // Set initial values of message fields - message->cameraID = 0; -} - -// Destructs the message-specific fields -static void dataDestroy(SelectCameraMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SelectCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SelectCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(SelectCameraMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SelectCameraMessage selectCameraMessageCreate(void) -{ - SelectCameraMessage message; - - message = (SelectCameraMessage)malloc( sizeof(SelectCameraMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void selectCameraMessageDestroy(SelectCameraMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean selectCameraMessageFromBuffer(SelectCameraMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean selectCameraMessageToBuffer(SelectCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < selectCameraMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSelectCameraBuffer failed - } - } -} - -SelectCameraMessage selectCameraMessageFromJausMessage(JausMessage jausMessage) -{ - SelectCameraMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SelectCameraMessage)malloc( sizeof(SelectCameraMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage selectCameraMessageToJausMessage(SelectCameraMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int selectCameraMessageSize(SelectCameraMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SelectCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SelectCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/environment/setCameraCapabilitiesMessage.c b/lib/openjaus/libjaus/src/message/command/environment/setCameraCapabilitiesMessage.c deleted file mode 100644 index dcc956aa049b8438f77cf088d3d544e3a6587f5e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/environment/setCameraCapabilitiesMessage.c +++ /dev/null @@ -1,732 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setCameraCapabilitiesMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetCameraCapabilitiesMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_CAMERA_CAPABILITIES; -static const int maxDataSizeBytes = 22; - -static JausBoolean headerFromBuffer(SetCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetCameraCapabilitiesMessage message); -static void dataDestroy(SetCameraCapabilitiesMessage message); -static unsigned int dataSize(SetCameraCapabilitiesMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetCameraCapabilitiesMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); - message->cameraID = newJausByte(0); - message->horizontalFovRadians = newJausDouble(0); // Scaled UShort (0, JAUS_PI) - message->verticalFovRadians = newJausDouble(0); // Scaled UShort (0, JAUS_PI) - message->horizontalResolution = newJausUnsignedShort(0); - message->verticalResolution = newJausUnsignedShort(0); - message->focusPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->irisPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->gainPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->frameRate = newJausUnsignedShort(0); - message->shutterSpeed = newJausUnsignedShort(0); - - // Image Control - message->autoFocus = JAUS_FALSE; - message->autoIris = JAUS_FALSE; - message->imageStabilization = JAUS_FALSE; - message->whiteBalance = JAUS_FALSE; - message->syncFlash = JAUS_FALSE; - message->redEye = JAUS_FALSE; - message->autoShutter = JAUS_FALSE; - message->videoAutoGain = JAUS_FALSE; - message->interlacedVideo = JAUS_FALSE; - - // Audio Control - message->audioEnabled = JAUS_FALSE; - message->audioAutoGain = JAUS_FALSE; - message->stereoAudio = JAUS_FALSE; - message->directionalAudio = JAUS_FALSE; - message->frontMicrophone = JAUS_FALSE; - message->rearMicrophone = JAUS_FALSE; - message->leftMicrophone = JAUS_FALSE; - message->rightMicrophone = JAUS_FALSE; -} - -// Destructs the message-specific fields -static void dataDestroy(SetCameraCapabilitiesMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort = 0; - JausByte tempByte = 0; - JausUnsignedShort imageControl = 0; - JausUnsignedShort audioControl = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - // Presence Vector - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // CameraID - if(!jausByteFromBuffer(&message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Horizontal FOV - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_HORIZONTAL_FOV_BIT)) - { - //unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled UShort (0, JAUS_PI) - message->horizontalFovRadians = jausUnsignedShortToDouble(tempUShort, 0, JAUS_PI); - } - - // Vertical FOV - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_VERTICAL_FOV_BIT)) - { - //unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled UShort (0, JAUS_PI) - message->verticalFovRadians = jausUnsignedShortToDouble(tempUShort, 0, JAUS_PI); - } - - // Horizontal Resolution - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_HORIZONTAL_RESOLUTION_BIT)) - { - //unpack - if(!jausUnsignedShortFromBuffer(&message->horizontalResolution, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Vertical Resolution - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_VERTICAL_RESOLUTION_BIT)) - { - //unpack - if(!jausUnsignedShortFromBuffer(&message->verticalResolution, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Focus - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FOCUS_BIT)) - { - //unpack - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->focusPercent = jausByteToDouble(tempByte, 0, 100); - } - - // Iris - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_IRIS_BIT)) - { - //unpack - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->irisPercent = jausByteToDouble(tempByte, 0, 100); - } - - // Gain - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_GAIN_BIT)) - { - //unpack - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->gainPercent = jausByteToDouble(tempByte, 0, 100); - } - - // Frame Rate - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FRAME_RATE_BIT)) - { - //unpack - if(!jausUnsignedShortFromBuffer(&message->frameRate, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Shutter Speed - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FRAME_RATE_BIT)) - { - //unpack - if(!jausUnsignedShortFromBuffer(&message->shutterSpeed, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Image Control - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FRAME_RATE_BIT)) - { - //unpack - if(!jausUnsignedShortFromBuffer(&imageControl, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Setup the datastructure's boolean values - message->autoFocus = jausUnsignedShortIsBitSet(imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_FOCUS_BIT)? JAUS_TRUE : JAUS_FALSE; - message->autoIris = jausUnsignedShortIsBitSet(imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_IRIS_BIT)? JAUS_TRUE : JAUS_FALSE; - message->imageStabilization = jausUnsignedShortIsBitSet(imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_IMAGE_STABILIZATION_BIT)? JAUS_TRUE : JAUS_FALSE; - message->whiteBalance = jausUnsignedShortIsBitSet(imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_WHITE_BALANCE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->syncFlash = jausUnsignedShortIsBitSet(imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_SYNC_FLASH_BIT)? JAUS_TRUE : JAUS_FALSE; - message->redEye = jausUnsignedShortIsBitSet(imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_RED_EYE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->autoShutter = jausUnsignedShortIsBitSet(imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_SHUTTER_BIT)? JAUS_TRUE : JAUS_FALSE; - message->videoAutoGain = jausUnsignedShortIsBitSet(imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_GAIN_BIT)? JAUS_TRUE : JAUS_FALSE; - message->interlacedVideo = jausUnsignedShortIsBitSet(imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_INTERLACED_BIT)? JAUS_TRUE : JAUS_FALSE; - } - - // Audio Control - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FRAME_RATE_BIT)) - { - //unpack - if(!jausUnsignedShortFromBuffer(&audioControl, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - message->audioEnabled = jausUnsignedShortIsBitSet(audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_AUDIO_BIT)? JAUS_TRUE : JAUS_FALSE; - message->audioAutoGain = jausUnsignedShortIsBitSet(audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_AUTO_GAIN_BIT)? JAUS_TRUE : JAUS_FALSE; - message->stereoAudio = jausUnsignedShortIsBitSet(audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_STEREO_BIT)? JAUS_TRUE : JAUS_FALSE; - message->directionalAudio = jausUnsignedShortIsBitSet(audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_DIRECTIONAL_BIT)? JAUS_TRUE : JAUS_FALSE; - message->frontMicrophone = jausUnsignedShortIsBitSet(audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_FRONT_MICROPHONE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->rearMicrophone = jausUnsignedShortIsBitSet(audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_REAR_MICROPHONE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->leftMicrophone = jausUnsignedShortIsBitSet(audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_LEFT_MICROPHONE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->rightMicrophone = jausUnsignedShortIsBitSet(audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_RIGHT_MICROPHONE_BIT)? JAUS_TRUE : JAUS_FALSE; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort = 0; - JausByte tempByte = 0; - JausUnsignedShort imageControl = 0; - JausUnsignedShort audioControl = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - // Presence Vector - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // CameraID - if(!jausByteToBuffer(message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Horizontal FOV - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_HORIZONTAL_FOV_BIT)) - { - // Scaled UShort (0, JAUS_PI) - tempUShort = jausUnsignedShortFromDouble(message->horizontalFovRadians, 0, JAUS_PI); - - //pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Vertical FOV - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_VERTICAL_FOV_BIT)) - { - // Scaled UShort (0, JAUS_PI) - tempUShort = jausUnsignedShortFromDouble(message->verticalFovRadians, 0, JAUS_PI); - - //pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Horizontal Resolution - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_HORIZONTAL_RESOLUTION_BIT)) - { - //pack - if(!jausUnsignedShortToBuffer(message->horizontalResolution, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Vertical Resolution - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_VERTICAL_RESOLUTION_BIT)) - { - //pack - if(!jausUnsignedShortToBuffer(message->verticalResolution, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Focus - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FOCUS_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->focusPercent, 0, 100); - - //pack - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // Iris - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_IRIS_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->irisPercent, 0, 100); - - //pack - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // Gain - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_GAIN_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->gainPercent, 0, 100); - - //pack - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // Frame Rate - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FRAME_RATE_BIT)) - { - //pack - if(!jausUnsignedShortToBuffer(message->frameRate, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Shutter Speed - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FRAME_RATE_BIT)) - { - //pack - if(!jausUnsignedShortToBuffer(message->shutterSpeed, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Image Control - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FRAME_RATE_BIT)) - { - // Clear the imageControl field - imageControl = 0; - - // Setup the imageControl field - if(message->autoFocus) jausUnsignedShortSetBit(&imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_FOCUS_BIT); - if(message->autoIris) jausUnsignedShortSetBit(&imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_IRIS_BIT); - if(message->imageStabilization) jausUnsignedShortSetBit(&imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_IMAGE_STABILIZATION_BIT); - if(message->whiteBalance) jausUnsignedShortSetBit(&imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_WHITE_BALANCE_BIT); - if(message->syncFlash) jausUnsignedShortSetBit(&imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_SYNC_FLASH_BIT); - if(message->redEye) jausUnsignedShortSetBit(&imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_RED_EYE_BIT); - if(message->autoShutter) jausUnsignedShortSetBit(&imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_SHUTTER_BIT); - if(message->videoAutoGain) jausUnsignedShortSetBit(&imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_GAIN_BIT); - if(message->interlacedVideo) jausUnsignedShortSetBit(&imageControl, JAUS_CAMERA_IMAGE_CONTROL_BF_INTERLACED_BIT); - - //pack - if(!jausUnsignedShortToBuffer(imageControl, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Audio Control - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FRAME_RATE_BIT)) - { - // Clear the imageControl field - audioControl = 0; - - if(message->audioEnabled) jausUnsignedShortSetBit(&audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_AUDIO_BIT); - if(message->audioAutoGain) jausUnsignedShortSetBit(&audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_AUTO_GAIN_BIT); - if(message->stereoAudio) jausUnsignedShortSetBit(&audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_STEREO_BIT); - if(message->directionalAudio) jausUnsignedShortSetBit(&audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_DIRECTIONAL_BIT); - if(message->frontMicrophone) jausUnsignedShortSetBit(&audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_FRONT_MICROPHONE_BIT); - if(message->rearMicrophone) jausUnsignedShortSetBit(&audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_REAR_MICROPHONE_BIT); - if(message->leftMicrophone) jausUnsignedShortSetBit(&audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_LEFT_MICROPHONE_BIT); - if(message->rightMicrophone) jausUnsignedShortSetBit(&audioControl, JAUS_CAMERA_AUDIO_CONTROL_BF_RIGHT_MICROPHONE_BIT); - - //pack - if(!jausUnsignedShortToBuffer(audioControl, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetCameraCapabilitiesMessage message) -{ - int index = 0; - - // Presence Vector - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // CameraID - index += JAUS_BYTE_SIZE_BYTES; - - // Horizontal FOV - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_HORIZONTAL_FOV_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Vertical FOV - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_VERTICAL_FOV_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Horizontal Resolution - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_HORIZONTAL_RESOLUTION_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Vertical Resolution - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_VERTICAL_RESOLUTION_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Focus - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FOCUS_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // Iris - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_IRIS_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // Gain - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_GAIN_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // Frame Rate - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FRAME_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Shutter Speed - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FRAME_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Image Control - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FRAME_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Audio Control - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_SET_CAMERA_CAPABILITIES_PV_FRAME_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetCameraCapabilitiesMessage setCameraCapabilitiesMessageCreate(void) -{ - SetCameraCapabilitiesMessage message; - - message = (SetCameraCapabilitiesMessage)malloc( sizeof(SetCameraCapabilitiesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setCameraCapabilitiesMessageDestroy(SetCameraCapabilitiesMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setCameraCapabilitiesMessageFromBuffer(SetCameraCapabilitiesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setCameraCapabilitiesMessageToBuffer(SetCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setCameraCapabilitiesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetCameraCapabilitiesBuffer failed - } - } -} - -SetCameraCapabilitiesMessage setCameraCapabilitiesMessageFromJausMessage(JausMessage jausMessage) -{ - SetCameraCapabilitiesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetCameraCapabilitiesMessage)malloc( sizeof(SetCameraCapabilitiesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setCameraCapabilitiesMessageToJausMessage(SetCameraCapabilitiesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setCameraCapabilitiesMessageSize(SetCameraCapabilitiesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/environment/setCameraFormatOptionsMessage.c b/lib/openjaus/libjaus/src/message/command/environment/setCameraFormatOptionsMessage.c deleted file mode 100644 index ce5c7c56a9bd630332cc871f75fa69c11e523408..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/environment/setCameraFormatOptionsMessage.c +++ /dev/null @@ -1,443 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setCameraFormatOptionsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 03/20/08 -// -// Description: This file defines the functionality of a SetCameraFormatOptionsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_CAMERA_FORMAT_OPTIONS; -static const int maxDataSizeBytes = 8; - -static JausBoolean headerFromBuffer(SetCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetCameraFormatOptionsMessage message); -static void dataDestroy(SetCameraFormatOptionsMessage message); -static unsigned int dataSize(SetCameraFormatOptionsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetCameraFormatOptionsMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->cameraID = newJausByte(0); - message->audioFormat = UnusedAudioFormat; - message->imageFormat = UnusedImageFormat; - message->formatOption = newJausUnsignedInteger(0); -} - -// Destructs the message-specific fields -static void dataDestroy(SetCameraFormatOptionsMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausByte tempByte = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // CameraID - if(!jausByteFromBuffer(&message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // AudioFormat - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_FORMAT_OPTIONS_PV_AUDIO_FORMAT_BIT)) - { - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->audioFormat = tempByte; - } - - // ImageFormat - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_BIT)) - { - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->imageFormat = tempByte; - } - - // FormatOptions - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_FORMAT_OPTIONS_PV_FORMAT_OPTION_BIT)) - { - if(!jausUnsignedIntegerFromBuffer(&message->formatOption, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - // Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // CameraID - if(!jausByteToBuffer(message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // AudioFormat - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_FORMAT_OPTIONS_PV_AUDIO_FORMAT_BIT)) - { - if(!jausByteToBuffer(((JausByte)message->audioFormat), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // AudioFormat - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_BIT)) - { - if(!jausByteToBuffer(((JausByte)message->imageFormat), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // FormatOptions - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_FORMAT_OPTIONS_PV_FORMAT_OPTION_BIT)) - { - if(!jausUnsignedIntegerToBuffer(message->formatOption, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetCameraFormatOptionsMessage message) -{ - int index = 0; - - // Presence Vector - index += JAUS_BYTE_SIZE_BYTES; - - // CameraID - index += JAUS_BYTE_SIZE_BYTES; - - // AudioFormat - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_FORMAT_OPTIONS_PV_AUDIO_FORMAT_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // AudioFormat - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // FormatOptions - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_FORMAT_OPTIONS_PV_FORMAT_OPTION_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetCameraFormatOptionsMessage setCameraFormatOptionsMessageCreate(void) -{ - SetCameraFormatOptionsMessage message; - - message = (SetCameraFormatOptionsMessage)malloc( sizeof(SetCameraFormatOptionsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setCameraFormatOptionsMessageDestroy(SetCameraFormatOptionsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setCameraFormatOptionsMessageFromBuffer(SetCameraFormatOptionsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setCameraFormatOptionsMessageToBuffer(SetCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setCameraFormatOptionsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetCameraFormatOptionsBuffer failed - } - } -} - -SetCameraFormatOptionsMessage setCameraFormatOptionsMessageFromJausMessage(JausMessage jausMessage) -{ - SetCameraFormatOptionsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetCameraFormatOptionsMessage)malloc( sizeof(SetCameraFormatOptionsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setCameraFormatOptionsMessageToJausMessage(SetCameraFormatOptionsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setCameraFormatOptionsMessageSize(SetCameraFormatOptionsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/environment/setCameraPoseMessage.c b/lib/openjaus/libjaus/src/message/command/environment/setCameraPoseMessage.c deleted file mode 100644 index 5b59050f251fc4e6132820cccbf1140de3bf6b88..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/environment/setCameraPoseMessage.c +++ /dev/null @@ -1,586 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setCameraPoseMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetCameraPoseMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_CAMERA_POSE; -static const int maxDataSizeBytes = 15; - -static JausBoolean headerFromBuffer(SetCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetCameraPoseMessage message); -static void dataDestroy(SetCameraPoseMessage message); -static unsigned int dataSize(SetCameraPoseMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetCameraPoseMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->cameraID = newJausByte(0); - message->xLinearMode = POSITION_MODE; - message->yLinearMode = POSITION_MODE; - message->zLinearMode = POSITION_MODE; - message->xAngularMode = POSITION_MODE; - message->yAngularMode = POSITION_MODE; - message->zAngularMode = POSITION_MODE; - message->xLinearPositionOrRatePercent = newJausDouble(0); // Scaled Short (-100, 100) - message->yLinearPositionOrRatePercent = newJausDouble(0); // Scaled Short (-100, 100) - message->zLinearPositionOrRatePercent = newJausDouble(0); // Scaled Short (-100, 100) - message->xAngularPositionOrRatePercent = newJausDouble(0); // Scaled Short (-100, 100) - message->yAngularPositionOrRatePercent = newJausDouble(0); // Scaled Short (-100, 100) - message->zAngularPositionOrRatePercent = newJausDouble(0); // Scaled Short (-100, 100) -} - -// Destructs the message-specific fields -static void dataDestroy(SetCameraPoseMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausShort tempShort = 0; - JausByte tempByte = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Unpack according to presence vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - //cameraID - if(!jausByteFromBuffer(&message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - //modeIndicator - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Setup our local members - message->xLinearMode = jausByteIsBitSet(tempByte, JAUS_CAMERA_POSE_MODE_BF_X_LINEAR_BIT)? RATE_MODE : POSITION_MODE; - message->yLinearMode = jausByteIsBitSet(tempByte, JAUS_CAMERA_POSE_MODE_BF_Y_LINEAR_BIT)? RATE_MODE : POSITION_MODE; - message->zLinearMode = jausByteIsBitSet(tempByte, JAUS_CAMERA_POSE_MODE_BF_Z_LINEAR_BIT)? RATE_MODE : POSITION_MODE; - message->xAngularMode = jausByteIsBitSet(tempByte, JAUS_CAMERA_POSE_MODE_BF_X_ANGULAR_BIT)? RATE_MODE : POSITION_MODE; - message->yAngularMode = jausByteIsBitSet(tempByte, JAUS_CAMERA_POSE_MODE_BF_Y_ANGULAR_BIT)? RATE_MODE : POSITION_MODE; - message->zAngularMode = jausByteIsBitSet(tempByte, JAUS_CAMERA_POSE_MODE_BF_Z_ANGULAR_BIT)? RATE_MODE : POSITION_MODE; - - //xLinearPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_X_LINEAR_BIT)) - { - //unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->xLinearPositionOrRatePercent = jausShortToDouble(tempShort, -100, 100); - } - - //yLinearPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_Y_LINEAR_BIT)) - { - //unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->yLinearPositionOrRatePercent = jausShortToDouble(tempShort, -100, 100); - } - - //zLinearPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_Z_LINEAR_BIT)) - { - //unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->zLinearPositionOrRatePercent = jausShortToDouble(tempShort, -100, 100); - } - - //xAngularPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_X_ANGULAR_BIT)) - { - //unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->xAngularPositionOrRatePercent = jausShortToDouble(tempShort, -100, 100); - } - - //yAngularPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_Y_ANGULAR_BIT)) - { - //unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->yAngularPositionOrRatePercent = jausShortToDouble(tempShort, -100, 100); - } - - //zAngularPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_Z_ANGULAR_BIT)) - { - //unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->zAngularPositionOrRatePercent = jausShortToDouble(tempShort, -100, 100); - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausShort tempShort = 0; - JausByte tempByte = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Pack according to presence vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - //cameraID - if(!jausByteToBuffer(message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - //modeIndicator - tempByte = 0; - if(message->xLinearMode) jausByteSetBit(&tempByte, JAUS_CAMERA_POSE_MODE_BF_X_LINEAR_BIT); - if(message->yLinearMode) jausByteSetBit(&tempByte, JAUS_CAMERA_POSE_MODE_BF_Y_LINEAR_BIT); - if(message->zLinearMode) jausByteSetBit(&tempByte, JAUS_CAMERA_POSE_MODE_BF_Z_LINEAR_BIT); - if(message->xAngularMode) jausByteSetBit(&tempByte, JAUS_CAMERA_POSE_MODE_BF_X_ANGULAR_BIT); - if(message->yAngularMode) jausByteSetBit(&tempByte, JAUS_CAMERA_POSE_MODE_BF_Y_ANGULAR_BIT); - if(message->zAngularMode) jausByteSetBit(&tempByte, JAUS_CAMERA_POSE_MODE_BF_Z_ANGULAR_BIT); - - //pack - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - //xLinearPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_X_LINEAR_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->xLinearPositionOrRatePercent, -100, 100); - - //Pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - //yLinearPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_Y_LINEAR_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->yLinearPositionOrRatePercent, -100, 100); - - //pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - //zLinearPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_Z_LINEAR_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->zLinearPositionOrRatePercent, -100, 100); - - //pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - //xAngularPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_X_ANGULAR_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->xAngularPositionOrRatePercent, -100, 100); - - //pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - //yAngularPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_Y_ANGULAR_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->yAngularPositionOrRatePercent, -100, 100); - - //pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - //zAngularPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_Z_ANGULAR_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->zAngularPositionOrRatePercent, -100, 100); - - //pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetCameraPoseMessage message) -{ - int index = 0; - - // presence vector - index += JAUS_BYTE_SIZE_BYTES; - - //cameraID - index += JAUS_BYTE_SIZE_BYTES; - - //modeIndicator - index += JAUS_BYTE_SIZE_BYTES; - - //xLinearPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_X_LINEAR_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - //yLinearPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_Y_LINEAR_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - //zLinearPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_Z_LINEAR_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - //xAngularPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_X_ANGULAR_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - //yAngularPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_Y_ANGULAR_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - //zAngularPositionOrRatePercent - if(jausByteIsBitSet(message->presenceVector, JAUS_CAMERA_POSE_PV_Z_ANGULAR_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetCameraPoseMessage setCameraPoseMessageCreate(void) -{ - SetCameraPoseMessage message; - - message = (SetCameraPoseMessage)malloc( sizeof(SetCameraPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setCameraPoseMessageDestroy(SetCameraPoseMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setCameraPoseMessageFromBuffer(SetCameraPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setCameraPoseMessageToBuffer(SetCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setCameraPoseMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetCameraPoseBuffer failed - } - } -} - -SetCameraPoseMessage setCameraPoseMessageFromJausMessage(JausMessage jausMessage) -{ - SetCameraPoseMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetCameraPoseMessage)malloc( sizeof(SetCameraPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setCameraPoseMessageToJausMessage(SetCameraPoseMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setCameraPoseMessageSize(SetCameraPoseMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/event/cancelEventMessage.c b/lib/openjaus/libjaus/src/message/command/event/cancelEventMessage.c deleted file mode 100644 index 0fa96d8cbec667d5429f1b134b048e5250dfb13d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/event/cancelEventMessage.c +++ /dev/null @@ -1,407 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: cancelEventMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a CancelEventMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_CANCEL_EVENT; -static const int maxDataSizeBytes = 5; - -static JausBoolean headerFromBuffer(CancelEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(CancelEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(CancelEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(CancelEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(CancelEventMessage message); -static void dataDestroy(CancelEventMessage message); -static unsigned int dataSize(CancelEventMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(CancelEventMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->requestId = newJausByte(0); - message->messageCode = newJausUnsignedShort(0); - message->eventId = newJausByte(0); -} - -// Destructs the message-specific fields -static void dataDestroy(CancelEventMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(CancelEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, CANCEL_EVENT_PV_MESSAGE_CODE_BIT)) - { - // Message Code - if(!jausUnsignedShortFromBuffer(&message->messageCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, CANCEL_EVENT_PV_EVENT_ID_BIT)) - { - // Event Id - if(!jausByteFromBuffer(&message->eventId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(CancelEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, CANCEL_EVENT_PV_MESSAGE_CODE_BIT)) - { - // Message Code - if(!jausUnsignedShortToBuffer(message->messageCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, CANCEL_EVENT_PV_EVENT_ID_BIT)) - { - // Event Id - if(!jausByteToBuffer(message->eventId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - } - - return index; -} - -static unsigned int dataSize(CancelEventMessage message) -{ - int size = 0; - - size += 2 * JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, CANCEL_EVENT_PV_MESSAGE_CODE_BIT)) - { - size += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, CANCEL_EVENT_PV_EVENT_ID_BIT)) - { - size += JAUS_BYTE_SIZE_BYTES; - } - - // Constant Size - return size; -} - - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -CancelEventMessage cancelEventMessageCreate(void) -{ - CancelEventMessage message; - - message = (CancelEventMessage)malloc( sizeof(CancelEventMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void cancelEventMessageDestroy(CancelEventMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean cancelEventMessageFromBuffer(CancelEventMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean cancelEventMessageToBuffer(CancelEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < cancelEventMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToCancelEventBuffer failed - } - } -} - -CancelEventMessage cancelEventMessageFromJausMessage(JausMessage jausMessage) -{ - CancelEventMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (CancelEventMessage)malloc( sizeof(CancelEventMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage cancelEventMessageToJausMessage(CancelEventMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int cancelEventMessageSize(CancelEventMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(CancelEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(CancelEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/event/confirmEventRequestMessage.c b/lib/openjaus/libjaus/src/message/command/event/confirmEventRequestMessage.c deleted file mode 100644 index b5af6d87b751dfe6b429a9e26b3ab7d47a19bd6d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/event/confirmEventRequestMessage.c +++ /dev/null @@ -1,441 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: confirmEventRequestMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ConfirmEventRequestMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_CONFIRM_EVENT_REQUEST; -static const int maxDataSizeBytes = 8; - -static JausBoolean headerFromBuffer(ConfirmEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ConfirmEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ConfirmEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ConfirmEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ConfirmEventRequestMessage message); -static void dataDestroy(ConfirmEventRequestMessage message); -static unsigned int dataSize(ConfirmEventRequestMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ConfirmEventRequestMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); // 1: Presence Vector - message->requestId = newJausByte(0); - message->messageCode = newJausUnsignedShort(0); // 2: Command Code of message sent in case of event occurance - message->eventId = newJausByte(0); // 3: Event Id - message->confirmedUpdateRate = newJausDouble(0); // 4: For Periodic Events, Scaled UnsignedShort (0, 1092) - message->responseCode = newJausByte(0); // 5: Enumeration of Response Types (see above) -} - -// Destructs the message-specific fields -static void dataDestroy(ConfirmEventRequestMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ConfirmEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request ID - if(!jausByteFromBuffer(&message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Message Code - if(!jausUnsignedShortFromBuffer(&message->messageCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Id - if(!jausByteFromBuffer(&message->eventId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, CONFIRM_EVENT_REQUEST_PV_PERIODIC_RATE_BIT)) - { - // Periodic Rate - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Int (0, 1092); - message->confirmedUpdateRate = jausUnsignedShortToDouble(tempUShort, 0, 1092); - } - - // Response Code - if(!jausByteFromBuffer(&message->responseCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ConfirmEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request Id - if(!jausByteToBuffer(message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Message Code - if(!jausUnsignedShortToBuffer(message->messageCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Id - if(!jausByteToBuffer(message->eventId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, CONFIRM_EVENT_REQUEST_PV_PERIODIC_RATE_BIT)) - { - // Scaled Int (0, 1092); - tempUShort = jausUnsignedShortFromDouble(message->confirmedUpdateRate, 0, 1092); - - // Periodic Rate - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Response Code - if(!jausByteToBuffer(message->responseCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ConfirmEventRequestMessage message) -{ - int index = 0; - - // Presence Vector - index += JAUS_BYTE_SIZE_BYTES; - - // Request ID - index += JAUS_BYTE_SIZE_BYTES; - - // Message Code - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Id - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, CONFIRM_EVENT_REQUEST_PV_PERIODIC_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Response Code - index += JAUS_BYTE_SIZE_BYTES; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ConfirmEventRequestMessage confirmEventRequestMessageCreate(void) -{ - ConfirmEventRequestMessage message; - - message = (ConfirmEventRequestMessage)malloc( sizeof(ConfirmEventRequestMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void confirmEventRequestMessageDestroy(ConfirmEventRequestMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean confirmEventRequestMessageFromBuffer(ConfirmEventRequestMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean confirmEventRequestMessageToBuffer(ConfirmEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < confirmEventRequestMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToConfirmEventRequestBuffer failed - } - } -} - -ConfirmEventRequestMessage confirmEventRequestMessageFromJausMessage(JausMessage jausMessage) -{ - ConfirmEventRequestMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ConfirmEventRequestMessage)malloc( sizeof(ConfirmEventRequestMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage confirmEventRequestMessageToJausMessage(ConfirmEventRequestMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int confirmEventRequestMessageSize(ConfirmEventRequestMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ConfirmEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ConfirmEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/event/createEventMessage.c b/lib/openjaus/libjaus/src/message/command/event/createEventMessage.c deleted file mode 100644 index 59a940ce0aaafe42e35796db572b369733c68d50..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/event/createEventMessage.c +++ /dev/null @@ -1,634 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: createEventMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a CreateEventMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_CREATE_EVENT; -static const int maxDataSizeBytes = 512000; // Max Message size: 500K - -static JausBoolean headerFromBuffer(CreateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(CreateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(CreateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(CreateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(CreateEventMessage message); -static void dataDestroy(CreateEventMessage message); -static unsigned int dataSize(CreateEventMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(CreateEventMessage message) -{ - // Set initial values of message fields - - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); // 1: Presence Vector - message->requestId = newJausByte(0); // Local request ID for use in confirm event - message->reportMessageCode = newJausUnsignedShort(0); // Command Code of the resulting report - message->eventType = newJausByte(0); // Enumeration of Event types - message->eventBoundary = newJausByte(0); // Enumeration of Event Boundary Conditions - message->limitDataField = newJausByte(0); // Field from Report for Limit Trigger - message->lowerLimit = jausEventLimitCreate(); // Lower Event Limit - message->lowerLimit->dataType = EVENT_LIMIT_BYTE_TYPE; - message->upperLimit = jausEventLimitCreate(); // Upper Event Limit - message->upperLimit->dataType = EVENT_LIMIT_BYTE_TYPE; - message->stateLimit = jausEventLimitCreate(); // State Event Limit used for Equal Boundary - message->stateLimit->dataType = EVENT_LIMIT_BYTE_TYPE; - message->requestedMinimumRate = newJausDouble(0.0); // For Periodic Events for unchanging value, Scaled UnsignedShort (0, 1092) - message->requestedUpdateRate = newJausDouble(0.0); // For Periodic Events, Scaled UnsignedShort (0, 1092) - message->queryMessage = NULL; // Query Message (not including header) to use for response -} - -// Destructs the message-specific fields -static void dataDestroy(CreateEventMessage message) -{ - // Free message fields - if(message->queryMessage) jausMessageDestroy(message->queryMessage); - if(message->lowerLimit) jausEventLimitDestroy(message->lowerLimit); - if(message->upperLimit) jausEventLimitDestroy(message->upperLimit); - if(message->stateLimit) jausEventLimitDestroy(message->stateLimit); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(CreateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - JausUnsignedInteger queryMessageSize; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request ID - if(!jausByteFromBuffer(&message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Report Message Code - if(!jausUnsignedShortFromBuffer(&message->reportMessageCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Type - if(!jausByteFromBuffer(&message->eventType, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_BOUNDARY_BIT)) - { - // Event Boundary - if(!jausByteFromBuffer(&message->eventBoundary, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_DATA_FIELD_BIT)) - { - // Limit Data Field - if(!jausByteFromBuffer(&message->limitDataField, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_LOWER_LIMIT_BIT)) - { - // Lower Limit - if(!jausEventLimitFromBuffer(&message->lowerLimit, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->lowerLimit); - } - else - { - message->lowerLimit = NULL; - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_UPPER_LIMIT_BIT)) - { - // Upper Limit - if(!jausEventLimitFromBuffer(&message->upperLimit, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->upperLimit); - } - else - { - message->upperLimit = NULL; - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_STATE_LIMIT_BIT)) - { - // State Limit - if(!jausEventLimitFromBuffer(&message->stateLimit, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->stateLimit); - } - else - { - message->stateLimit = NULL; - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_MINIMUM_RATE_BIT)) - { - // Minimum Periodic Rate - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Int (0, 1092); - message->requestedMinimumRate = jausUnsignedShortToDouble(tempUShort, 0, 1092); - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_REQUESTED_RATE_BIT)) - { - // Periodic Rate - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Int (0, 1092); - message->requestedUpdateRate = jausUnsignedShortToDouble(tempUShort, 0, 1092); - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_QUERY_MESSAGE_BIT)) - { - // Query Message Size - if(!jausUnsignedIntegerFromBuffer(&queryMessageSize, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Query Message Body - if(bufferSizeBytes-index < queryMessageSize) return JAUS_FALSE; - - // Setup our Query Message - message->queryMessage = jausMessageCreate(); - if(!message->queryMessage) return JAUS_FALSE; - - message->queryMessage->dataSize = queryMessageSize; - jausAddressCopy(message->queryMessage->source, message->source); - jausAddressCopy(message->queryMessage->destination, message->destination); - - message->queryMessage->commandCode = jausMessageGetComplimentaryCommandCode(message->reportMessageCode); - - // Allocate Memory - message->queryMessage->data = (unsigned char *) malloc(queryMessageSize); - - // Copy query message body to the data member - memcpy(message->queryMessage->data, buffer+index, queryMessageSize); - index += queryMessageSize; - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(CreateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Unpack Message Fields from Buffer - // Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request Id - if(!jausByteToBuffer(message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Message Code - if(!jausUnsignedShortToBuffer(message->reportMessageCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Type - if(!jausByteToBuffer(message->eventType, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_BOUNDARY_BIT)) - { - // Event Boundary - if(!jausByteToBuffer(message->eventBoundary, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_DATA_FIELD_BIT)) - { - // Data Field - if(!jausByteToBuffer(message->limitDataField, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_LOWER_LIMIT_BIT)) - { - // Lower Limit - if(!jausEventLimitToBuffer(message->lowerLimit, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->lowerLimit); - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_UPPER_LIMIT_BIT)) - { - // Upper Limit - if(!jausEventLimitToBuffer(message->upperLimit, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->upperLimit); - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_STATE_LIMIT_BIT)) - { - // State Limit - if(!jausEventLimitToBuffer(message->stateLimit, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->stateLimit); - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_MINIMUM_RATE_BIT)) - { - // Scaled Int (0, 1092); - tempUShort = jausUnsignedShortFromDouble(message->requestedMinimumRate, 0, 1092); - - // Minimum Periodic Rate - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_REQUESTED_RATE_BIT)) - { - // Scaled Int (0, 1092); - tempUShort = jausUnsignedShortFromDouble(message->requestedUpdateRate, 0, 1092); - - // Minimum Periodic Rate - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_QUERY_MESSAGE_BIT)) - { - //Query Message Size - if(message->queryMessage) - { - if(!jausUnsignedIntegerToBuffer(message->queryMessage->dataSize, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Query Message Body - if(bufferSizeBytes-index < message->queryMessage->dataSize) return JAUS_FALSE; - memcpy(buffer+index, message->queryMessage->data, message->queryMessage->dataSize); - index += message->queryMessage->dataSize; - } - else - { - if(!jausUnsignedIntegerToBuffer(0, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(CreateEventMessage message) -{ - int index = 0; - - // Presence Vector - index += JAUS_BYTE_SIZE_BYTES; - - // Request ID - index += JAUS_BYTE_SIZE_BYTES; - - // Message Code - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Type - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_BOUNDARY_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_DATA_FIELD_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_LOWER_LIMIT_BIT)) - { - index += jausEventLimitSize(message->lowerLimit); - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_UPPER_LIMIT_BIT)) - { - index += jausEventLimitSize(message->upperLimit); - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_STATE_LIMIT_BIT)) - { - index += jausEventLimitSize(message->stateLimit); - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_MINIMUM_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_REQUESTED_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, CREATE_EVENT_PV_QUERY_MESSAGE_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Jaus Message - if(message->queryMessage) index += message->queryMessage->dataSize; - } - - - return index; -} - - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -CreateEventMessage createEventMessageCreate(void) -{ - CreateEventMessage message; - - message = (CreateEventMessage)malloc( sizeof(CreateEventMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void createEventMessageDestroy(CreateEventMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); - message = NULL; -} - -JausBoolean createEventMessageFromBuffer(CreateEventMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean createEventMessageToBuffer(CreateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < createEventMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToCreateEventBuffer failed - } - } -} - -CreateEventMessage createEventMessageFromJausMessage(JausMessage jausMessage) -{ - CreateEventMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (CreateEventMessage)malloc( sizeof(CreateEventMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage createEventMessageToJausMessage(CreateEventMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int createEventMessageSize(CreateEventMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(CreateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(CreateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/event/rejectEventRequestMessage.c b/lib/openjaus/libjaus/src/message/command/event/rejectEventRequestMessage.c deleted file mode 100644 index 00fb3646cc76e0edc8c526519b07779d88b802b3..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/event/rejectEventRequestMessage.c +++ /dev/null @@ -1,433 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: rejectEventRequestMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a RejectEventRequestMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REJECT_EVENT_REQUEST; -static const int maxDataSizeBytes = 512000; - -static JausBoolean headerFromBuffer(RejectEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(RejectEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(RejectEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(RejectEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(RejectEventRequestMessage message); -static void dataDestroy(RejectEventRequestMessage message); -static unsigned int dataSize(RejectEventRequestMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(RejectEventRequestMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); // 1: Presence Vector - message->requestId = newJausByte(0); - message->responseCode = newJausByte(0); // 5: Enumeration of Response Types (see above) - message->errorMessage = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(RejectEventRequestMessage message) -{ - // Free message fields - if(message->errorMessage) - { - free(message->errorMessage); - } -} - -// Return boolean of success -static JausBoolean dataFromBuffer(RejectEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request ID - if(!jausByteFromBuffer(&message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Response Code - if(!jausByteFromBuffer(&message->responseCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, REJECT_EVENT_REQUEST_PV_ERROR_MESSAGE_BIT)) - { - if(bufferSizeBytes-index > 0) - { - message->errorMessage = (char *)malloc(bufferSizeBytes-index); - memcpy(message->errorMessage, buffer+index, bufferSizeBytes - index); - if(message->errorMessage[bufferSizeBytes - index - 1]) - { - message->errorMessage = (char *)realloc(message->errorMessage, bufferSizeBytes-index); - message->errorMessage[bufferSizeBytes - index] = '\0'; - } - } - else - { - message->errorMessage = NULL; - } - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(RejectEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request Id - if(!jausByteToBuffer(message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Response Code - if(!jausByteToBuffer(message->responseCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, REJECT_EVENT_REQUEST_PV_ERROR_MESSAGE_BIT)) - { - if(message->errorMessage) - { - memcpy(buffer+index, message->errorMessage, strlen(message->errorMessage)+1); - index += (int) strlen(message->errorMessage)+1; - } - } - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(RejectEventRequestMessage message) -{ - int index = 0; - - // Presence Vector - index += JAUS_BYTE_SIZE_BYTES; - - // Request ID - index += JAUS_BYTE_SIZE_BYTES; - - // Message Code - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Response Code - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, REJECT_EVENT_REQUEST_PV_ERROR_MESSAGE_BIT)) - { - if(message->errorMessage) - { - index += (int) strlen(message->errorMessage)+1; - } - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -RejectEventRequestMessage rejectEventRequestMessageCreate(void) -{ - RejectEventRequestMessage message; - - message = (RejectEventRequestMessage)malloc( sizeof(RejectEventRequestMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void rejectEventRequestMessageDestroy(RejectEventRequestMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean rejectEventRequestMessageFromBuffer(RejectEventRequestMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean rejectEventRequestMessageToBuffer(RejectEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < rejectEventRequestMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToRejectEventRequestBuffer failed - } - } -} - -RejectEventRequestMessage rejectEventRequestMessageFromJausMessage(JausMessage jausMessage) -{ - RejectEventRequestMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (RejectEventRequestMessage)malloc( sizeof(RejectEventRequestMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage rejectEventRequestMessageToJausMessage(RejectEventRequestMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int rejectEventRequestMessageSize(RejectEventRequestMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(RejectEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(RejectEventRequestMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/event/updateEventMessage.c b/lib/openjaus/libjaus/src/message/command/event/updateEventMessage.c deleted file mode 100644 index 6fa96ab646c7aacf3fa2f11f84f0ed7c31eeb8a4..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/event/updateEventMessage.c +++ /dev/null @@ -1,642 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: updateEventMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a UpdateEventMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_UPDATE_EVENT; -static const int maxDataSizeBytes = 512000; // Max Message size: 500K - -static JausBoolean headerFromBuffer(UpdateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(UpdateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(UpdateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(UpdateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(UpdateEventMessage message); -static void dataDestroy(UpdateEventMessage message); -static unsigned int dataSize(UpdateEventMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(UpdateEventMessage message) -{ - // Set initial values of message fields - - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); // 1: Presence Vector - message->requestId = newJausByte (0); // Local request ID for use in confirm event - message->reportMessageCode = newJausUnsignedShort(0); // Command Code of the resulting query - message->eventType = newJausByte(0); // Enumeration of Event types - message->eventBoundary = newJausByte(0); // Enumeration of Event Boundary Conditions - message->limitDataField = newJausByte(0); // Field from Report for Limit Trigger - message->lowerLimit = jausEventLimitCreate(); // Lower Event Limit - message->lowerLimit->dataType = EVENT_LIMIT_BYTE_TYPE; - message->upperLimit = jausEventLimitCreate(); // Upper Event Limit - message->upperLimit->dataType = EVENT_LIMIT_BYTE_TYPE; - message->stateLimit = jausEventLimitCreate(); // State Event Limit used for Equal Boundary - message->stateLimit->dataType = EVENT_LIMIT_BYTE_TYPE; - message->requestedMinimumRate = newJausDouble(0.0); // For Periodic Events for unchanging value, Scaled UnsignedShort (0, 1092) - message->requestedUpdateRate = newJausDouble(0.0); // For Periodic Events, Scaled UnsignedShort (0, 1092) - message->eventId = newJausByte(0); // ID of event to be updated - message->queryMessage = NULL; // Query Message (including header) to use for response -} - -// Destructs the message-specific fields -static void dataDestroy(UpdateEventMessage message) -{ - // Free message fields - if(message->queryMessage) jausMessageDestroy(message->queryMessage); - if(message->lowerLimit) jausEventLimitDestroy(message->lowerLimit); - if(message->upperLimit) jausEventLimitDestroy(message->upperLimit); - if(message->stateLimit) jausEventLimitDestroy(message->stateLimit); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(UpdateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - JausUnsignedInteger queryMessageSize; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request ID - if(!jausByteFromBuffer(&message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Message Code - if(!jausUnsignedShortFromBuffer(&message->reportMessageCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Type - if(!jausByteFromBuffer(&message->eventType, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_BOUNDARY_BIT)) - { - // Event Boundary - if(!jausByteFromBuffer(&message->eventBoundary, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_DATA_FIELD_BIT)) - { - // Data Field - if(!jausByteFromBuffer(&message->limitDataField, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_LOWER_LIMIT_BIT)) - { - // Lower Limit - if(!jausEventLimitFromBuffer(&message->lowerLimit, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->lowerLimit); - } - else - { - message->lowerLimit = NULL; - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_UPPER_LIMIT_BIT)) - { - // Upper Limit - if(!jausEventLimitFromBuffer(&message->upperLimit, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->upperLimit); - } - else - { - message->upperLimit = NULL; - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_STATE_LIMIT_BIT)) - { - // State Limit - if(!jausEventLimitFromBuffer(&message->stateLimit, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->stateLimit); - } - else - { - message->stateLimit = NULL; - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_MINIMUM_RATE_BIT)) - { - // Minimum Periodic Rate - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Int (0, 1092); - message->requestedMinimumRate = jausUnsignedShortToDouble(tempUShort, 0, 1092); - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_REQUESTED_RATE_BIT)) - { - // Periodic Rate - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Int (0, 1092); - message->requestedUpdateRate = jausUnsignedShortToDouble(tempUShort, 0, 1092); - } - - if(!jausByteFromBuffer(&message->eventId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_QUERY_MESSAGE_BIT)) - { - // Query Message Size - if(!jausUnsignedIntegerFromBuffer(&queryMessageSize, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Query Message Body - if(bufferSizeBytes-index < queryMessageSize) return JAUS_FALSE; - - // Setup our Query Message - message->queryMessage = jausMessageCreate(); - if(!message->queryMessage) return JAUS_FALSE; - - message->queryMessage->dataSize = queryMessageSize; - jausAddressCopy(message->queryMessage->source, message->source); - jausAddressCopy(message->queryMessage->destination, message->destination); - - message->queryMessage->commandCode = jausMessageGetComplimentaryCommandCode(message->reportMessageCode); - - // Allocate Memory - message->queryMessage->data = (unsigned char *) malloc(queryMessageSize); - - // Copy query message body to the data member - memcpy(message->queryMessage->data, buffer+index, queryMessageSize); - index += queryMessageSize; - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(UpdateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Unpack Message Fields from Buffer - // Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request Id - if(!jausByteToBuffer(message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Message Code - if(!jausUnsignedShortToBuffer(message->reportMessageCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Type - if(!jausByteToBuffer(message->eventType, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_BOUNDARY_BIT)) - { - // Event Boundary - if(!jausByteToBuffer(message->eventBoundary, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_DATA_FIELD_BIT)) - { - // Data Field - if(!jausByteToBuffer(message->limitDataField, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_LOWER_LIMIT_BIT)) - { - // Lower Limit - if(!jausEventLimitToBuffer(message->lowerLimit, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->lowerLimit); - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_UPPER_LIMIT_BIT)) - { - // Upper Limit - if(!jausEventLimitToBuffer(message->upperLimit, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->upperLimit); - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_STATE_LIMIT_BIT)) - { - // State Limit - if(!jausEventLimitToBuffer(message->stateLimit, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->stateLimit); - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_MINIMUM_RATE_BIT)) - { - // Scaled Int (0, 1092); - tempUShort = jausUnsignedShortFromDouble(message->requestedMinimumRate, 0, 1092); - - // Minimum Periodic Rate - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_REQUESTED_RATE_BIT)) - { - // Scaled Int (0, 1092); - tempUShort = jausUnsignedShortFromDouble(message->requestedUpdateRate, 0, 1092); - - // Minimum Periodic Rate - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(!jausByteToBuffer(message->eventId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_QUERY_MESSAGE_BIT)) - { - if(message->queryMessage) - { - if(!jausUnsignedIntegerToBuffer(message->queryMessage->dataSize, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Query Message Body - if(bufferSizeBytes-index < message->queryMessage->dataSize) return JAUS_FALSE; - memcpy(buffer+index, message->queryMessage->data, message->queryMessage->dataSize); - index += message->queryMessage->dataSize; - } - else - { - if(!jausUnsignedIntegerToBuffer(0, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(UpdateEventMessage message) -{ - int index = 0; - - // Presence Vector - index += JAUS_BYTE_SIZE_BYTES; - - // Request ID - index += JAUS_BYTE_SIZE_BYTES; - - // Message Code - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Type - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_BOUNDARY_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_DATA_FIELD_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_LOWER_LIMIT_BIT)) - { - index += jausEventLimitSize(message->lowerLimit); - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_UPPER_LIMIT_BIT)) - { - index += jausEventLimitSize(message->upperLimit); - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_STATE_LIMIT_BIT)) - { - index += jausEventLimitSize(message->stateLimit); - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_MINIMUM_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_REQUESTED_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Event ID - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, UPDATE_EVENT_PV_QUERY_MESSAGE_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Jaus Message - if(message->queryMessage) index += message->queryMessage->dataSize; - } - - - return index; -} - - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -UpdateEventMessage updateEventMessageCreate(void) -{ - UpdateEventMessage message; - - message = (UpdateEventMessage)malloc( sizeof(UpdateEventMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void updateEventMessageDestroy(UpdateEventMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); - message = NULL; -} - -JausBoolean updateEventMessageFromBuffer(UpdateEventMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean updateEventMessageToBuffer(UpdateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < updateEventMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToUpdateEventBuffer failed - } - } -} - -UpdateEventMessage updateEventMessageFromJausMessage(JausMessage jausMessage) -{ - UpdateEventMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (UpdateEventMessage)malloc( sizeof(UpdateEventMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage updateEventMessageToJausMessage(UpdateEventMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int updateEventMessageSize(UpdateEventMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(UpdateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(UpdateEventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/manipulator/setEndEffectorPathMotionMessage.c b/lib/openjaus/libjaus/src/message/command/manipulator/setEndEffectorPathMotionMessage.c deleted file mode 100644 index 1f80f271a01e31464370a1f73d53725618be9e8d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/manipulator/setEndEffectorPathMotionMessage.c +++ /dev/null @@ -1,499 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setEndEffectorPathMotionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetEndEffectorPathMotionMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_END_EFFECTOR_PATH_MOTION; -static const int maxDataSizeBytes = 4096; - -static JausBoolean headerFromBuffer(SetEndEffectorPathMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetEndEffectorPathMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetEndEffectorPathMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetEndEffectorPathMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetEndEffectorPathMotionMessage message); -static void dataDestroy(SetEndEffectorPathMotionMessage message); -static unsigned int dataSize(SetEndEffectorPathMotionMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetEndEffectorPathMotionMessage message) -{ - // Set initial values of message fields - message->numPoses = newJausByte(0); - message->poseTime = NULL; - message->x = NULL; - message->y = NULL; - message->z = NULL; - message->a = NULL; - message->b = NULL; - message->c = NULL; - message->d = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(SetEndEffectorPathMotionMessage message) -{ - // Free message fields - if(message->poseTime != NULL) - { - free(message->poseTime); - } - - if(message->x != NULL) - { - free(message->x); - } - - if(message->y != NULL) - { - free(message->y); - } - - if(message->z != NULL) - { - free(message->z); - } - - if(message->a != NULL) - { - free(message->a); - } - - if(message->b != NULL) - { - free(message->b); - } - - if(message->c != NULL) - { - free(message->c); - } - - if(message->d != NULL) - { - free(message->d); - } -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetEndEffectorPathMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int pose; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - if(!jausByteFromBuffer(&message->numPoses, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->poseTime = (JausDouble *)malloc(sizeof(JausDouble)*message->numPoses); - message->x = (JausDouble *)malloc(sizeof(JausDouble)*message->numPoses); - message->y = (JausDouble *)malloc(sizeof(JausDouble)*message->numPoses); - message->z = (JausDouble *)malloc(sizeof(JausDouble)*message->numPoses); - message->a = (JausDouble *)malloc(sizeof(JausDouble)*message->numPoses); - message->b = (JausDouble *)malloc(sizeof(JausDouble)*message->numPoses); - message->c = (JausDouble *)malloc(sizeof(JausDouble)*message->numPoses); - message->d = (JausDouble *)malloc(sizeof(JausDouble)*message->numPoses); - - for(pose=0; posenumPoses; pose++) - { - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - message->poseTime[pose] = jausUnsignedIntegerToDouble(tempUInt, 0, 6000); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-30, 30) - message->x[pose] = jausUnsignedIntegerToDouble(tempUInt, -30, 30); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-30, 30) - message->y[pose] = jausUnsignedIntegerToDouble(tempUInt, -30, 30); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-30, 30) - message->z[pose] = jausUnsignedIntegerToDouble(tempUInt, -30, 30); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-1, 1) - message->d[pose] = jausUnsignedIntegerToDouble(tempUInt, -1, 1); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-30, 30) - message->a[pose] = jausUnsignedIntegerToDouble(tempUInt, -1, 1); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-1, 1) - message->b[pose] = jausUnsignedIntegerToDouble(tempUInt, -1, 1); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-1, 1) - message->c[pose] = jausUnsignedIntegerToDouble(tempUInt, -1, 1); - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetEndEffectorPathMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int pose; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->numPoses, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(pose=0; posenumPoses; pose++) - { - tempUInt = jausUnsignedIntegerFromDouble(message->poseTime[pose], 0, 6000); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->x[pose], -30, 30); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->y[pose], -30, 30); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->z[pose], -30, 30); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->d[pose], -1, 1); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->a[pose], -1, 1); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->b[pose], -1, 1); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->c[pose], -1, 1); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetEndEffectorPathMotionMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += 8 * JAUS_UNSIGNED_INTEGER_SIZE_BYTES * message->numPoses; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetEndEffectorPathMotionMessage setEndEffectorPathMotionMessageCreate(void) -{ - SetEndEffectorPathMotionMessage message; - - message = (SetEndEffectorPathMotionMessage)malloc( sizeof(SetEndEffectorPathMotionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setEndEffectorPathMotionMessageDestroy(SetEndEffectorPathMotionMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setEndEffectorPathMotionMessageFromBuffer(SetEndEffectorPathMotionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setEndEffectorPathMotionMessageToBuffer(SetEndEffectorPathMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setEndEffectorPathMotionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -SetEndEffectorPathMotionMessage setEndEffectorPathMotionMessageFromJausMessage(JausMessage jausMessage) -{ - SetEndEffectorPathMotionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetEndEffectorPathMotionMessage)malloc( sizeof(SetEndEffectorPathMotionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setEndEffectorPathMotionMessageToJausMessage(SetEndEffectorPathMotionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setEndEffectorPathMotionMessageSize(SetEndEffectorPathMotionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetEndEffectorPathMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetEndEffectorPathMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/manipulator/setEndEffectorPoseMessage.c b/lib/openjaus/libjaus/src/message/command/manipulator/setEndEffectorPoseMessage.c deleted file mode 100644 index b8c30069e69bf2db4f3d2ab2c529f6b2f1f4c690..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/manipulator/setEndEffectorPoseMessage.c +++ /dev/null @@ -1,421 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setEndEffectorPoseMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetEndEffectorPoseMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_END_EFFECTOR_POSE; -static const int maxDataSizeBytes = 28; - -static JausBoolean headerFromBuffer(SetEndEffectorPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetEndEffectorPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetEndEffectorPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetEndEffectorPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetEndEffectorPoseMessage message); -static void dataDestroy(SetEndEffectorPoseMessage message); -static unsigned int dataSize(SetEndEffectorPoseMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetEndEffectorPoseMessage message) -{ - // Set initial values of message fields - message->x = newJausDouble(0); - message->y = newJausDouble(0); - message->z = newJausDouble(0); - message->a = newJausDouble(0); - message->b = newJausDouble(0); - message->c = newJausDouble(0); - message->d = newJausDouble(0); -} - -// Destructs the message-specific fields -static void dataDestroy(SetEndEffectorPoseMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetEndEffectorPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-30, 30) - message->x = jausUnsignedIntegerToDouble(tempUInt, -30, 30); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-30, 30) - message->y = jausUnsignedIntegerToDouble(tempUInt, -30, 30); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-30, 30) - message->z = jausUnsignedIntegerToDouble(tempUInt, -30, 30); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-1, 1) - message->d = jausUnsignedIntegerToDouble(tempUInt, -1, 1); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-30, 30) - message->a = jausUnsignedIntegerToDouble(tempUInt, -1, 1); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-1, 1) - message->b = jausUnsignedIntegerToDouble(tempUInt, -1, 1); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-1, 1) - message->c = jausUnsignedIntegerToDouble(tempUInt, -1, 1); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetEndEffectorPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Scaled Short (-30, 30) - tempUInt = jausUnsignedIntegerFromDouble(message->x, -30, 30); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->y, -30, 30); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->z, -30, 30); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->d, -1, 1); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->a, -1, 1); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->b, -1, 1); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->c, -1, 1); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetEndEffectorPoseMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetEndEffectorPoseMessage setEndEffectorPoseMessageCreate(void) -{ - SetEndEffectorPoseMessage message; - - message = (SetEndEffectorPoseMessage)malloc( sizeof(SetEndEffectorPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setEndEffectorPoseMessageDestroy(SetEndEffectorPoseMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setEndEffectorPoseMessageFromBuffer(SetEndEffectorPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setEndEffectorPoseMessageToBuffer(SetEndEffectorPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setEndEffectorPoseMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -SetEndEffectorPoseMessage setEndEffectorPoseMessageFromJausMessage(JausMessage jausMessage) -{ - SetEndEffectorPoseMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetEndEffectorPoseMessage)malloc( sizeof(SetEndEffectorPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setEndEffectorPoseMessageToJausMessage(SetEndEffectorPoseMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setEndEffectorPoseMessageSize(SetEndEffectorPoseMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetEndEffectorPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetEndEffectorPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/manipulator/setEndEffectorVelocityStateMessage.c b/lib/openjaus/libjaus/src/message/command/manipulator/setEndEffectorVelocityStateMessage.c deleted file mode 100644 index a1e4c5e666345423abfbc8113de5f242adc0e65a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/manipulator/setEndEffectorVelocityStateMessage.c +++ /dev/null @@ -1,420 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURVELOCITY_STATE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setEndEffectorVelocityStateMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetEndEffectorVelocityStateMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_END_EFFECTOR_VELOCITY_STATE; -static const int maxDataSizeBytes = 25; - -static JausBoolean headerFromBuffer(SetEndEffectorVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetEndEffectorVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetEndEffectorVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetEndEffectorVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetEndEffectorVelocityStateMessage message); -static void dataDestroy(SetEndEffectorVelocityStateMessage message); -static unsigned int dataSize(SetEndEffectorVelocityStateMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetEndEffectorVelocityStateMessage message) -{ - // Set initial values of message fields - message->coordinateSystem = newJausByte(0); - message->xAngular = newJausDouble(0); - message->yAngular = newJausDouble(0); - message->zAngular = newJausDouble(0); - message->xLinear = newJausDouble(0); - message->yLinear = newJausDouble(0); - message->zLinear = newJausDouble(0); -} - -// Destructs the message-specific fields -static void dataDestroy(SetEndEffectorVelocityStateMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetEndEffectorVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->coordinateSystem, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-20*JAUS_PI, 20*JAUS_PI) - message->xAngular = jausUnsignedIntegerToDouble(tempUInt, -20*JAUS_PI, 20*JAUS_PI); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-20*JAUS_PI, 20*JAUS_PI) - message->yAngular = jausUnsignedIntegerToDouble(tempUInt, -20*JAUS_PI, 20*JAUS_PI); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-20*JAUS_PI, 20*JAUS_PI) - message->zAngular = jausUnsignedIntegerToDouble(tempUInt, -20*JAUS_PI, 20*JAUS_PI); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-10, 10) - message->xLinear = jausUnsignedIntegerToDouble(tempUInt, -10, 10); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-10, 10) - message->yLinear = jausUnsignedIntegerToDouble(tempUInt, -10, 10); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-10, 10) - message->zLinear = jausUnsignedIntegerToDouble(tempUInt, -10, 10); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetEndEffectorVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->coordinateSystem, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Short (-20*JAUS_PI, 20*JAUS_PI) - tempUInt = jausUnsignedIntegerFromDouble(message->xAngular, -20*JAUS_PI, 20*JAUS_PI); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->yAngular, -20*JAUS_PI, 20*JAUS_PI); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->zAngular, -20*JAUS_PI, 20*JAUS_PI); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Scaled Short (-10, 10) - tempUInt = jausUnsignedIntegerFromDouble(message->xLinear, -10, 10); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->yLinear, -10, 10); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->zLinear, -10, 10); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetEndEffectorVelocityStateMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetEndEffectorVelocityStateMessage setEndEffectorVelocityStateMessageCreate(void) -{ - SetEndEffectorVelocityStateMessage message; - - message = (SetEndEffectorVelocityStateMessage)malloc( sizeof(SetEndEffectorVelocityStateMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setEndEffectorVelocityStateMessageDestroy(SetEndEffectorVelocityStateMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setEndEffectorVelocityStateMessageFromBuffer(SetEndEffectorVelocityStateMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setEndEffectorVelocityStateMessageToBuffer(SetEndEffectorVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setEndEffectorVelocityStateMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -SetEndEffectorVelocityStateMessage setEndEffectorVelocityStateMessageFromJausMessage(JausMessage jausMessage) -{ - SetEndEffectorVelocityStateMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetEndEffectorVelocityStateMessage)malloc( sizeof(SetEndEffectorVelocityStateMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setEndEffectorVelocityStateMessageToJausMessage(SetEndEffectorVelocityStateMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setEndEffectorVelocityStateMessageSize(SetEndEffectorVelocityStateMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetEndEffectorVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetEndEffectorVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/manipulator/setJointEffortsMessage.c b/lib/openjaus/libjaus/src/message/command/manipulator/setJointEffortsMessage.c deleted file mode 100644 index 4474dac06e16d543356a1c2f4aca2c3eb4ef5851..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/manipulator/setJointEffortsMessage.c +++ /dev/null @@ -1,390 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setJointEffortsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetJointEffortsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_JOINT_EFFORTS; -static const int maxDataSizeBytes = 4096; - -static JausBoolean headerFromBuffer(SetJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetJointEffortsMessage message); -static void dataDestroy(SetJointEffortsMessage message); -static unsigned int dataSize(SetJointEffortsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetJointEffortsMessage message) -{ - // Set initial values of message fields - message->numJoints = newJausByte(0); - message->jointEffort = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(SetJointEffortsMessage message) -{ - // Free message fields - if(message->jointEffort != NULL) - { - free(message->jointEffort); - } -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - if(!jausByteFromBuffer(&message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->jointEffort = (JausDouble *)malloc(sizeof(JausDouble)*message->numJoints); - - for(i=0; inumJoints; i++) - { - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - // Scaled Short (-100, 100) - message->jointEffort[i] = jausUnsignedShortToDouble(tempUShort, -100, 100); - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i=0; inumJoints; i++) - { - // Scaled Short (-100, 100) - tempUShort = jausUnsignedShortFromDouble(message->jointEffort[i], -100, 100); - - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetJointEffortsMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES * message->numJoints; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetJointEffortsMessage setJointEffortsMessageCreate(void) -{ - SetJointEffortsMessage message; - - message = (SetJointEffortsMessage)malloc( sizeof(SetJointEffortsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setJointEffortsMessageDestroy(SetJointEffortsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setJointEffortsMessageFromBuffer(SetJointEffortsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setJointEffortsMessageToBuffer(SetJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setJointEffortsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -SetJointEffortsMessage setJointEffortsMessageFromJausMessage(JausMessage jausMessage) -{ - SetJointEffortsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetJointEffortsMessage)malloc( sizeof(SetJointEffortsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setJointEffortsMessageToJausMessage(SetJointEffortsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setJointEffortsMessageSize(SetJointEffortsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/manipulator/setJointMotionMessage.c b/lib/openjaus/libjaus/src/message/command/manipulator/setJointMotionMessage.c deleted file mode 100644 index 8ef9b4211db7e97facb5d9ffc2f5f42abb9de6e7..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/manipulator/setJointMotionMessage.c +++ /dev/null @@ -1,467 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setJointMotionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetJointMotionMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_JOINT_MOTION; -static const int maxDataSizeBytes = 4096; - -static JausBoolean headerFromBuffer(SetJointMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetJointMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetJointMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetJointMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetJointMotionMessage message); -static void dataDestroy(SetJointMotionMessage message); -static unsigned int dataSize(SetJointMotionMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetJointMotionMessage message) -{ - // Set initial values of message fields - message->numJoints = newJausByte(0); - message->numPoses = newJausByte(0); - message->poseTime = NULL; - message->position = NULL; - message->maxVelocity = NULL; - message->maxAcceleration = NULL; - message->maxDeceleration = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(SetJointMotionMessage message) -{ - // Free message fields - if(message->poseTime != NULL) - { - free(message->poseTime); - } - - if(message->position != NULL) - { - free(message->position); - } - - if(message->maxVelocity != NULL) - { - free(message->maxVelocity); - } - - if(message->maxAcceleration != NULL) - { - free(message->maxAcceleration); - } - - if(message->maxDeceleration != NULL) - { - free(message->maxDeceleration); - } - -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetJointMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int pose; - int joint; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - if(!jausByteFromBuffer(&message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->numPoses, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->poseTime = (JausDouble *)malloc(sizeof(JausDouble)*message->numPoses); - message->position = (JausDouble **)malloc(sizeof(JausDouble) * message->numJoints * message->numPoses); - message->maxVelocity = (JausDouble **)malloc(sizeof(JausDouble) * message->numJoints * message->numPoses); - message->maxAcceleration = (JausDouble **)malloc(sizeof(JausDouble) * message->numJoints * message->numPoses); - message->maxDeceleration = (JausDouble **)malloc(sizeof(JausDouble) * message->numJoints * message->numPoses); - - for(pose=0; posenumPoses; pose++) - { - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - message->poseTime[pose] = jausUnsignedIntegerToDouble(tempUInt, 0, 6000); - - for(joint=0; jointnumJoints; joint++) - { - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - message->position[pose][joint] = jausUnsignedIntegerToDouble(tempUInt, -8*JAUS_PI, 8*JAUS_PI); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - message->maxVelocity[pose][joint] = jausUnsignedIntegerToDouble(tempUInt, -10*JAUS_PI, 10*JAUS_PI); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - message->maxAcceleration[pose][joint] = jausUnsignedIntegerToDouble(tempUInt, -10*JAUS_PI, 10*JAUS_PI); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - message->maxDeceleration[pose][joint] = jausUnsignedIntegerToDouble(tempUInt, -10*JAUS_PI, 10*JAUS_PI); - - } - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetJointMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int pose; - int joint; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(message->numPoses, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(pose=0; posenumPoses; pose++) - { - tempUInt = jausUnsignedIntegerFromDouble(message->poseTime[pose], 0, 6000); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - for(joint=0; jointnumJoints; joint++) - { - tempUInt = jausUnsignedIntegerFromDouble(message->position[pose][joint], -8*JAUS_PI, 8*JAUS_PI); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->maxVelocity[pose][joint], -10*JAUS_PI, 10*JAUS_PI); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->maxAcceleration[pose][joint], -10*JAUS_PI, 10*JAUS_PI); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->maxDeceleration[pose][joint], -10*JAUS_PI, 10*JAUS_PI); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - } - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetJointMotionMessage message) -{ - int index = 0; - - index += 2 * JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES * message->numPoses; - - index += 4 * JAUS_UNSIGNED_INTEGER_SIZE_BYTES * message->numPoses * message->numJoints; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetJointMotionMessage setJointMotionMessageCreate(void) -{ - SetJointMotionMessage message; - - message = (SetJointMotionMessage)malloc( sizeof(SetJointMotionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setJointMotionMessageDestroy(SetJointMotionMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setJointMotionMessageFromBuffer(SetJointMotionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setJointMotionMessageToBuffer(SetJointMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setJointMotionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -SetJointMotionMessage setJointMotionMessageFromJausMessage(JausMessage jausMessage) -{ - SetJointMotionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetJointMotionMessage)malloc( sizeof(SetJointMotionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setJointMotionMessageToJausMessage(SetJointMotionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setJointMotionMessageSize(SetJointMotionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetJointMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetJointMotionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/manipulator/setJointPositionsMessage.c b/lib/openjaus/libjaus/src/message/command/manipulator/setJointPositionsMessage.c deleted file mode 100644 index b5c3e35333304d4ed937d849e933fa65c8b7f7e1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/manipulator/setJointPositionsMessage.c +++ /dev/null @@ -1,390 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setJointPositionsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetJointPositionsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_JOINT_POSITIONS; -static const int maxDataSizeBytes = 4096; - -static JausBoolean headerFromBuffer(SetJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetJointPositionsMessage message); -static void dataDestroy(SetJointPositionsMessage message); -static unsigned int dataSize(SetJointPositionsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetJointPositionsMessage message) -{ - // Set initial values of message fields - message->numJoints = newJausByte(0); - message->jointPosition = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(SetJointPositionsMessage message) -{ - // Free message fields - if(message->jointPosition != NULL) - { - free(message->jointPosition); - } -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - if(!jausByteFromBuffer(&message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->jointPosition = (JausDouble *)malloc(sizeof(JausDouble)*message->numJoints); - - for(i=0; inumJoints; i++) - { - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-8*JAUS_PI, 8*JAUS_PI) - message->jointPosition[i] = jausUnsignedIntegerToDouble(tempUInt, -8*JAUS_PI, 8*JAUS_PI); - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i=0; inumJoints; i++) - { - // Scaled Short (-8*JAUS_PI, 8*JAUS_PI) - tempUInt = jausUnsignedIntegerFromDouble(message->jointPosition[i], -8*JAUS_PI, 8*JAUS_PI); - - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetJointPositionsMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES * message->numJoints; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetJointPositionsMessage setJointPositionsMessageCreate(void) -{ - SetJointPositionsMessage message; - - message = (SetJointPositionsMessage)malloc( sizeof(SetJointPositionsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setJointPositionsMessageDestroy(SetJointPositionsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setJointPositionsMessageFromBuffer(SetJointPositionsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setJointPositionsMessageToBuffer(SetJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setJointPositionsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -SetJointPositionsMessage setJointPositionsMessageFromJausMessage(JausMessage jausMessage) -{ - SetJointPositionsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetJointPositionsMessage)malloc( sizeof(SetJointPositionsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setJointPositionsMessageToJausMessage(SetJointPositionsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setJointPositionsMessageSize(SetJointPositionsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/manipulator/setJointVelocitiesMessage.c b/lib/openjaus/libjaus/src/message/command/manipulator/setJointVelocitiesMessage.c deleted file mode 100644 index bef1b19d5705de0a7cfde8bb2ff85cbe582d71aa..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/manipulator/setJointVelocitiesMessage.c +++ /dev/null @@ -1,390 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setJointVelocitiesMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetJointVelocitiesMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_JOINT_VELOCITIES; -static const int maxDataSizeBytes = 4096; - -static JausBoolean headerFromBuffer(SetJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetJointVelocitiesMessage message); -static void dataDestroy(SetJointVelocitiesMessage message); -static unsigned int dataSize(SetJointVelocitiesMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetJointVelocitiesMessage message) -{ - // Set initial values of message fields - message->numJoints = newJausByte(0); - message->jointVelocity = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(SetJointVelocitiesMessage message) -{ - // Free message fields - if(message->jointVelocity != NULL) - { - free(message->jointVelocity); - } -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - if(!jausByteFromBuffer(&message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->jointVelocity = (JausDouble *)malloc(sizeof(JausDouble)*message->numJoints); - - for(i=0; inumJoints; i++) - { - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-10*JAUS_PI, 10*JAUS_PI) - message->jointVelocity[i] = jausUnsignedIntegerToDouble(tempUInt, -10*JAUS_PI, 10*JAUS_PI); - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i=0; inumJoints; i++) - { - // Scaled Short (-10*JAUS_PI, 10*JAUS_PI) - tempUInt = jausUnsignedIntegerFromDouble(message->jointVelocity[i], -10*JAUS_PI, 10*JAUS_PI); - - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetJointVelocitiesMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES * message->numJoints; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetJointVelocitiesMessage setJointVelocitiesMessageCreate(void) -{ - SetJointVelocitiesMessage message; - - message = (SetJointVelocitiesMessage)malloc( sizeof(SetJointVelocitiesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setJointVelocitiesMessageDestroy(SetJointVelocitiesMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setJointVelocitiesMessageFromBuffer(SetJointVelocitiesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setJointVelocitiesMessageToBuffer(SetJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setJointVelocitiesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -SetJointVelocitiesMessage setJointVelocitiesMessageFromJausMessage(JausMessage jausMessage) -{ - SetJointVelocitiesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetJointVelocitiesMessage)malloc( sizeof(SetJointVelocitiesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setJointVelocitiesMessageToJausMessage(SetJointVelocitiesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setJointVelocitiesMessageSize(SetJointVelocitiesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/manipulator/setToolPointMessage.c b/lib/openjaus/libjaus/src/message/command/manipulator/setToolPointMessage.c deleted file mode 100644 index 867941cb54c3fc5a8ae3f9728cc08f1311d20f28..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/manipulator/setToolPointMessage.c +++ /dev/null @@ -1,381 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setToolPointMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetToolPointMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_TOOL_POINT; -static const int maxDataSizeBytes = 12; - -static JausBoolean headerFromBuffer(SetToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetToolPointMessage message); -static void dataDestroy(SetToolPointMessage message); -static unsigned int dataSize(SetToolPointMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetToolPointMessage message) -{ - // Set initial values of message fields - message->x = newJausDouble(0); - message->y = newJausDouble(0); - message->z = newJausDouble(0); -} - -// Destructs the message-specific fields -static void dataDestroy(SetToolPointMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-15, 15) - message->x = jausUnsignedIntegerToDouble(tempUInt, -15, 15); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-15, 15) - message->y = jausUnsignedIntegerToDouble(tempUInt, -15, 15); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-15, 15) - message->z = jausUnsignedIntegerToDouble(tempUInt, -15, 15); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Scaled Short (-15, 15) - tempUInt = jausUnsignedIntegerFromDouble(message->x, -15, 15); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->y, -15, 15); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->z, -15, 15); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetToolPointMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetToolPointMessage setToolPointMessageCreate(void) -{ - SetToolPointMessage message; - - message = (SetToolPointMessage)malloc( sizeof(SetToolPointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setToolPointMessageDestroy(SetToolPointMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setToolPointMessageFromBuffer(SetToolPointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setToolPointMessageToBuffer(SetToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setToolPointMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -SetToolPointMessage setToolPointMessageFromJausMessage(JausMessage jausMessage) -{ - SetToolPointMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetToolPointMessage)malloc( sizeof(SetToolPointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setToolPointMessageToJausMessage(SetToolPointMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setToolPointMessageSize(SetToolPointMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/payload/setPayloadDataElementMessage.c b/lib/openjaus/libjaus/src/message/command/payload/setPayloadDataElementMessage.c deleted file mode 100644 index 9d29cae04ca7189397f5707816f9ae6629ac4e65..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/payload/setPayloadDataElementMessage.c +++ /dev/null @@ -1,442 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setPayloadDataElementMessage.c -// -// Written By: Bob Toucthon -// -// Version: 3.3.0a -// -// Date: // Date: 3/27/06 -// -// This file defines the functionality of a setPayloadDataElementMessage -// NOTE WELL: this message will also be used for general purpose information exchange - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_PAYLOAD_DATA_ELEMENT; -static const int maxDataSizeBytes = 512000; - -static JausBoolean headerFromBuffer(SetPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetPayloadDataElementMessage message); -static void dataDestroy(SetPayloadDataElementMessage message); -static unsigned int dataSize(SetPayloadDataElementMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetPayloadDataElementMessage message) -{ - // Set initial values of message fields - message->jausPayloadInterface = NULL; - message->numberInterfaces = 0; - message->indexes = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(SetPayloadDataElementMessage message) -{ - // Free message fields - if(!message->indexes) free(message->indexes); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0, i = 0; - JausByte payloadCommandDataElementCount = 0; - JausByte commandInterfaceNumber; - JausCommandInterface commandInterface = NULL; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // # payload interfaces - if(!jausByteFromBuffer(&payloadCommandDataElementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - if(!payloadCommandDataElementCount) return JAUS_FALSE; // nothing to do - - index += JAUS_BYTE_SIZE_BYTES; - message->numberInterfaces = payloadCommandDataElementCount; - message->indexes = (int *)malloc(payloadCommandDataElementCount * sizeof(int)); - - for(i = 0; i < payloadCommandDataElementCount; i++) - { - // unpack payloadDataElement Index number (indexing starts at 1) - if(!jausByteFromBuffer(&commandInterfaceNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - message->indexes[i] = commandInterfaceNumber; - - // get command interface for the current # - if(message->jausPayloadInterface && (message->jausPayloadInterface->jausCommandInterfaces->elementCount >= commandInterfaceNumber) ) - { - commandInterface = (JausCommandInterface) message->jausPayloadInterface->jausCommandInterfaces->elementData[commandInterfaceNumber - 1]; - } - - // unpack and set payloadDataElement's value - if(!jausCommandValueFromBuffer(commandInterface, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausCommandValueSizeBytes(commandInterface); - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i = 0; - JausByte payloadCommandDataElementCount = 0; - int commandInterfaceNumber = 0; - JausCommandInterface commandInterface = NULL; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // # payload interfaces - payloadCommandDataElementCount = message->numberInterfaces; - if(!payloadCommandDataElementCount) return JAUS_FALSE; // nothing to do - - if(!jausByteToBuffer(payloadCommandDataElementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i = 0; i < payloadCommandDataElementCount; i++) - { - // get payloadDataElement identifier - - // get/pack payloadDataElement index - commandInterfaceNumber = message->indexes[i]; - if(message->jausPayloadInterface && (message->jausPayloadInterface->jausCommandInterfaces->elementCount >= commandInterfaceNumber) ) - { - if(!jausByteToBuffer(commandInterfaceNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - else return JAUS_FALSE; - - // get corresponding commandInterface - commandInterface = (JausCommandInterface) message->jausPayloadInterface->jausCommandInterfaces->elementData[commandInterfaceNumber - 1]; - // get/pack payloadDataElement's value - if(!jausCommandValueToBuffer(commandInterface, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausCommandValueSizeBytes(commandInterface); - } - } - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetPayloadDataElementMessage message) -{ - int index = 0; - int i = 0; - JausByte payloadCommandDataElementCount = 0; - int commandInterfaceNumber = 0; - JausCommandInterface commandInterface = NULL; - - // # payload interfaces - payloadCommandDataElementCount = message->numberInterfaces; - if(!payloadCommandDataElementCount) return JAUS_FALSE; // nothing to do - - index += JAUS_BYTE_SIZE_BYTES; - - for(i = 0; i < payloadCommandDataElementCount; i++) - { - // get payloadDataElement identifier - - // get/pack payloadDataElement index - commandInterfaceNumber = message->indexes[i]; - if(message->jausPayloadInterface && (message->jausPayloadInterface->jausCommandInterfaces->elementCount >= commandInterfaceNumber) ) - { - index += JAUS_BYTE_SIZE_BYTES; - } - else return JAUS_FALSE; - - // get corresponding commandInterface - commandInterface = (JausCommandInterface) message->jausPayloadInterface->jausCommandInterfaces->elementData[commandInterfaceNumber - 1]; - index += jausCommandValueSizeBytes(commandInterface); - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetPayloadDataElementMessage setPayloadDataElementMessageCreate(void) -{ - SetPayloadDataElementMessage message; - - message = (SetPayloadDataElementMessage)malloc( sizeof(SetPayloadDataElementMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setPayloadDataElementMessageDestroy(SetPayloadDataElementMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setPayloadDataElementMessageFromBuffer(SetPayloadDataElementMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setPayloadDataElementMessageToBuffer(SetPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setPayloadDataElementMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetPayloadDataElementBuffer failed - } - } -} - -SetPayloadDataElementMessage setPayloadDataElementMessageFromJausMessage(JausMessage jausMessage, JausPayloadInterface pI) -{ - SetPayloadDataElementMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetPayloadDataElementMessage)malloc( sizeof(SetPayloadDataElementMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - message->jausPayloadInterface = pI; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setPayloadDataElementMessageToJausMessage(SetPayloadDataElementMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setPayloadDataElementMessageSize(SetPayloadDataElementMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/planning/abortMissionMessage.c b/lib/openjaus/libjaus/src/message/command/planning/abortMissionMessage.c deleted file mode 100644 index d6931f0a329e21ebc8863c700876c0b2ed602b0f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/planning/abortMissionMessage.c +++ /dev/null @@ -1,387 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: abortMissionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo -// AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a AbortMissionMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/9/08 - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_ABORT_MISSION; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(AbortMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(AbortMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(AbortMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(AbortMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(AbortMissionMessage message); -static void dataDestroy(AbortMissionMessage message); -static unsigned int dataSize(AbortMissionMessage message); - -// ************************************************************************* // -// USER CONFIGURED FUNCTIONS -// ************************************************************************* // - -// Initializes the message-specific fields -static void dataInitialize(AbortMissionMessage message) -{ - // Set initial values of message fields - // - message->missionId = newJausUnsignedShort(0); //zero mission ID - message->taskId = newJausUnsignedShort(0); //zero task ID -} - -// Destructs the message-specific fields -static void dataDestroy(AbortMissionMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(AbortMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->missionId,buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->taskId,buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(AbortMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->missionId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - if(!jausUnsignedShortToBuffer(message->taskId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(AbortMissionMessage message) -{ - int index = 0; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES;//missionId - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES;//taskId - return index; -} - -// ************************************************************************* // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************* // - -AbortMissionMessage abortMissionMessageCreate(void) -{ - AbortMissionMessage message; - - message = (AbortMissionMessage)malloc( sizeof(AbortMissionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void abortMissionMessageDestroy(AbortMissionMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean abortMissionMessageFromBuffer(AbortMissionMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean abortMissionMessageToBuffer(AbortMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < abortMissionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, - buffer+JAUS_HEADER_SIZE_BYTES, - bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToAbortMissionBuffer failed - } - } -} - -AbortMissionMessage abortMissionMessageFromJausMessage(JausMessage jausMessage) -{ - AbortMissionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (AbortMissionMessage)malloc( sizeof(AbortMissionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage abortMissionMessageToJausMessage(AbortMissionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, - jausMessage->data, - jausMessage->dataSize); - - return jausMessage; -} - -unsigned int abortMissionMessageSize(AbortMissionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(AbortMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(AbortMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | - (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/planning/pauseMissionMessage.c b/lib/openjaus/libjaus/src/message/command/planning/pauseMissionMessage.c deleted file mode 100644 index 80a7ae0abcd435775a79452e187c79b75676226b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/planning/pauseMissionMessage.c +++ /dev/null @@ -1,398 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: pauseMissionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo -// AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a PauseMissionMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/09/08 - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_PAUSE_MISSION; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(PauseMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(PauseMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(PauseMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static int dataToBuffer(PauseMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static void dataInitialize(PauseMissionMessage message); -static void dataDestroy(PauseMissionMessage message); -static unsigned int dataSize(PauseMissionMessage message); - -// ************************************************************************* // -// USER CONFIGURED FUNCTIONS -// ************************************************************************* // - -// Initializes the message-specific fields -static void dataInitialize(PauseMissionMessage message) -{ - // Set initial values of message fields - // - message->missionId = newJausUnsignedShort(0); //zero mission ID - message->taskId = newJausUnsignedShort(0); //zero task ID -} - -// Destructs the message-specific fields -static void dataDestroy(PauseMissionMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(PauseMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->missionId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->taskId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(PauseMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->missionId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->taskId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(PauseMissionMessage message) -{ - int index = 0; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //missionId - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //taskId - - return index; -} - -// ************************************************************************* // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************* // - -PauseMissionMessage pauseMissionMessageCreate(void) -{ - PauseMissionMessage message; - - message = (PauseMissionMessage)malloc( sizeof(PauseMissionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void pauseMissionMessageDestroy(PauseMissionMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean pauseMissionMessageFromBuffer(PauseMissionMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean pauseMissionMessageToBuffer(PauseMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < pauseMissionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, - buffer+JAUS_HEADER_SIZE_BYTES, - bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToPauseMissionBuffer failed - } - } -} - -PauseMissionMessage pauseMissionMessageFromJausMessage(JausMessage jausMessage) -{ - PauseMissionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (PauseMissionMessage)malloc( sizeof(PauseMissionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage pauseMissionMessageToJausMessage(PauseMissionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, - jausMessage->data, - jausMessage->dataSize); - - return jausMessage; -} - -unsigned int pauseMissionMessageSize(PauseMissionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(PauseMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(PauseMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | - (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/planning/removeMessagesMessage.c b/lib/openjaus/libjaus/src/message/command/planning/removeMessagesMessage.c deleted file mode 100644 index 52ccfa6e8690106e89f8bc466b5adbe68149f407..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/planning/removeMessagesMessage.c +++ /dev/null @@ -1,433 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: removeMessagesMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo -// AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a RemoveMessagesMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/11/08 - - - -#include -#include -#include "jaus.h" - - -static const int commandCode = JAUS_REMOVE_MESSAGES; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(RemoveMessagesMessage message,unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(RemoveMessagesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(RemoveMessagesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(RemoveMessagesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(RemoveMessagesMessage message); -static void dataDestroy(RemoveMessagesMessage message); -static unsigned int dataSize(RemoveMessagesMessage message); - -// ************************************************************************* // -// USER CONFIGURED FUNCTIONS -// ************************************************************************* // - - - -// Initializes the message-specific fields after -static void dataInitialize(RemoveMessagesMessage message) -{ - // Set initial values of static message fields 1, 2, and 3 - message->missionId = newJausUnsignedShort(0); - message->taskId = newJausUnsignedShort(0); - message->numMsgs = newJausUnsignedShort(0); - - // Set initial value for dynamic message field 3+n - message->uid = NULL; -} - - - -// Destructs the message-specific fields -static void dataDestroy(RemoveMessagesMessage message) -{ - // Free dynamically allocated message field 3+n - if(message->uid != NULL) - free(message->uid); -} - - - -//UNPACK the external component's buffered data into a JAUS message data area to -//complete receive and then return boolean of success. -static JausBoolean dataFromBuffer(RemoveMessagesMessage message,unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int i; - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - - // Unpack Message fields 1, 2, and 3 from Buffer - if(!jausUnsignedShortFromBuffer(&message->missionId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->taskId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->numMsgs, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //Dynamically allocate memory for array of unique message IDs in Task and - //then unpack field(s) 3+n from Buffer. - message->uid = (JausUnsignedShort *)malloc - (message->numMsgs * JAUS_UNSIGNED_SHORT_SIZE_BYTES); - for(i = 0; i < message->numMsgs; i++) { - if(!jausUnsignedShortFromBuffer(&message->uid[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - return JAUS_TRUE; - } - else - { - - return JAUS_FALSE; - } -} - - -//PACK the component's JAUS message data fields into a buffer to setup for -//transmit to an external component and then return number of bytes put into -//the buffer. -static int dataToBuffer(RemoveMessagesMessage message,unsigned char *buffer,unsigned int bufferSizeBytes) -{ - int i; - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message fields 1, 2, and 3 to Buffer - if(!jausUnsignedShortToBuffer(message->missionId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->taskId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->numMsgs, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Pack Message data field(s) 3+n based on field 3 to Buffer from - // dynamic array. - for(i = 0; i < message->numMsgs; i++) - { - if(!jausUnsignedShortToBuffer(message->uid[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - return index; -} - - -// Returns number of bytes put into the buffer -static unsigned int dataSize(RemoveMessagesMessage message) -{ - int index = 0; - //static message data fields 1, 2, and 3 - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - //dynamic message data field(s) 3+n - index += message->numMsgs * JAUS_UNSIGNED_SHORT_SIZE_BYTES; - return index; -} - - -// ************************************************************************* // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************* // - -RemoveMessagesMessage removeMessagesMessageCreate(void) -{ - RemoveMessagesMessage message; - - message = (RemoveMessagesMessage)malloc( sizeof(RemoveMessagesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void removeMessagesMessageDestroy(RemoveMessagesMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean removeMessagesMessageFromBuffer(RemoveMessagesMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean removeMessagesMessageToBuffer(RemoveMessagesMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < removeMessagesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, - buffer+JAUS_HEADER_SIZE_BYTES, - bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToRemoveBuffer failed - } - } -} - -RemoveMessagesMessage removeMessagesMessageFromJausMessage(JausMessage jausMessage) -{ - RemoveMessagesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (RemoveMessagesMessage)malloc( sizeof(RemoveMessagesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage removeMessagesMessageToJausMessage(RemoveMessagesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, - jausMessage->data, - jausMessage->dataSize); - - return jausMessage; -} - -unsigned int removeMessagesMessageSize(RemoveMessagesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(RemoveMessagesMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(RemoveMessagesMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | - (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/planning/replaceMessagesMessage.c b/lib/openjaus/libjaus/src/message/command/planning/replaceMessagesMessage.c deleted file mode 100644 index e6248ea244488facfc46b3ffc919698b632f10f8..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/planning/replaceMessagesMessage.c +++ /dev/null @@ -1,502 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: replaceMessagesMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo -// AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReplaceMessagesMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/13/08 - - - -#include - -#include "jaus.h" - -static const int commandCode = JAUS_REPLACE_MESSAGES; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(ReplaceMessagesMessage message,unsigned char *buffer,unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReplaceMessagesMessage message,unsigned char *buffer,unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReplaceMessagesMessage message,unsigned char *buffer,unsigned int bufferSizeBytes); -static int dataToBuffer(ReplaceMessagesMessage message,unsigned char *buffer,unsigned int bufferSizeBytes); -static void dataInitialize(ReplaceMessagesMessage message); -static void dataDestroy(ReplaceMessagesMessage message); -static unsigned int dataSize(ReplaceMessagesMessage message); - -// ************************************************************************* // -// USER CONFIGURED FUNCTIONS -// ************************************************************************* // - - -// Initializes the message-specific fields -static void dataInitialize(ReplaceMessagesMessage message) -{ - - // Set initial values of static message fields 1, 2, and 3 - message->missionId = newJausUnsignedShort(0); - message->taskId = newJausUnsignedShort(0); - message->numMsgsToRemove = newJausUnsignedShort(0); - - // Set initial value for dynamic data field 3+n for unique message IDs - message->uid = NULL; - - // Setup dynamic data fields [1+n+3m to 3+n+3m] for task messages. - message->command = jausArrayCreate(); - -} - - - - -// Destructs the message-specific fields -static void dataDestroy(ReplaceMessagesMessage message) -{ - - // Free dynamically allocated data field 3+n - if(message->uid != NULL) - { - free(message->uid); - message->uid = NULL; - } - - // Free dynamically allocated array of data fields [1+n+3m to 3+n+3m] - jausArrayDestroy(message->command,(void *)missionCommandDestroy); - -} - - - - -//UNPACK the external component's buffered data into a JAUS message data area to -//complete receive and then return boolean of success. -static JausBoolean dataFromBuffer(ReplaceMessagesMessage message,unsigned char *buffer,unsigned int bufferSizeBytes) -{ - - int index = 0; - int i; - JausMissionCommand tempObject; //used to unpack fields [1+n+3m to 3+n+3m] - JausUnsignedShort tempNumMsgsInsert = 0;//used to unpack field 4+n - - if(bufferSizeBytes == message->dataSize) - { - - // Unpack data fields 1, 2, and 3 from Buffer - if(!jausUnsignedShortFromBuffer(&message->missionId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->taskId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->numMsgsToRemove, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //Dynamically allocate memory for array of unique message - //IDs in Task and then unpack data field 3+n from Buffer. - message->uid = (JausUnsignedShort *)malloc - (message->numMsgsToRemove * JAUS_UNSIGNED_SHORT_SIZE_BYTES); - for(i = 0; i < message->numMsgsToRemove; i++) - { - if(!jausUnsignedShortFromBuffer(&message->uid[i],buffer+index,bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Unpack data field 4+n from Buffer - if(!jausUnsignedShortFromBuffer(&tempNumMsgsInsert, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //Setup to unpack data fields [1+n+3m to 3+n+3m] based on field 4+n - //into the JausArray. For each mission message specified to be inserted - //dynamically allocate a JausMissionCommand struct (initialized), unpack - //fields [1+n+3m to 3+n+3m] from Buffer to the struct, and then update the - //JausArray book keeping. - for(i = 0; i < tempNumMsgsInsert; i++) - { - tempObject = NULL;//jausMissionCommandCreate(); - if(!missionCommandFromBuffer(&tempObject,buffer+index,bufferSizeBytes-index)) return JAUS_FALSE; - index += missionCommandSize(tempObject); - //update JausArray mechanizm. - jausArrayAdd(message->command, tempObject); - } - - return JAUS_TRUE; - } - else - { - - return JAUS_FALSE; - } - -} - - - - -//PACK the component's JAUS message data fields into a buffer to setup for -//transmit to an external component and then return number of bytes put into -//the buffer. -static int dataToBuffer(ReplaceMessagesMessage message,unsigned char *buffer,unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausMissionCommand tempObject; //used to pack data fields 1+n+3m to 3+n+3m - JausUnsignedShort tempShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack data fields 1, 2, and 3 to Buffer - if(!jausUnsignedShortToBuffer(message->missionId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->taskId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->numMsgsToRemove, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Pack data field(s) 3+n based on field 3 to Buffer from dynamic array. - for(i = 0; i < message->numMsgsToRemove; i++) - { - if(!jausUnsignedShortToBuffer(message->uid[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if ( message->command->elementCount > JAUS_UNSIGNED_SHORT_MAX_VALUE) { - //DMP DO: LOG Error. - return JAUS_FALSE; - } - - tempShort = message->command->elementCount; - // Pack data field 4+n to Buffer - if(!jausUnsignedShortToBuffer(tempShort,buffer+index,bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Pack data fields [1+n+3m to 3+n+3m] based on field 4+n - // to Buffer from dyanamic array. - for(i = 0; i < message->command->elementCount; i++) - { - tempObject = (JausMissionCommand)(message->command->elementData[i]); - if(!missionCommandToBuffer(tempObject, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += missionCommandSize(tempObject); - } - } - - return index; -} - - - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReplaceMessagesMessage message) -{ - unsigned int index = 0; - int i; - - //static data fields 1, 2, and 3 - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - //dynamic data field 3+n - index += message->numMsgsToRemove * JAUS_UNSIGNED_SHORT_SIZE_BYTES; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - //dynamic data fields [1+n+3m to 3+n+3m] - for ( i = 0; i < message->command->elementCount; i++) - { - index += missionCommandSize(message->command->elementData[i]); - } - - return index; -} - - - -// ************************************************************************* // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************* // - -ReplaceMessagesMessage replaceMessagesMessageCreate(void) -{ - ReplaceMessagesMessage message; - - message = (ReplaceMessagesMessage)malloc( sizeof(ReplaceMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - - - -void replaceMessagesMessageDestroy(ReplaceMessagesMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - - - -JausBoolean replaceMessagesMessageFromBuffer(ReplaceMessagesMessage message,unsigned char* buffer,unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - - - -JausBoolean replaceMessagesMessageToBuffer(ReplaceMessagesMessage message, unsigned char *buffer,unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < replaceMessagesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReplaceBuffer failed - } - } -} - - - - -ReplaceMessagesMessage replaceMessagesMessageFromJausMessage(JausMessage jausMessage) -{ - ReplaceMessagesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReplaceMessagesMessage)malloc( sizeof(ReplaceMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - dataInitialize(message); - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - - - -JausMessage replaceMessagesMessageToJausMessage(ReplaceMessagesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message,jausMessage->data,jausMessage->dataSize); - - return jausMessage; -} - -unsigned int replaceMessagesMessageSize(ReplaceMessagesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReplaceMessagesMessage message,unsigned char *buffer,unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReplaceMessagesMessage message,unsigned char *buffer,unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | - (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/planning/resumeMissionMessage.c b/lib/openjaus/libjaus/src/message/command/planning/resumeMissionMessage.c deleted file mode 100644 index 190fc6e2733ea0c2a376d4710d193b70bfdceff9..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/planning/resumeMissionMessage.c +++ /dev/null @@ -1,398 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: resumeMissionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo -// AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ResumeMissionMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/09/08 - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_RESUME_MISSION; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(ResumeMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ResumeMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ResumeMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static int dataToBuffer(ResumeMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static void dataInitialize(ResumeMissionMessage message); -static void dataDestroy(ResumeMissionMessage message); -static unsigned int dataSize(ResumeMissionMessage message); - -// ************************************************************************* // -// USER CONFIGURED FUNCTIONS -// ************************************************************************* // - -// Initializes the message-specific fields -static void dataInitialize(ResumeMissionMessage message) -{ - // Set initial values of message fields - // - message->missionId = newJausUnsignedShort(0); //zero mission ID - message->taskId = newJausUnsignedShort(0); //zero task ID -} - -// Destructs the message-specific fields -static void dataDestroy(ResumeMissionMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ResumeMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->missionId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->taskId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ResumeMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->missionId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->taskId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ResumeMissionMessage message) -{ - int index = 0; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //missionId - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //taskId - - return index; -} - -// ************************************************************************* // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************* // - -ResumeMissionMessage resumeMissionMessageCreate(void) -{ - ResumeMissionMessage message; - - message = (ResumeMissionMessage)malloc( sizeof(ResumeMissionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void resumeMissionMessageDestroy(ResumeMissionMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean resumeMissionMessageFromBuffer(ResumeMissionMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean resumeMissionMessageToBuffer(ResumeMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < resumeMissionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, - buffer+JAUS_HEADER_SIZE_BYTES, - bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToResumeMissionBuffer failed - } - } -} - -ResumeMissionMessage resumeMissionMessageFromJausMessage(JausMessage jausMessage) -{ - ResumeMissionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ResumeMissionMessage)malloc( sizeof(ResumeMissionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage resumeMissionMessageToJausMessage(ResumeMissionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, - jausMessage->data, - jausMessage->dataSize); - - return jausMessage; -} - -unsigned int resumeMissionMessageSize(ResumeMissionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ResumeMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ResumeMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | - (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/planning/runMissionMessage.c b/lib/openjaus/libjaus/src/message/command/planning/runMissionMessage.c deleted file mode 100644 index bd1aefb81ab43c22cd61f3aaa5b487de9d138050..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/planning/runMissionMessage.c +++ /dev/null @@ -1,362 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: runMissionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a RunMissionMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 061008 - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_RUN_MISSION; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(RunMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(RunMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(RunMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(RunMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(RunMissionMessage message); -static void dataDestroy(RunMissionMessage message); -static unsigned int dataSize(RunMissionMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(RunMissionMessage message) -{ - // Set initial values of message fields - message->missionId = newJausUnsignedShort(0); -} - -// Destructs the message-specific fields -static void dataDestroy(RunMissionMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(RunMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->missionId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(RunMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->missionId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(RunMissionMessage message) -{ - int index = 0; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //missionId - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -RunMissionMessage runMissionMessageCreate(void) -{ - RunMissionMessage message; - - message = (RunMissionMessage)malloc( sizeof(RunMissionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void runMissionMessageDestroy(RunMissionMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean runMissionMessageFromBuffer(RunMissionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean runMissionMessageToBuffer(RunMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < runMissionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToRunMissionBuffer failed - } - } -} - -RunMissionMessage runMissionMessageFromJausMessage(JausMessage jausMessage) -{ - RunMissionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (RunMissionMessage)malloc( sizeof(RunMissionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage runMissionMessageToJausMessage(RunMissionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int runMissionMessageSize(RunMissionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(RunMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(RunMissionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/planning/spoolMissionMessage.c b/lib/openjaus/libjaus/src/message/command/planning/spoolMissionMessage.c deleted file mode 100644 index 5eb722b08892882b57d40569561ecb4a1f5d3b2b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/planning/spoolMissionMessage.c +++ /dev/null @@ -1,441 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: spoolMissionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo -// AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SpoolMissionMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/16/08 - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SPOOL_MISSION; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(SpoolMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SpoolMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SpoolMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static int dataToBuffer(SpoolMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static void dataInitialize(SpoolMissionMessage message); -static void dataDestroy(SpoolMissionMessage message); -static unsigned int dataSize(SpoolMissionMessage message); - -// ************************************************************************* // -// USER CONFIGURED FUNCTIONS -// ************************************************************************* // - -// Initializes the message-specific fields -static void dataInitialize(SpoolMissionMessage message) -{ - // Set initial values of static message fields 1 and 2 - message->missionId = newJausUnsignedShort(0); - message->appendFlag = newJausByte(JAUS_REPLACE_CURRENT_MISSION_WITH_NEW_MISSION); - // Setup dynamic data fields [3 to 8+n+3m.] for task messages and children. - if ((message->naryTree = missionTaskCreate()) == NULL) { - //DMPDO: Log error? Cannot do anything else because no returnval. - } -} - - - -// Destructs the message-specific fields -static void dataDestroy(SpoolMissionMessage message) -{ - // Free dynamcially allocated data fields [3 to 8+n+3m]. - missionTaskDestroy(message->naryTree); -} - - - -//UNPACK the external component's buffered data into a JAUS message data area to -//complete receive and then return boolean of success. -static JausBoolean dataFromBuffer(SpoolMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - - unsigned int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack data fields 1 and 2 from Buffer - if(!jausUnsignedShortFromBuffer(&message->missionId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->appendFlag, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Unpacks data fields [3 to 8+n+3m] from Buffer. NOTE: handles all task - // messages and children where tree traversal is depth first with left - // to right processing. - if(!missionTaskFromBuffer(&message->naryTree, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += (int)missionTaskSize(message->naryTree); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -//PACK the component's JAUS message data fields into a buffer to setup for -//transmit to an external component and then return number of bytes put into -//the buffer. -static int dataToBuffer(SpoolMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - unsigned int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack data fields 1 and 2 to Buffer - if(!jausUnsignedShortToBuffer(message->missionId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->appendFlag, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Pack data fields [3 to 8+n+3m] to Buffer. NOTE: handles all task - // messages and children where tree traversal is depth first with left - // to right processing. - message->naryTree->bufferOffset = index; - if(!missionTaskToBuffer(message->naryTree, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += (int)missionTaskSize(message->naryTree); - } - - return index; -} - - - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SpoolMissionMessage message) -{ - unsigned int index = 0; - - //static data fields 1 and 2 - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - index += JAUS_BYTE_SIZE_BYTES; - //dynamic data fields fields 4 to 8+n+3m - index += missionTaskSize(message->naryTree);; - - return index; -} - -// ************************************************************************* // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************* // - -SpoolMissionMessage spoolMissionMessageCreate(void) -{ - SpoolMissionMessage message; - - message = (SpoolMissionMessage)malloc( sizeof(SpoolMissionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void spoolMissionMessageDestroy(SpoolMissionMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean spoolMissionMessageFromBuffer(SpoolMissionMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean spoolMissionMessageToBuffer(SpoolMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < spoolMissionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, - buffer+JAUS_HEADER_SIZE_BYTES, - bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSpoolMissionBuffer failed - } - } -} - -SpoolMissionMessage spoolMissionMessageFromJausMessage(JausMessage jausMessage) -{ - SpoolMissionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SpoolMissionMessage)malloc( sizeof(SpoolMissionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - dataInitialize(message); - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage spoolMissionMessageToJausMessage(SpoolMissionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, - jausMessage->data, - jausMessage->dataSize); - - return jausMessage; -} - -unsigned int spoolMissionMessageSize(SpoolMissionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SpoolMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SpoolMissionMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | - (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/platform/setDiscreteDevicesMessage.c b/lib/openjaus/libjaus/src/message/command/platform/setDiscreteDevicesMessage.c deleted file mode 100644 index 32d3317150952dcd42ef9e5748f7ee630bdf9c2a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/platform/setDiscreteDevicesMessage.c +++ /dev/null @@ -1,475 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setDiscreteDevicesMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetDiscreteDevicesMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_DISCRETE_DEVICES; -static const int maxDataSizeBytes = 5; - -static JausBoolean headerFromBuffer(SetDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetDiscreteDevicesMessage message); -static unsigned int dataSize(SetDiscreteDevicesMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetDiscreteDevicesMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->gear = newJausByte(0); - message->transferCase = newJausByte(0); - - // Main Propulsion - message->mainPropulsion = JAUS_FALSE; - message->mainFuelSupply = JAUS_FALSE; - message->auxFuelSupply = JAUS_FALSE; - message->powerAuxDevices = JAUS_FALSE; - message->startingDevice = JAUS_FALSE; - message->coldStart = JAUS_FALSE; - message->automaticStart = JAUS_FALSE; - message->automaticStop = JAUS_FALSE; - - // Parking, Brake and Horn - message->parkingBrake = JAUS_FALSE; - message->horn = JAUS_FALSE; -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausByte tempByte; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Unpack according to presence vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_PROPULSION_BIT)) - { - //unpack - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->mainPropulsion = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_MAIN_POWER_BIT)? JAUS_TRUE : JAUS_FALSE; - message->mainFuelSupply = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_MAIN_FUEL_BIT)? JAUS_TRUE : JAUS_FALSE; - message->auxFuelSupply = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_AUXILARY_FUEL_BIT)? JAUS_TRUE : JAUS_FALSE; - message->powerAuxDevices = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_AUXILARY_POWER_BIT)? JAUS_TRUE : JAUS_FALSE; - message->startingDevice = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_STARTING_DEVICE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->coldStart = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_COLD_START_BIT)? JAUS_TRUE : JAUS_FALSE; - message->automaticStart = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_AUTO_START_BIT)? JAUS_TRUE : JAUS_FALSE; - message->automaticStop = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_AUTO_SHUTDOWN_BIT)? JAUS_TRUE : JAUS_FALSE; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_PARKING_BIT)) - { - //unpack - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->parkingBrake = jausByteIsBitSet(tempByte, JAUS_DEVICES_OTHER_BF_PARKING_BRAKE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->horn = jausByteIsBitSet(tempByte, JAUS_DEVICES_OTHER_BF_HORN_BIT)? JAUS_TRUE : JAUS_FALSE; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_GEAR_BIT)) - { - //unpack - if(!jausByteFromBuffer(&message->gear, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_TRANSFER_BIT)) - { - //unpack - if(!jausByteFromBuffer(&message->transferCase, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausByte tempByte = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Pack according to presence vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_PROPULSION_BIT)) - { - tempByte = 0; - if(message->mainPropulsion) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_MAIN_POWER_BIT); - if(message->mainFuelSupply) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_MAIN_FUEL_BIT); - if(message->auxFuelSupply) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_AUXILARY_FUEL_BIT); - if(message->powerAuxDevices) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_AUXILARY_POWER_BIT); - if(message->startingDevice) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_STARTING_DEVICE_BIT); - if(message->coldStart) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_COLD_START_BIT); - if(message->automaticStart) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_AUTO_START_BIT); - if(message->automaticStop) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_AUTO_SHUTDOWN_BIT); - - //pack - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_PARKING_BIT)) - { - tempByte = 0; - if(message->parkingBrake) jausByteSetBit(&tempByte, JAUS_DEVICES_OTHER_BF_PARKING_BRAKE_BIT); - if(message->horn) jausByteSetBit(&tempByte, JAUS_DEVICES_OTHER_BF_HORN_BIT); - - //pack - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_GEAR_BIT)) - { - //pack - if(!jausByteToBuffer(message->gear, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_TRANSFER_BIT)) - { - //pack - if(!jausByteToBuffer(message->transferCase, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - } - - return index; -} - -static unsigned int dataSize(SetDiscreteDevicesMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_PROPULSION_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_PARKING_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_GEAR_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_TRANSFER_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetDiscreteDevicesMessage setDiscreteDevicesMessageCreate(void) -{ - SetDiscreteDevicesMessage message; - - message = (SetDiscreteDevicesMessage)malloc( sizeof(SetDiscreteDevicesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setDiscreteDevicesMessageDestroy(SetDiscreteDevicesMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setDiscreteDevicesMessageFromBuffer(SetDiscreteDevicesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setDiscreteDevicesMessageToBuffer(SetDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setDiscreteDevicesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetDiscreteDevicesBuffer failed - } - } -} - -SetDiscreteDevicesMessage setDiscreteDevicesMessageFromJausMessage(JausMessage jausMessage) -{ - SetDiscreteDevicesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetDiscreteDevicesMessage)malloc( sizeof(SetDiscreteDevicesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setDiscreteDevicesMessageToJausMessage(SetDiscreteDevicesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int setDiscreteDevicesMessageSize(SetDiscreteDevicesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/platform/setGlobalPathSegmentMessage.c b/lib/openjaus/libjaus/src/message/command/platform/setGlobalPathSegmentMessage.c deleted file mode 100644 index e017457fe52305c14a6ac0863f7d6bbb352fdc85..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/platform/setGlobalPathSegmentMessage.c +++ /dev/null @@ -1,488 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setGlobalPathSegmentMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetGlobalPathSegmentMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_GLOBAL_PATH_SEGMENT; -static const int maxDataSizeBytes = 29; - -static JausBoolean headerFromBuffer(SetGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetGlobalPathSegmentMessage message); -static unsigned int dataSize(SetGlobalPathSegmentMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetGlobalPathSegmentMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->pathSegmentNumber = newJausUnsignedShort(0); - message->p1LatitudeDeg = newJausDouble(0); // Scaled Integer (-90, 90) - message->p1LongitudeDeg = newJausDouble(0); // Scaled Integer (-180, 180) - message->p1AltitudeM = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->p2LatitudeDeg = newJausDouble(0); // Scaled Integer (-90, 90) - message->p2LongitudeDeg = newJausDouble(0); // Scaled Integer (-180, 180) - message->p2AltitudeM = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->weightingFactor = newJausDouble(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Use Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->pathSegmentNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //unpack - //JausDouble p1LatitudeDeg // Scaled Integer (-90, 90) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p1LatitudeDeg = jausIntegerToDouble(tempInteger, -90, 90); - - //unpack - //JausDouble p1LongitudeDeg // Scaled Integer (-180, 180) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p1LongitudeDeg = jausIntegerToDouble(tempInteger, -180, 180); - - if(jausByteIsBitSet(message->presenceVector, JAUS_PATH_SEGMENT_PV_P1_ALTITUDE_BIT)) - { - //unpack - //JausDouble p1AltitudeM // Scaled Integer (-10000, 35000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - message->p1AltitudeM = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - //unpack - //JausDouble p2LatitudeDeg // Scaled Integer (-90, 90) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p2LatitudeDeg = jausIntegerToDouble(tempInteger, -90, 90); - - //unpack - //JausDouble p2LongitudeDeg // Scaled Integer (-180, 180) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p2LongitudeDeg = jausIntegerToDouble(tempInteger, -180, 180); - - if(jausByteIsBitSet(message->presenceVector, JAUS_PATH_SEGMENT_PV_P2_ALTITUDE_BIT)) - { - //unpack - //JausDouble p2AltitudeM // Scaled Integer (-10000, 35000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - message->p2AltitudeM = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->weightingFactor = jausUnsignedShortToDouble(tempUShort, 0, 500); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Use Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->pathSegmentNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //pack - //JausDouble p1LatitudeDeg // Scaled Integer (-90, 90) - tempInteger = jausIntegerFromDouble(message->p1LatitudeDeg, -90, 90); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - //pack - //JausDouble p1LongitudeDeg // Scaled Integer (-180, 180) - tempInteger = jausIntegerFromDouble(message->p1LongitudeDeg, -180, 180); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_PATH_SEGMENT_PV_P1_ALTITUDE_BIT)) - { - //pack - //JausDouble p1AltitudeM // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->p1AltitudeM, -10000, 35000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - //JausDouble p2LatitudeDeg // Scaled Integer (-90, 90) - tempInteger = jausIntegerFromDouble(message->p2LatitudeDeg, -90, 90); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - //pack - //JausDouble p2LongitudeDeg // Scaled Integer (-180, 180) - tempInteger = jausIntegerFromDouble(message->p2LongitudeDeg, -180, 180); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_PATH_SEGMENT_PV_P2_ALTITUDE_BIT)) - { - //pack - //JausDouble p2AltitudeM // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->p2AltitudeM, -10000, 35000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - tempUShort = jausUnsignedShortFromDouble(message->weightingFactor, 0, 500); - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - } - return index; -} - -static unsigned int dataSize(SetGlobalPathSegmentMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_PATH_SEGMENT_PV_P1_ALTITUDE_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - index += JAUS_INTEGER_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_PATH_SEGMENT_PV_P2_ALTITUDE_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetGlobalPathSegmentMessage setGlobalPathSegmentMessageCreate(void) -{ - SetGlobalPathSegmentMessage message; - - message = (SetGlobalPathSegmentMessage)malloc( sizeof(SetGlobalPathSegmentMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setGlobalPathSegmentMessageDestroy(SetGlobalPathSegmentMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setGlobalPathSegmentMessageFromBuffer(SetGlobalPathSegmentMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setGlobalPathSegmentMessageToBuffer(SetGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setGlobalPathSegmentMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetGlobalPathSegmentBuffer failed - } - } -} - -SetGlobalPathSegmentMessage setGlobalPathSegmentMessageFromJausMessage(JausMessage jausMessage) -{ - SetGlobalPathSegmentMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetGlobalPathSegmentMessage)malloc( sizeof(SetGlobalPathSegmentMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setGlobalPathSegmentMessageToJausMessage(SetGlobalPathSegmentMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int setGlobalPathSegmentMessageSize(SetGlobalPathSegmentMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/platform/setGlobalVectorMessage.c b/lib/openjaus/libjaus/src/message/command/platform/setGlobalVectorMessage.c deleted file mode 100644 index 51ab2c5fbe98b63c52c79a9d6bbde4d2146efdc8..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/platform/setGlobalVectorMessage.c +++ /dev/null @@ -1,497 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setGlobalVectorMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetGlobalVectorMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_GLOBAL_VECTOR; -static const int maxDataSizeBytes = 13; - -static JausBoolean headerFromBuffer(SetGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetGlobalVectorMessage message); -static unsigned int dataSize(SetGlobalVectorMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetGlobalVectorMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - - message->speedMps = newJausDouble(0); // Scaled Unsigned Short (0, 10000) Mps = Meters Per Second - message->altitudeMeters = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->headingRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->rollRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->pitchRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Unpack according to presence vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_SPEED_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 10000) - message->speedMps = jausUnsignedShortToDouble(tempUShort, 0, 10000); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_ALTITUDE_BIT)) - { - // unpack - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Integer (-10000, 35000) - message->altitudeMeters = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_HEADING_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - message->headingRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_ROLL_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - message->rollRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_PITCH_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - message->pitchRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Pack according to presence vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_SPEED_BIT)) - { - // Scaled Unsigned Short (0, 10000) - tempUShort = jausUnsignedShortFromDouble(message->speedMps, 0, 10000); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_ALTITUDE_BIT)) - { - // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->altitudeMeters, -10000, 35000); - - // pack - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_HEADING_BIT)) - { - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->headingRadians, -JAUS_PI, JAUS_PI); - - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_ROLL_BIT)) - { - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->rollRadians, -JAUS_PI, JAUS_PI); - - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_PITCH_BIT)) - { - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->pitchRadians, -JAUS_PI, JAUS_PI); - - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - } - - return index; -} - -static unsigned int dataSize(SetGlobalVectorMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_SPEED_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_ALTITUDE_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_HEADING_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_ROLL_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_PITCH_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetGlobalVectorMessage setGlobalVectorMessageCreate(void) -{ - SetGlobalVectorMessage message; - - message = (SetGlobalVectorMessage)malloc( sizeof(SetGlobalVectorMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setGlobalVectorMessageDestroy(SetGlobalVectorMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setGlobalVectorMessageFromBuffer(SetGlobalVectorMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setGlobalVectorMessageToBuffer(SetGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setGlobalVectorMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetGlobalVectorBuffer failed - } - } -} - -SetGlobalVectorMessage setGlobalVectorMessageFromJausMessage(JausMessage jausMessage) -{ - SetGlobalVectorMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetGlobalVectorMessage)malloc( sizeof(SetGlobalVectorMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setGlobalVectorMessageToJausMessage(SetGlobalVectorMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int setGlobalVectorMessageSize(SetGlobalVectorMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/platform/setGlobalWaypointMessage.c b/lib/openjaus/libjaus/src/message/command/platform/setGlobalWaypointMessage.c deleted file mode 100644 index 309ce52efef42e51fadc5ece00d1a761084b2765..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/platform/setGlobalWaypointMessage.c +++ /dev/null @@ -1,496 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setGlobalWaypointMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetGlobalWaypointMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_GLOBAL_WAYPOINT; -static const int maxDataSizeBytes = 21; - -static JausBoolean headerFromBuffer(SetGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetGlobalWaypointMessage message); -static unsigned int dataSize(SetGlobalWaypointMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetGlobalWaypointMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->waypointNumber = newJausUnsignedShort(0); - message->latitudeDegrees = newJausDouble(0); // Scaled Integer (-90, 90) - message->longitudeDegrees = newJausDouble(0); // Scaled Integer (-180, 180) - message->elevationMeters = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->rollRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->pitchRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->yawRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Use Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->waypointNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //unpack - //JausDouble latitudeDegrees // Scaled Integer (-90, 90) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->latitudeDegrees = jausIntegerToDouble(tempInteger, -90, 90); - - //unpack - //JausDouble longitudeDegrees // Scaled Integer (-180, 180) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->longitudeDegrees = jausIntegerToDouble(tempInteger, -180, 180); - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_ELEVATION_BIT)) - { - //unpack - //JausDouble elevationMeters // Scaled Integer (-10000, 35000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - message->elevationMeters = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_ROLL_BIT)) - { - //unpack - //JausDouble rollRadians // Scaled Short (-JAUS_PI, JAUS_PI) - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - message->rollRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_PITCH_BIT)) - { - //unpack - //JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - message->pitchRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_YAW_BIT)) - { - //unpack - //JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - message->yawRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Use Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->waypointNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //pack - //JausDouble latitudeDegrees // Scaled Integer (-90, 90) - tempInteger = jausIntegerFromDouble(message->latitudeDegrees, -90, 90); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - //pack - //JausDouble longitudeDegrees // Scaled Integer (-180, 180) - tempInteger = jausIntegerFromDouble(message->longitudeDegrees, -180, 180); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_ELEVATION_BIT)) - { - //pack - //JausDouble elevationMeters // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->elevationMeters, -10000, 35000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_ROLL_BIT)) - { - //pack - //JausDouble rollRadians // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->rollRadians, -JAUS_PI, JAUS_PI); - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_PITCH_BIT)) - { - //pack - //JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->pitchRadians, -JAUS_PI, JAUS_PI); - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_YAW_BIT)) - { - //pack - //JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->yawRadians, -JAUS_PI, JAUS_PI); - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - } - return index; -} - -static unsigned int dataSize(SetGlobalWaypointMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_ELEVATION_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_ROLL_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_PITCH_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_YAW_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetGlobalWaypointMessage setGlobalWaypointMessageCreate(void) -{ - SetGlobalWaypointMessage message; - - message = (SetGlobalWaypointMessage)malloc( sizeof(SetGlobalWaypointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setGlobalWaypointMessageDestroy(SetGlobalWaypointMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setGlobalWaypointMessageFromBuffer(SetGlobalWaypointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setGlobalWaypointMessageToBuffer(SetGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setGlobalWaypointMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetGlobalWaypointBuffer failed - } - } -} - -SetGlobalWaypointMessage setGlobalWaypointMessageFromJausMessage(JausMessage jausMessage) -{ - SetGlobalWaypointMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetGlobalWaypointMessage)malloc( sizeof(SetGlobalWaypointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setGlobalWaypointMessageToJausMessage(SetGlobalWaypointMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int setGlobalWaypointMessageSize(SetGlobalWaypointMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/platform/setLocalPathSegmentMessage.c b/lib/openjaus/libjaus/src/message/command/platform/setLocalPathSegmentMessage.c deleted file mode 100644 index 504c4e58b47f8c2de021861b8c55b49fe4c95613..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/platform/setLocalPathSegmentMessage.c +++ /dev/null @@ -1,488 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setLocalPathSegmentMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetLocalPathSegmentMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_LOCAL_PATH_SEGMENT; -static const int maxDataSizeBytes = 29; - -static JausBoolean headerFromBuffer(SetLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetLocalPathSegmentMessage message); -static unsigned int dataSize(SetLocalPathSegmentMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetLocalPathSegmentMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->pathSegmentNumber = newJausUnsignedShort(0); - message->p1XM = newJausDouble(0); // Scaled Integer (-100000, 100000) - message->p1YM = newJausDouble(0); // Scaled Integer (-100000, 100000) - message->p1ZM = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->p2XM = newJausDouble(0); // Scaled Integer (-100000, 100000) - message->p2YM = newJausDouble(0); // Scaled Integer (-100000, 100000) - message->p2ZM = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->weightingFactor = newJausDouble(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Use Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->pathSegmentNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //unpack - //JausDouble p1XM // Scaled Integer (-100000, 100000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p1XM = jausIntegerToDouble(tempInteger, -100000, 100000); - - //unpack - //JausDouble p1YM // Scaled Integer (-100000, 100000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p1YM = jausIntegerToDouble(tempInteger, -100000, 100000); - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_PATH_SEGMENT_PV_P1_Z_BIT)) - { - //unpack - //JausDouble p1ZM // Scaled Integer (-10000, 35000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - message->p1ZM = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - //unpack - //JausDouble p2XM // Scaled Integer (-100000, 100000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p2XM = jausIntegerToDouble(tempInteger, -100000, 100000); - - //unpack - //JausDouble p2YM // Scaled Integer (-100000, 100000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p2YM = jausIntegerToDouble(tempInteger, -100000, 100000); - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_PATH_SEGMENT_PV_P2_Z_BIT)) - { - //unpack - //JausDouble p2ZM // Scaled Integer (-10000, 35000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - message->p2ZM = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->weightingFactor = jausUnsignedShortToDouble(tempUShort, 0, 500); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Use Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->pathSegmentNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //pack - //JausDouble p1XM // Scaled Integer (-100000, 100000) - tempInteger = jausIntegerFromDouble(message->p1XM, -100000, 100000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - //pack - //JausDouble p1YM // Scaled Integer (-100000, 100000) - tempInteger = jausIntegerFromDouble(message->p1YM, -100000, 100000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_PATH_SEGMENT_PV_P1_Z_BIT)) - { - //pack - //JausDouble p1ZM // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->p1ZM, -10000, 35000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - //JausDouble p2XM // Scaled Integer (-100000, 100000) - tempInteger = jausIntegerFromDouble(message->p2XM, -100000, 100000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - //pack - //JausDouble p2YM // Scaled Integer (-100000, 100000) - tempInteger = jausIntegerFromDouble(message->p2YM, -100000, 100000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_PATH_SEGMENT_PV_P2_Z_BIT)) - { - //pack - //JausDouble p2ZM // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->p2ZM, -10000, 35000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - tempUShort = jausUnsignedShortFromDouble(message->weightingFactor, 0, 500); - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - } - return index; -} - -static unsigned int dataSize(SetLocalPathSegmentMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_PATH_SEGMENT_PV_P1_Z_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - index += JAUS_INTEGER_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_PATH_SEGMENT_PV_P2_Z_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetLocalPathSegmentMessage setLocalPathSegmentMessageCreate(void) -{ - SetLocalPathSegmentMessage message; - - message = (SetLocalPathSegmentMessage)malloc( sizeof(SetLocalPathSegmentMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setLocalPathSegmentMessageDestroy(SetLocalPathSegmentMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setLocalPathSegmentMessageFromBuffer(SetLocalPathSegmentMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setLocalPathSegmentMessageToBuffer(SetLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setLocalPathSegmentMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetLocalPathSegmentBuffer failed - } - } -} - -SetLocalPathSegmentMessage setLocalPathSegmentMessageFromJausMessage(JausMessage jausMessage) -{ - SetLocalPathSegmentMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetLocalPathSegmentMessage)malloc( sizeof(SetLocalPathSegmentMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setLocalPathSegmentMessageToJausMessage(SetLocalPathSegmentMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int setLocalPathSegmentMessageSize(SetLocalPathSegmentMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/platform/setLocalVectorMessage.c b/lib/openjaus/libjaus/src/message/command/platform/setLocalVectorMessage.c deleted file mode 100644 index 1ed5e4cba20e027e8184007ad10efd7482c42d6f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/platform/setLocalVectorMessage.c +++ /dev/null @@ -1,380 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setLocalVectorMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetLocalVectorMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_LOCAL_VECTOR; -static const int maxDataSizeBytes = 6; - -static JausBoolean headerFromBuffer(SetLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetLocalVectorMessage message); -static unsigned int dataSize(SetLocalVectorMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetLocalVectorMessage message) -{ - // Set initial values of message fields - message->speedMps = newJausDouble(0); // Scaled Unsigned Int (0, 10000) Mps = Meters Per Second - message->headingRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - // unpack - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - // Scaled Unsigned Short (0, 10000) - message->speedMps = jausIntegerToDouble(tempInteger, 0, 10000); - - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - // Scaled Short (-JAUS_PI, JAUS_PI) - message->headingRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - // Scaled Unsigned Short (0, 10000) - tempInteger = jausIntegerFromDouble(message->speedMps, 0, 10000); - // pack - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->headingRadians, -JAUS_PI, JAUS_PI); - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - } - - return index; -} - -static unsigned int dataSize(SetLocalVectorMessage message) -{ - int index = 0; - - index += JAUS_INTEGER_SIZE_BYTES; - index += JAUS_SHORT_SIZE_BYTES; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetLocalVectorMessage setLocalVectorMessageCreate(void) -{ - SetLocalVectorMessage message; - - message = (SetLocalVectorMessage)malloc( sizeof(SetLocalVectorMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setLocalVectorMessageDestroy(SetLocalVectorMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setLocalVectorMessageFromBuffer(SetLocalVectorMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setLocalVectorMessageToBuffer(SetLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setLocalVectorMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetLocalVectorBuffer failed - } - } -} - -SetLocalVectorMessage setLocalVectorMessageFromJausMessage(JausMessage jausMessage) -{ - SetLocalVectorMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetLocalVectorMessage)malloc( sizeof(SetLocalVectorMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setLocalVectorMessageToJausMessage(SetLocalVectorMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int setLocalVectorMessageSize(SetLocalVectorMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/platform/setLocalWaypointMessage.c b/lib/openjaus/libjaus/src/message/command/platform/setLocalWaypointMessage.c deleted file mode 100644 index 51c8d965b4d72d309ab2ab63b2009fc2b615437a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/platform/setLocalWaypointMessage.c +++ /dev/null @@ -1,496 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setLocalWaypointMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetLocalWaypointMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_LOCAL_WAYPOINT; -static const int maxDataSizeBytes = 21; - -static JausBoolean headerFromBuffer(SetLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetLocalWaypointMessage message); -static unsigned int dataSize(SetLocalWaypointMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetLocalWaypointMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->waypointNumber = newJausUnsignedShort(0); - message->xM = newJausDouble(0); // Scaled Integer (-100000, 100000) - message->yM = newJausDouble(0); // Scaled Integer (-100000, 100000) - message->zM = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->rollRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->pitchRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->yawRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Use Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->waypointNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //unpack - //JausDouble xM // Scaled Integer (-100000, 100000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->xM = jausIntegerToDouble(tempInteger, -100000, 100000); - - //unpack - //JausDouble yM // Scaled Integer (-100000, 100000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->yM = jausIntegerToDouble(tempInteger, -100000, 100000); - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_Z_BIT)) - { - //unpack - //JausDouble zM // Scaled Integer (-10000, 35000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - message->zM = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_ROLL_BIT)) - { - //unpack - //JausDouble rollRadians // Scaled Short (-JAUS_PI, JAUS_PI) - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - message->rollRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_PITCH_BIT)) - { - //unpack - //JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - message->pitchRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_YAW_BIT)) - { - //unpack - //JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - message->yawRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Use Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->waypointNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //pack - //JausDouble xM // Scaled Integer (-100000, 100000) - tempInteger = jausIntegerFromDouble(message->xM, -100000, 100000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - //pack - //JausDouble yM // Scaled Integer (-100000, 100000) - tempInteger = jausIntegerFromDouble(message->yM, -100000, 100000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_Z_BIT)) - { - //pack - //JausDouble zM // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->zM, -10000, 35000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_ROLL_BIT)) - { - //pack - //JausDouble rollRadians // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->rollRadians, -JAUS_PI, JAUS_PI); - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_PITCH_BIT)) - { - //pack - //JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->pitchRadians, -JAUS_PI, JAUS_PI); - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_YAW_BIT)) - { - //pack - //JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->yawRadians, -JAUS_PI, JAUS_PI); - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - } - return index; -} - -static unsigned int dataSize(SetLocalWaypointMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_Z_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_ROLL_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_PITCH_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_YAW_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetLocalWaypointMessage setLocalWaypointMessageCreate(void) -{ - SetLocalWaypointMessage message; - - message = (SetLocalWaypointMessage)malloc( sizeof(SetLocalWaypointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setLocalWaypointMessageDestroy(SetLocalWaypointMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setLocalWaypointMessageFromBuffer(SetLocalWaypointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setLocalWaypointMessageToBuffer(SetLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setLocalWaypointMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetLocalWaypointBuffer failed - } - } -} - -SetLocalWaypointMessage setLocalWaypointMessageFromJausMessage(JausMessage jausMessage) -{ - SetLocalWaypointMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetLocalWaypointMessage)malloc( sizeof(SetLocalWaypointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setLocalWaypointMessageToJausMessage(SetLocalWaypointMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int setLocalWaypointMessageSize(SetLocalWaypointMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/platform/setTravelSpeedMessage.c b/lib/openjaus/libjaus/src/message/command/platform/setTravelSpeedMessage.c deleted file mode 100644 index adaedbab8dc616db9c4503b9aec81a41773f9581..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/platform/setTravelSpeedMessage.c +++ /dev/null @@ -1,359 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setTravelSpeedMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetTravelSpeedMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_TRAVEL_SPEED; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(SetTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetTravelSpeedMessage message); -static unsigned int dataSize(SetTravelSpeedMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetTravelSpeedMessage message) -{ - // Set initial values of message fields - message->speedMps = newJausDouble(0); //Scaled Unsigned Short (0, 10000) Mps = Meters Per Second -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 10000) - message->speedMps = jausUnsignedShortToDouble(tempUShort, 0, 10000); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - // Scaled Unsigned Short (0, 10000) - tempUShort = jausUnsignedShortFromDouble(message->speedMps, 0, 10000); - - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(SetTravelSpeedMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetTravelSpeedMessage setTravelSpeedMessageCreate(void) -{ - SetTravelSpeedMessage message; - - message = (SetTravelSpeedMessage)malloc( sizeof(SetTravelSpeedMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void setTravelSpeedMessageDestroy(SetTravelSpeedMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setTravelSpeedMessageFromBuffer(SetTravelSpeedMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setTravelSpeedMessageToBuffer(SetTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setTravelSpeedMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetTravelSpeedBuffer failed - } - } -} - -SetTravelSpeedMessage setTravelSpeedMessageFromJausMessage(JausMessage jausMessage) -{ - SetTravelSpeedMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetTravelSpeedMessage)malloc( sizeof(SetTravelSpeedMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setTravelSpeedMessageToJausMessage(SetTravelSpeedMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int setTravelSpeedMessageSize(SetTravelSpeedMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/platform/setVelocityStateMessage.c b/lib/openjaus/libjaus/src/message/command/platform/setVelocityStateMessage.c deleted file mode 100644 index cb88a40e518d1ef99f196c22a286466eb2c53f09..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/platform/setVelocityStateMessage.c +++ /dev/null @@ -1,600 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setVelocityStateMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetVelocityStateMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_VELOCITY_STATE; -static const int maxDataSizeBytes = 30; - -static JausBoolean headerFromBuffer(SetVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetVelocityStateMessage message); -static void dataDestroy(SetVelocityStateMessage message); -static unsigned int dataSize(SetVelocityStateMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetVelocityStateMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); - message->velocityXMps = newJausDouble(0); // Scaled Int (-65.534, 65.534) Mps = Meters per Second - message->velocityYMps = newJausDouble(0); // Scaled Int (-65.534, 65.534) Mps = Meters per Second - message->velocityZMps = newJausDouble(0); // Scaled Int (-65.534, 65.534) Mps = Meters per Secon - message->velocityRmsMps = newJausDouble(0); // Scaled UInt (0, 100) Mps = Meters per Second - message->rollRateRps = newJausDouble(0); // Scaled Short (-32.767, 32.767) Rps = Radians per Second - message->pitchRateRps = newJausDouble(0); // Scaled Short (-32.767, 32.767) Rps = Radians per Second - message->yawRateRps = newJausDouble(0); // Scaled Short (-32.767, 32.767) Rps = Radians per Second - message->rateRmsRps = newJausDouble(0); // Scaled UShort (0, JAUS_PI) Rps = Radians per Second - message->timeStamp = newJausUnsignedInteger(0); -} - -// Destructs the message-specific fields -static void dataDestroy(SetVelocityStateMessage message) -{ - // Free message fields - // None -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInt; - JausShort tempShort; - JausUnsignedShort tempUShort; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Use Presence Vector - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_X_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-65.534, 65.534) - message->velocityXMps = jausIntegerToDouble(tempInt, -65.534, 65.534); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_Y_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-65.534, 65.534) - message->velocityYMps = jausIntegerToDouble(tempInt, -65.534, 65.534); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_Z_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-65.534, 65.534) - message->velocityZMps = jausIntegerToDouble(tempInt, -65.534, 65.534); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_RMS_BIT)) - { - //unpack - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Scaled UInt (0, 100) - message->velocityRmsMps = jausUnsignedIntegerToDouble(tempUInt, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_ROLL_RATE_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (-32.767, 32.767) - message->rollRateRps = jausShortToDouble(tempShort, -32.767, 32.767); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_PITCH_RATE_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (-32.767, 32.767) - message->pitchRateRps = jausShortToDouble(tempShort, -32.767, 32.767); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_YAW_RATE_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (-32.767, 32.767) - message->yawRateRps = jausShortToDouble(tempShort, -32.767, 32.767); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_RATE_RMS_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, JAUS_PI) - message->rateRmsRps = jausUnsignedShortToDouble(tempUShort, 0, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_TIME_STAMP_BIT)) - { - //unpack - if(!jausUnsignedIntegerFromBuffer(&message->timeStamp, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInt; - JausShort tempShort; - JausUnsignedShort tempUShort; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Use Presence Vector - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_X_BIT)) - { - // Scaled Int (-65.534, 65.534) - tempInt = jausIntegerFromDouble(message->velocityXMps, -65.534, 65.534); - - //pack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_Y_BIT)) - { - // Scaled Int (-65.534, 65.534) - tempInt = jausIntegerFromDouble(message->velocityYMps, -65.534, 65.534); - - //pack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_Z_BIT)) - { - // Scaled Int (-65.534, 65.534) - tempInt = jausIntegerFromDouble(message->velocityZMps, -65.534, 65.534); - - //pack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_RMS_BIT)) - { - // Scaled UInt (0, 100) - tempUInt = jausUnsignedIntegerFromDouble(message->velocityRmsMps, 0, 100); - - //pack - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_ROLL_RATE_BIT)) - { - // Scaled Short (-32.767, 32.767) - tempShort = jausShortFromDouble(message->rollRateRps, -32.767, 32.767); - - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_PITCH_RATE_BIT)) - { - // Scaled Short (-32.767, 32.767) - tempShort = jausShortFromDouble(message->pitchRateRps, -32.767, 32.767); - - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_YAW_RATE_BIT)) - { - // Scaled Unsigned Short (-32.767, 32.767) - tempShort = jausShortFromDouble(message->yawRateRps, -32.767, 32.767); - - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_RATE_RMS_BIT)) - { - // Scaled Unsigned Short (0, JAUS_PI) - tempUShort = jausUnsignedShortFromDouble(message->rateRmsRps, 0, JAUS_PI); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_TIME_STAMP_BIT)) - { - //pack - if(!jausUnsignedIntegerToBuffer(message->timeStamp, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - return index; -} - -static unsigned int dataSize(SetVelocityStateMessage message) -{ - int index = 0; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_X_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_Y_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_Z_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_RMS_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_ROLL_RATE_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_PITCH_RATE_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_YAW_RATE_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_RATE_RMS_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_TIME_STAMP_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - return index; - -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetVelocityStateMessage setVelocityStateMessageCreate(void) -{ - SetVelocityStateMessage message; - - message = (SetVelocityStateMessage)malloc( sizeof(SetVelocityStateMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setVelocityStateMessageDestroy(SetVelocityStateMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setVelocityStateMessageFromBuffer(SetVelocityStateMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setVelocityStateMessageToBuffer(SetVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setVelocityStateMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetVelocityStateBuffer failed - } - } -} - -SetVelocityStateMessage setVelocityStateMessageFromJausMessage(JausMessage jausMessage) -{ - SetVelocityStateMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetVelocityStateMessage)malloc( sizeof(SetVelocityStateMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setVelocityStateMessageToJausMessage(SetVelocityStateMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int setVelocityStateMessageSize(SetVelocityStateMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/platform/setWrenchEffortMessage.c b/lib/openjaus/libjaus/src/message/command/platform/setWrenchEffortMessage.c deleted file mode 100644 index 4413c11ec17a0a81772b6209101343159a48e7a0..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/platform/setWrenchEffortMessage.c +++ /dev/null @@ -1,674 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setWrenchEffortMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetWrenchEffortMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_WRENCH_EFFORT; -static const int maxDataSizeBytes = 20; - -static JausBoolean headerFromBuffer(SetWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetWrenchEffortMessage message); -static unsigned int dataSize(SetWrenchEffortMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetWrenchEffortMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); - - message->propulsiveLinearEffortXPercent = newJausDouble(0); // Scaled Short (-100, 100) - message->propulsiveLinearEffortYPercent = newJausDouble(0); // Scaled Short (-100, 100) - message->propulsiveLinearEffortZPercent = newJausDouble(0); // Scaled Short (-100, 100) - message->propulsiveRotationalEffortXPercent = newJausDouble(0); // Scaled Short (-100, 100) - message->propulsiveRotationalEffortYPercent = newJausDouble(0); // Scaled Short (-100, 100) - message->propulsiveRotationalEffortZPercent = newJausDouble(0); // Scaled Short (-100, 100) - - message->resistiveLinearEffortXPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->resistiveLinearEffortYPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->resistiveLinearEffortZPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->resistiveRotationalEffortXPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->resistiveRotationalEffortYPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->resistiveRotationalEffortZPercent = newJausDouble(0); // Scaled Byte (0, 100) -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausShort tempShort; - JausByte tempByte; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Unpack according to presence vector - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_X_BIT)) - { - // unpack propulsive linear effort X - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->propulsiveLinearEffortXPercent = jausShortToDouble(tempShort, -100, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Y_BIT)) - { - // unpack propulsive linear effort Y - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->propulsiveLinearEffortYPercent = jausShortToDouble(tempShort, -100, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Z_BIT)) - { - // unpack propulsive linear effort Z - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->propulsiveLinearEffortZPercent = jausShortToDouble(tempShort, -100, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_X_BIT)) - { - // unpack propulsive rotational effort X - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->propulsiveRotationalEffortXPercent = jausShortToDouble(tempShort, -100, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Y_BIT)) - { - // unpack propulsive rotational effort Y - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->propulsiveRotationalEffortYPercent = jausShortToDouble(tempShort, -100, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Z_BIT)) - { - // unpack propulsive rotational effort Z - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->propulsiveRotationalEffortZPercent = jausShortToDouble(tempShort, -100, 100); - } - - // Resistive - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_X_BIT)) - { - // unpack resistive linear effort X - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->resistiveLinearEffortXPercent = jausByteToDouble(tempByte, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_Y_BIT)) - { - // unpack resistive linear effort Y - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->resistiveLinearEffortYPercent = jausByteToDouble(tempByte, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_Z_BIT)) - { - // unpack resistive linear effort Z - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->resistiveLinearEffortZPercent = jausByteToDouble(tempByte, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_X_BIT)) - { - // unpack resistive rotational effort X - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->resistiveRotationalEffortXPercent = jausByteToDouble(tempByte, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Y_BIT)) - { - // unpack resistive rotational effort Y - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->resistiveRotationalEffortYPercent = jausByteToDouble(tempByte, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Z_BIT)) - { - // unpack resistive rotational effort Z - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->resistiveRotationalEffortZPercent = jausByteToDouble(tempByte, 0, 100); - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausShort tempShort; - JausByte tempByte; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Pack according to Presence Vector - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_X_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->propulsiveLinearEffortXPercent, -100, 100); - - // pack propulsive linear effort X - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Y_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->propulsiveLinearEffortYPercent, -100, 100); - - // pack propulsive linear effort Y - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Z_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->propulsiveLinearEffortZPercent, -100, 100); - - // pack propulsive linear effort Z - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_X_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->propulsiveRotationalEffortXPercent, -100, 100); - - // pack propulsive rotational effort X - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Y_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->propulsiveRotationalEffortYPercent, -100, 100); - - // pack propulsive rotational effort Y - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Z_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->propulsiveRotationalEffortZPercent, -100, 100); - - // pack propulsive rotational effort Z - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - // Resistive - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_X_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->resistiveLinearEffortXPercent, 0, 100); - - // pack resistive linear effort X - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_Y_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->resistiveLinearEffortYPercent, 0, 100); - - // pack resistive linear effort Y - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_Z_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->resistiveLinearEffortZPercent, 0, 100); - - // pack resistive linear effort Z - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_X_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->resistiveRotationalEffortXPercent, 0, 100); - - // pack resistive rotational effort X - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Y_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->resistiveRotationalEffortYPercent, 0, 100); - - // pack resistive rotational effort Y - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Z_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->resistiveRotationalEffortZPercent, 0, 100); - - // pack resistive rotational effort Z - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - } - return index; -} - -static unsigned int dataSize(SetWrenchEffortMessage message) -{ - int index = 0; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_X_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Y_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Z_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_X_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Y_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Z_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_X_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_Y_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_Z_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_X_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Y_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Z_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetWrenchEffortMessage setWrenchEffortMessageCreate(void) -{ - SetWrenchEffortMessage message; - - message = (SetWrenchEffortMessage)malloc( sizeof(SetWrenchEffortMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setWrenchEffortMessageDestroy(SetWrenchEffortMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setWrenchEffortMessageFromBuffer(SetWrenchEffortMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setWrenchEffortMessageToBuffer(SetWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setWrenchEffortMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetWrenchEffortBuffer failed - } - } -} - -SetWrenchEffortMessage setWrenchEffortMessageFromJausMessage(JausMessage jausMessage) -{ - SetWrenchEffortMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetWrenchEffortMessage)malloc( sizeof(SetWrenchEffortMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setWrenchEffortMessageToJausMessage(SetWrenchEffortMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int setWrenchEffortMessageSize(SetWrenchEffortMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/worldModel/createVksObjectsMessage.c b/lib/openjaus/libjaus/src/message/command/worldModel/createVksObjectsMessage.c deleted file mode 100644 index 5f2d484e637c2ea06454ba1ae1a96743037ba9c4..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/worldModel/createVksObjectsMessage.c +++ /dev/null @@ -1,438 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: createVksObjectsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a CreateVksObjectsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_CREATE_VKS_OBJECTS; -static const int maxDataSizeBytes = 512000; // Max Message size: 500K - -static JausBoolean headerFromBuffer(CreateVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(CreateVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(CreateVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(CreateVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(CreateVksObjectsMessage message); -static void dataDestroy(CreateVksObjectsMessage message); -static unsigned int dataSize(CreateVksObjectsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(CreateVksObjectsMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); // presenceVector - message->messageProperties = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); // Bit Field, use Presence Vector for ease - message->requestId = newJausByte(0); // Local Request ID - message->vectorObjects = jausArrayCreate(); // Dynamic Array of Vector Objects -} - -// Destructs the message-specific fields -static void dataDestroy(CreateVksObjectsMessage message) -{ - // Free message fields - if(message->vectorObjects) jausArrayDestroy(message->vectorObjects, (void *)vectorObjectDestroy); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(CreateVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i = 0; - JausUnsignedShort objectCount; - JausBoolean objectBuffered = JAUS_FALSE; - JausWorldModelVectorObject object = NULL; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - objectBuffered = jausByteIsBitSet(message->presenceVector, VKS_PV_CREATE_BUFFERED_BIT); - - // Message Properties - if(!jausByteFromBuffer(&message->messageProperties, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Local Request Id - if(!jausByteFromBuffer(&message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Number of Objects - if(!jausUnsignedShortFromBuffer(&objectCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - message->vectorObjects = jausArrayCreate(); - if(!message->vectorObjects) return JAUS_FALSE; - - for(i = 0; i < objectCount; i++) - { - object = vectorObjectFromBuffer(buffer+index, bufferSizeBytes-index, objectBuffered); - if(!object) return JAUS_FALSE; - index += vectorObjectSizeBytes(object, objectBuffered); - jausArrayAdd(message->vectorObjects, object); - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(CreateVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i = 0; - JausBoolean objectBuffered; - JausWorldModelVectorObject object; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - objectBuffered = jausByteIsBitSet(message->presenceVector, VKS_PV_CREATE_BUFFERED_BIT); - - // Message Properties - if(!jausByteToBuffer(message->messageProperties, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Local Request Id - if(!jausByteToBuffer(message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Number of Objects - if(!jausUnsignedShortToBuffer((JausUnsignedShort)message->vectorObjects->elementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - for(i = 0; i < message->vectorObjects->elementCount; i++) - { - object = (JausWorldModelVectorObject) message->vectorObjects->elementData[i]; - if(!vectorObjectToBuffer(object, buffer+index, bufferSizeBytes-index, objectBuffered)) return JAUS_FALSE; - index += vectorObjectSizeBytes(object, objectBuffered); - } - } - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(CreateVksObjectsMessage message) -{ - int index = 0; - int i = 0; - JausBoolean objectBuffered; - JausWorldModelVectorObject object; - - // Presence Vector - index += JAUS_BYTE_SIZE_BYTES; - - objectBuffered = jausByteIsBitSet(message->presenceVector, VKS_PV_CREATE_BUFFERED_BIT); - - // Message Properties - index += JAUS_BYTE_SIZE_BYTES; - - // Local Request Id - index += JAUS_BYTE_SIZE_BYTES; - - // Number of Objects - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - for(i = 0; i < message->vectorObjects->elementCount; i++) - { - object = (JausWorldModelVectorObject) message->vectorObjects->elementData[i]; - index += vectorObjectSizeBytes(object, objectBuffered); - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -CreateVksObjectsMessage createVksObjectsMessageCreate(void) -{ - CreateVksObjectsMessage message; - - message = (CreateVksObjectsMessage)malloc( sizeof(CreateVksObjectsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void createVksObjectsMessageDestroy(CreateVksObjectsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean createVksObjectsMessageFromBuffer(CreateVksObjectsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean createVksObjectsMessageToBuffer(CreateVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < createVksObjectsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToCreateVksObjectsBuffer failed - } - } -} - -CreateVksObjectsMessage createVksObjectsMessageFromJausMessage(JausMessage jausMessage) -{ - CreateVksObjectsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (CreateVksObjectsMessage)malloc( sizeof(CreateVksObjectsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage createVksObjectsMessageToJausMessage(CreateVksObjectsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int createVksObjectsMessageSize(CreateVksObjectsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(CreateVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(CreateVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/worldModel/deleteVksObjectsMessage.c b/lib/openjaus/libjaus/src/message/command/worldModel/deleteVksObjectsMessage.c deleted file mode 100644 index 7857b872db42173f106aebb684c03aaed9a9e591..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/worldModel/deleteVksObjectsMessage.c +++ /dev/null @@ -1,720 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: deleteVksObjectsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a DeleteVksObjectsMessage - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_DELETE_VKS_OBJECTS; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(DeleteVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(DeleteVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(DeleteVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(DeleteVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(DeleteVksObjectsMessage message); -static void dataDestroy(DeleteVksObjectsMessage message); -static unsigned int dataSize(DeleteVksObjectsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(DeleteVksObjectsMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->requestId = newJausByte(0); - message->objectCount = newJausUnsignedShort(0); - message->objectIds = NULL; - message->deletionRegion = vectorObjectCreate(); -} - -// Destructs the message-specific fields -static void dataDestroy(DeleteVksObjectsMessage message) -{ - // Free message fields - if(message->objectIds) - free(message->objectIds); - - vectorObjectDestroy(message->deletionRegion); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(DeleteVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i = 0; - JausByte featureClassCount; - JausUnsignedShort dataPointCount; - JausInteger tempInt; - JausWorldModelFeatureClass fcClass = NULL; - JausGeometryPointLLA point = NULL; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request Id - if(!jausByteFromBuffer(&message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Test if objectCount is specified - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_ID_BIT)) - { - // Request Id - if(!jausUnsignedShortFromBuffer(&message->objectCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Allocate memory for objectIds - message->objectIds = (JausUnsignedInteger *)malloc(message->objectCount * JAUS_UNSIGNED_INTEGER_SIZE_BYTES); - - // Unpack Object Ids - for(i = 0; i < message->objectCount; i++) - { - if(!jausUnsignedIntegerFromBuffer(&message->objectIds[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - // Create the DeletionRegion object - message->deletionRegion = vectorObjectCreate(); - if(!message->deletionRegion) return JAUS_FALSE; - - // Test if a deletionRegion is specified - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_REGION_BIT)) - { - // Unpack Region Type - if(!jausByteFromBuffer(&message->deletionRegion->type, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Buffer is optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_REGION_BIT)) - { - // Unpack Buffer - if(!jausFloatFromBuffer(&message->deletionRegion->bufferMeters, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_FLOAT_SIZE_BYTES; - } - } - - // Test if Feature Class provided - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_FC_COUNT_BIT)) - { - // FC Count - if(!jausByteFromBuffer(&featureClassCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i = 0; i < featureClassCount; i++) - { - // Create JausWorldModelFeatureClass Object - fcClass = featureClassCreate(); - if(!fcClass) return JAUS_FALSE; - - // This should ALWAYS be true, because VKS_PV_DELETE_OBJECTS_FC_COUNT_BIT is set - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_FEATURE_CLASS_BIT)) - { - // Unpack FC Id - if(!jausUnsignedShortFromBuffer(&fcClass->id, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_ATTRIBUTE_BIT)) - { - //Destroy the Attribute created by featureClassCreate - featureClassAttributeDestroy(fcClass->attribute); - - // Unpack Attribute Data Type & Value - fcClass->attribute = featureClassAttributeFromBuffer(buffer+index, bufferSizeBytes-index); - if(!fcClass->attribute) return JAUS_FALSE; - index += featureClassAttributeSizeBytes(fcClass->attribute); - } - - // Add FC to array - jausArrayAdd(message->deletionRegion->featureClasses, fcClass); - } - } - - // Test if region points specified - // This should be true if the VKS_PV_DELETE_OBJECTS_REGION_BIT is set - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_POINT_COUNT_BIT)) - { - // Unpack Point Count - if(!jausUnsignedShortFromBuffer(&dataPointCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - for(i = 0; i < dataPointCount; i++) - { - point = jausGeometryPointLLACreate(); - if(!point) return JAUS_FALSE; - - // unpack Latitude - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-90, 90) - point->latitudeRadians = jausIntegerToDouble(tempInt, -90, 90) * JAUS_RAD_PER_DEG; - - // unpack Latitude - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-180, 180) - point->longitudeRadians = jausIntegerToDouble(tempInt, -180, 180) * JAUS_RAD_PER_DEG; - - jausArrayAdd(message->deletionRegion->dataPoints, point); - } - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(DeleteVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - unsigned int index = 0; - int i = 0; - JausWorldModelFeatureClass fcClass = NULL; - JausGeometryPointLLA point = NULL; - JausInteger tempInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Ensure the PV rules are met - // If the VKS_PV_DELETE_OBJECTS_REGION_BIT is set, then the VKS_PV_DELETE_OBJECTS_POINT_COUNT_BIT is required - // The VKS_PV_DELETE_OBJECTS_BUFFER_BIT cannot be set without the VKS_PV_DELETE_OBJECTS_REGION_BIT - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_REGION_BIT)) - { - jausByteSetBit(&message->presenceVector, VKS_PV_DELETE_OBJECTS_POINT_COUNT_BIT); - } - else - { - jausByteClearBit(&message->presenceVector, VKS_PV_DELETE_OBJECTS_POINT_COUNT_BIT); - jausByteClearBit(&message->presenceVector, VKS_PV_DELETE_OBJECTS_BUFFER_BIT); - } - - // If the VKS_PV_DELETE_OBJECTS_FEATURE_CLASS_BIT is set or the VKS_PV_DELETE_OBJECTS_ATTRIBUTE_BIT is set, - // then the VKS_PV_DELETE_OBJECTS_FC_COUNT_BIT is required - if( jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_ATTRIBUTE_BIT) || - jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_FEATURE_CLASS_BIT)) - { - jausByteSetBit(&message->presenceVector, VKS_PV_DELETE_OBJECTS_FC_COUNT_BIT); - } - else - { - jausByteClearBit(&message->presenceVector, VKS_PV_DELETE_OBJECTS_FC_COUNT_BIT); - } - - // Pack Message Fields to Buffer - // Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request Id - if(!jausByteToBuffer(message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // objectCount is optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_ID_BIT)) - { - // Object Count - if(!jausUnsignedShortToBuffer(message->objectCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Pack Object Ids - for(i = 0; i < message->objectCount; i++) - { - if(!jausUnsignedIntegerToBuffer(message->objectIds[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - // Region is Optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_REGION_BIT)) - { - // Region Type - if(!jausByteToBuffer(message->deletionRegion->type, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Buffer is Optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_REGION_BIT)) - { - // Buffer - if(!jausFloatToBuffer(message->deletionRegion->bufferMeters, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_FLOAT_SIZE_BYTES; - } - } - - // Feature Class Information is optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_FC_COUNT_BIT)) - { - // Feature Class Count - if(!jausByteToBuffer((JausByte)message->deletionRegion->featureClasses->elementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_FEATURE_CLASS_BIT)) - { - for(i = 0; i < message->deletionRegion->featureClasses->elementCount; i++) - { - fcClass = (JausWorldModelFeatureClass) message->deletionRegion->featureClasses->elementData[i]; - - // Feature Class Id - if(!jausUnsignedShortToBuffer(fcClass->id, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Attribute is Optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_ATTRIBUTE_BIT)) - { - if(!featureClassAttributeToBuffer(fcClass->attribute, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += featureClassAttributeSizeBytes(fcClass->attribute); - } - } - } - else if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_ATTRIBUTE_BIT)) - { - for(i = 0; i < message->deletionRegion->featureClasses->elementCount; i++) - { - fcClass = (JausWorldModelFeatureClass) message->deletionRegion->featureClasses->elementData[i]; - - if(!featureClassAttributeToBuffer(fcClass->attribute, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += featureClassAttributeSizeBytes(fcClass->attribute); - } - } - - // Region is optional, if VKS_PV_DELETE_OBJECTS_REGION_BIT set, points required - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_POINT_COUNT_BIT)) - { - // Point Count - if(!jausUnsignedShortToBuffer((JausUnsignedShort)message->deletionRegion->dataPoints->elementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - for(i = 0; i < message->deletionRegion->dataPoints->elementCount; i++) - { - point = (JausGeometryPointLLA) message->deletionRegion->dataPoints->elementData[i]; - - // Scaled Int (-90, 90) - tempInt = jausIntegerFromDouble((point->latitudeRadians * JAUS_DEG_PER_RAD), -90, 90); - - //pack Latitude - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-180, 180) - tempInt = jausIntegerFromDouble((point->longitudeRadians * JAUS_DEG_PER_RAD), -180, 180); - - //pack Longitude - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - } - } - - return index; -} - -static unsigned int dataSize(DeleteVksObjectsMessage message) -{ - unsigned int index = 0; - int i = 0; - JausWorldModelFeatureClass fcClass = NULL; - - // Ensure the PV rules are met - // If the VKS_PV_DELETE_OBJECTS_REGION_BIT is set, then the VKS_PV_DELETE_OBJECTS_POINT_COUNT_BIT is required - // The VKS_PV_DELETE_OBJECTS_BUFFER_BIT cannot be set without the VKS_PV_DELETE_OBJECTS_REGION_BIT - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_REGION_BIT)) - { - jausByteSetBit(&message->presenceVector, VKS_PV_DELETE_OBJECTS_POINT_COUNT_BIT); - } - else - { - jausByteClearBit(&message->presenceVector, VKS_PV_DELETE_OBJECTS_POINT_COUNT_BIT); - jausByteClearBit(&message->presenceVector, VKS_PV_DELETE_OBJECTS_BUFFER_BIT); - } - - // If the VKS_PV_DELETE_OBJECTS_FEATURE_CLASS_BIT is set or the VKS_PV_DELETE_OBJECTS_ATTRIBUTE_BIT is set, - // then the VKS_PV_DELETE_OBJECTS_FC_COUNT_BIT is required - if( jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_ATTRIBUTE_BIT) || - jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_FEATURE_CLASS_BIT)) - { - jausByteSetBit(&message->presenceVector, VKS_PV_DELETE_OBJECTS_FC_COUNT_BIT); - } - else - { - jausByteClearBit(&message->presenceVector, VKS_PV_DELETE_OBJECTS_FC_COUNT_BIT); - } - - // Pack Message Fields to Buffer - // Presence Vector - index += JAUS_BYTE_SIZE_BYTES; - - // Request Id - index += JAUS_BYTE_SIZE_BYTES; - - // objectCount is optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_ID_BIT)) - { - // Object Count - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Pack Object Ids - for(i = 0; i < message->objectCount; i++) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - // Region is Optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_REGION_BIT)) - { - // Region Type - index += JAUS_BYTE_SIZE_BYTES; - - // Buffer is Optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_REGION_BIT)) - { - // Buffer - index += JAUS_FLOAT_SIZE_BYTES; - } - } - - // Feature Class Information is optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_FC_COUNT_BIT)) - { - // Feature Class Count - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_FEATURE_CLASS_BIT)) - { - for(i = 0; i < message->deletionRegion->featureClasses->elementCount; i++) - { - fcClass = (JausWorldModelFeatureClass) message->deletionRegion->featureClasses->elementData[i]; - - // Feature Class Id - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Attribute is Optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_ATTRIBUTE_BIT)) - { - index += featureClassAttributeSizeBytes(fcClass->attribute); - } - } - } - else if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_ATTRIBUTE_BIT)) - { - for(i = 0; i < message->deletionRegion->featureClasses->elementCount; i++) - { - fcClass = (JausWorldModelFeatureClass) message->deletionRegion->featureClasses->elementData[i]; - - index += featureClassAttributeSizeBytes(fcClass->attribute); - } - } - - // Region is optional, if VKS_PV_DELETE_OBJECTS_REGION_BIT set, points required - if(jausByteIsBitSet(message->presenceVector, VKS_PV_DELETE_OBJECTS_POINT_COUNT_BIT)) - { - // Point Count - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - for(i = 0; i < message->deletionRegion->dataPoints->elementCount; i++) - { - //Latitude - index += JAUS_INTEGER_SIZE_BYTES; - - //Longitude - index += JAUS_INTEGER_SIZE_BYTES; - } - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -DeleteVksObjectsMessage deleteVksObjectsMessageCreate(void) -{ - DeleteVksObjectsMessage message; - - message = (DeleteVksObjectsMessage)malloc( sizeof(DeleteVksObjectsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void deleteVksObjectsMessageDestroy(DeleteVksObjectsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean deleteVksObjectsMessageFromBuffer(DeleteVksObjectsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean deleteVksObjectsMessageToBuffer(DeleteVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < deleteVksObjectsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToDeleteVksObjectsBuffer failed - } - } -} - -DeleteVksObjectsMessage deleteVksObjectsMessageFromJausMessage(JausMessage jausMessage) -{ - DeleteVksObjectsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (DeleteVksObjectsMessage)malloc( sizeof(DeleteVksObjectsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage deleteVksObjectsMessageToJausMessage(DeleteVksObjectsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int deleteVksObjectsMessageSize(DeleteVksObjectsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(DeleteVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(DeleteVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/worldModel/setVksFeatureClassMetadataMessage.c b/lib/openjaus/libjaus/src/message/command/worldModel/setVksFeatureClassMetadataMessage.c deleted file mode 100644 index 8501e1702db2f861a332f13cdc2ba6f9631fda2b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/worldModel/setVksFeatureClassMetadataMessage.c +++ /dev/null @@ -1,441 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: setVksFeatureClassMetadataMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a SetVksFeatureClassMetadataMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_SET_VKS_FEATURE_CLASS_METADATA; -static const int maxDataSizeBytes = 65540; - -static JausBoolean headerFromBuffer(SetVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(SetVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(SetVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(SetVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(SetVksFeatureClassMetadataMessage message); -static void dataDestroy(SetVksFeatureClassMetadataMessage message); -static unsigned int dataSize(SetVksFeatureClassMetadataMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(SetVksFeatureClassMetadataMessage message) -{ - // Set initial values of message fields - message->metadataOptions = JAUS_METADATA_APPEND; - message->featureClassID = newJausUnsignedShort(0); - message->featureClassMetadataString = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(SetVksFeatureClassMetadataMessage message) -{ - // Free message fields - if(message->featureClassMetadataString) free(message->featureClassMetadataString); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(SetVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausByte tempByte = 0; - JausUnsignedShort stringLength = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - // Metadata Options - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - message->metadataOptions = tempByte; - - // Feature Class ID - if(!jausUnsignedShortFromBuffer(&message->featureClassID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // String Length - if(!jausUnsignedShortFromBuffer(&stringLength, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(bufferSizeBytes-index >= stringLength) - { - message->featureClassMetadataString = (char *)malloc(stringLength); - memcpy(message->featureClassMetadataString, buffer+index, stringLength); - index += stringLength; - } - else - { - return JAUS_FALSE; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(SetVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausByte tempByte; - JausUnsignedShort stringLength = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - // Metadata Options - tempByte = message->metadataOptions; - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Feature Class ID - if(!jausUnsignedShortToBuffer(message->featureClassID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // String Length - if(message->featureClassMetadataString) - { - stringLength = (JausUnsignedShort) strlen(message->featureClassMetadataString); - } - else - { - stringLength = 0; - } - - if(!jausUnsignedShortToBuffer(stringLength, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(bufferSizeBytes-index >= stringLength) - { - if(message->featureClassMetadataString) - { - message->featureClassMetadataString = (char *)realloc(message->featureClassMetadataString, stringLength); - } - else - { - message->featureClassMetadataString = (char *)malloc(stringLength); - } - - memcpy(message->featureClassMetadataString, buffer+index, stringLength); - index += stringLength; - } - else - { - return JAUS_FALSE; - } - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(SetVksFeatureClassMetadataMessage message) -{ - int index = 0; - - // Metadata Options - index += JAUS_BYTE_SIZE_BYTES; - - // Feature Class ID - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // String Length - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // MetaData String - if(message->featureClassMetadataString) - { - index += (int) strlen(message->featureClassMetadataString); - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -SetVksFeatureClassMetadataMessage setVksFeatureClassMetadataMessageCreate(void) -{ - SetVksFeatureClassMetadataMessage message; - - message = (SetVksFeatureClassMetadataMessage)malloc( sizeof(SetVksFeatureClassMetadataMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void setVksFeatureClassMetadataMessageDestroy(SetVksFeatureClassMetadataMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean setVksFeatureClassMetadataMessageFromBuffer(SetVksFeatureClassMetadataMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean setVksFeatureClassMetadataMessageToBuffer(SetVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < setVksFeatureClassMetadataMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToSetVksFeatureClassMetadataBuffer failed - } - } -} - -SetVksFeatureClassMetadataMessage setVksFeatureClassMetadataMessageFromJausMessage(JausMessage jausMessage) -{ - SetVksFeatureClassMetadataMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (SetVksFeatureClassMetadataMessage)malloc( sizeof(SetVksFeatureClassMetadataMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage setVksFeatureClassMetadataMessageToJausMessage(SetVksFeatureClassMetadataMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int setVksFeatureClassMetadataMessageSize(SetVksFeatureClassMetadataMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(SetVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(SetVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/command/worldModel/terminateVksDataTransferMessage.c b/lib/openjaus/libjaus/src/message/command/worldModel/terminateVksDataTransferMessage.c deleted file mode 100644 index 6e68fe8a72ac84ea5d9f862bb6ea94864ef9870e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/command/worldModel/terminateVksDataTransferMessage.c +++ /dev/null @@ -1,350 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: terminateVksDataTransferMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a TerminateVksDataTransferMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_TERMINATE_VKS_DATA_TRANSFER; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(TerminateVksDataTransferMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(TerminateVksDataTransferMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(TerminateVksDataTransferMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(TerminateVksDataTransferMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(TerminateVksDataTransferMessage message); -static void dataDestroy(TerminateVksDataTransferMessage message); -static unsigned int dataSize(TerminateVksDataTransferMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(TerminateVksDataTransferMessage message) -{ - // Set initial values of message fields - -} - -// Destructs the message-specific fields -static void dataDestroy(TerminateVksDataTransferMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(TerminateVksDataTransferMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(TerminateVksDataTransferMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(TerminateVksDataTransferMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -TerminateVksDataTransferMessage terminateVksDataTransferMessageCreate(void) -{ - TerminateVksDataTransferMessage message; - - message = (TerminateVksDataTransferMessage)malloc( sizeof(TerminateVksDataTransferMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void terminateVksDataTransferMessageDestroy(TerminateVksDataTransferMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean terminateVksDataTransferMessageFromBuffer(TerminateVksDataTransferMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean terminateVksDataTransferMessageToBuffer(TerminateVksDataTransferMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < terminateVksDataTransferMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToTerminateVksDataTransferMessageBuffer failed - } - } -} - -TerminateVksDataTransferMessage terminateVksDataTransferMessageFromJausMessage(JausMessage jausMessage) -{ - TerminateVksDataTransferMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (TerminateVksDataTransferMessage)malloc( sizeof(TerminateVksDataTransferMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage terminateVksDataTransferMessageToJausMessage(TerminateVksDataTransferMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int terminateVksDataTransferMessageSize(TerminateVksDataTransferMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(TerminateVksDataTransferMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(TerminateVksDataTransferMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/communications/reportDataLinkStatusMessage.c b/lib/openjaus/libjaus/src/message/inform/communications/reportDataLinkStatusMessage.c deleted file mode 100644 index fb9daed1fc67c65eac7822dff8a62168448ea107..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/communications/reportDataLinkStatusMessage.c +++ /dev/null @@ -1,365 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportDataLinkStatusMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportDataLinkStatusMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_DATA_LINK_STATUS; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(ReportDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportDataLinkStatusMessage message); -static void dataDestroy(ReportDataLinkStatusMessage message); -static unsigned int dataSize(ReportDataLinkStatusMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportDataLinkStatusMessage message) -{ - - message->dataLinkId = newJausByte(0); - message->dataLinkState = JAUS_DATA_LINK_ON; // Data link on by default -} - -// Destructs the message-specific fields -static void dataDestroy(ReportDataLinkStatusMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausByte tempByte = 0; - - if(bufferSizeBytes == message->dataSize) - { - if(!jausByteFromBuffer(&message->dataLinkId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->dataLinkState = tempByte; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->dataLinkId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(((JausByte)message->dataLinkState), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportDataLinkStatusMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportDataLinkStatusMessage reportDataLinkStatusMessageCreate(void) -{ - ReportDataLinkStatusMessage message; - - message = (ReportDataLinkStatusMessage)malloc( sizeof(ReportDataLinkStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportDataLinkStatusMessageDestroy(ReportDataLinkStatusMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportDataLinkStatusMessageFromBuffer(ReportDataLinkStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportDataLinkStatusMessageToBuffer(ReportDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportDataLinkStatusMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportDataLinkStatusBuffer failed - } - } -} - -ReportDataLinkStatusMessage reportDataLinkStatusMessageFromJausMessage(JausMessage jausMessage) -{ - ReportDataLinkStatusMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportDataLinkStatusMessage)malloc( sizeof(ReportDataLinkStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportDataLinkStatusMessageToJausMessage(ReportDataLinkStatusMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportDataLinkStatusMessageSize(ReportDataLinkStatusMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/communications/reportHeartbeatPulseMessage.c b/lib/openjaus/libjaus/src/message/inform/communications/reportHeartbeatPulseMessage.c deleted file mode 100644 index 386a67fd94e6487ee99db6138567f09d9cd51389..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/communications/reportHeartbeatPulseMessage.c +++ /dev/null @@ -1,326 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportHeartbeatPulseMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportHeartbeatPulseMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_HEARTBEAT_PULSE; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(ReportHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportHeartbeatPulseMessage message); -static unsigned int dataSize(ReportHeartbeatPulseMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportHeartbeatPulseMessage message) -{ - // No Data To Initialize -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - return JAUS_TRUE; -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - // No Data To Pack - return 0; -} - -static unsigned int dataSize(ReportHeartbeatPulseMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportHeartbeatPulseMessage reportHeartbeatPulseMessageCreate(void) -{ - ReportHeartbeatPulseMessage message; - - message = (ReportHeartbeatPulseMessage)malloc( sizeof(ReportHeartbeatPulseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void reportHeartbeatPulseMessageDestroy(ReportHeartbeatPulseMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportHeartbeatPulseMessageFromBuffer(ReportHeartbeatPulseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportHeartbeatPulseMessageToBuffer(ReportHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportHeartbeatPulseMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportHeartbeatPulseBuffer failed - } - } -} - -ReportHeartbeatPulseMessage reportHeartbeatPulseMessageFromJausMessage(JausMessage jausMessage) -{ - ReportHeartbeatPulseMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportHeartbeatPulseMessage)malloc( sizeof(ReportHeartbeatPulseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportHeartbeatPulseMessageToJausMessage(ReportHeartbeatPulseMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportHeartbeatPulseMessageSize(ReportHeartbeatPulseMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/communications/reportSelectedDataLinkStatusMessage.c b/lib/openjaus/libjaus/src/message/inform/communications/reportSelectedDataLinkStatusMessage.c deleted file mode 100644 index ad176109a3da396779c0de891329db3303f1dc83..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/communications/reportSelectedDataLinkStatusMessage.c +++ /dev/null @@ -1,356 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportSelectedDataLinkStatusMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportSelectedDataLinkStatusMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_SELECTED_DATA_LINK_STATUS; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(ReportSelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportSelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportSelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportSelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportSelectedDataLinkStatusMessage message); -static void dataDestroy(ReportSelectedDataLinkStatusMessage message); -static unsigned int dataSize(ReportSelectedDataLinkStatusMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportSelectedDataLinkStatusMessage message) -{ - - message->dataLinkId = newJausByte(0); // Data link on by default -} - -// Destructs the message-specific fields -static void dataDestroy(ReportSelectedDataLinkStatusMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportSelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - if(!jausByteFromBuffer(&message->dataLinkId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportSelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->dataLinkId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportSelectedDataLinkStatusMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportSelectedDataLinkStatusMessage reportSelectedDataLinkStatusMessageCreate(void) -{ - ReportSelectedDataLinkStatusMessage message; - - message = (ReportSelectedDataLinkStatusMessage)malloc( sizeof(ReportSelectedDataLinkStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportSelectedDataLinkStatusMessageDestroy(ReportSelectedDataLinkStatusMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportSelectedDataLinkStatusMessageFromBuffer(ReportSelectedDataLinkStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportSelectedDataLinkStatusMessageToBuffer(ReportSelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportSelectedDataLinkStatusMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportSelectedDataLinkStatusBuffer failed - } - } -} - -ReportSelectedDataLinkStatusMessage reportSelectedDataLinkStatusMessageFromJausMessage(JausMessage jausMessage) -{ - ReportSelectedDataLinkStatusMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportSelectedDataLinkStatusMessage)malloc( sizeof(ReportSelectedDataLinkStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportSelectedDataLinkStatusMessageToJausMessage(ReportSelectedDataLinkStatusMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportSelectedDataLinkStatusMessageSize(ReportSelectedDataLinkStatusMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportSelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportSelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/core/reportComponentAuthorityMessage.c b/lib/openjaus/libjaus/src/message/inform/core/reportComponentAuthorityMessage.c deleted file mode 100644 index 46404178bbf1097e4996b2a9657ba215fe0d6979..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/core/reportComponentAuthorityMessage.c +++ /dev/null @@ -1,347 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportComponentAuthorityMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportComponentAuthorityMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_COMPONENT_AUTHORITY; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(ReportComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportComponentAuthorityMessage message); -static unsigned int dataSize(ReportComponentAuthorityMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportComponentAuthorityMessage message) -{ - // Set initial values of message fields - message->authorityCode = newJausByte(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->authorityCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else return JAUS_FALSE; -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->authorityCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - } - - return index; -} - -static unsigned int dataSize(ReportComponentAuthorityMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportComponentAuthorityMessage reportComponentAuthorityMessageCreate(void) -{ - ReportComponentAuthorityMessage message; - - message = (ReportComponentAuthorityMessage)malloc( sizeof(ReportComponentAuthorityMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void reportComponentAuthorityMessageDestroy(ReportComponentAuthorityMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportComponentAuthorityMessageFromBuffer(ReportComponentAuthorityMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportComponentAuthorityMessageToBuffer(ReportComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportComponentAuthorityMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportComponentAuthorityBuffer failed - } - } -} - -ReportComponentAuthorityMessage reportComponentAuthorityMessageFromJausMessage(JausMessage jausMessage) -{ - ReportComponentAuthorityMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportComponentAuthorityMessage)malloc( sizeof(ReportComponentAuthorityMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportComponentAuthorityMessageToJausMessage(ReportComponentAuthorityMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportComponentAuthorityMessageSize(ReportComponentAuthorityMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/core/reportComponentControlMessage.c b/lib/openjaus/libjaus/src/message/inform/core/reportComponentControlMessage.c deleted file mode 100644 index a5373ef46da057b7e35d43d2f6011dfb095f94a9..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/core/reportComponentControlMessage.c +++ /dev/null @@ -1,375 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportComponentControlMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportComponentControlMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_COMPONENT_CONTROL; -static const int maxDataSizeBytes = 5; - -static JausBoolean headerFromBuffer(ReportComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportComponentControlMessage message); -static unsigned int dataSize(ReportComponentControlMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportComponentControlMessage message) -{ - // Set initial values of message fields - message->subsystemId = newJausByte(0); - message->nodeId = newJausByte(0); - message->componentId = newJausByte(0); - message->instanceId = newJausByte(0); - message->authorityCode = newJausByte(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer( &(message->subsystemId), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer( &(message->nodeId), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer( &(message->componentId), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer( &(message->instanceId), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer( &(message->authorityCode), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else return JAUS_FALSE; -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer( message->subsystemId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer( message->nodeId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer( message->componentId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer( message->instanceId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer( message->authorityCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - } - - return index; -} - -static unsigned int dataSize(ReportComponentControlMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportComponentControlMessage reportComponentControlMessageCreate(void) -{ - ReportComponentControlMessage message; - - message = (ReportComponentControlMessage)malloc( sizeof(ReportComponentControlMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void reportComponentControlMessageDestroy(ReportComponentControlMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportComponentControlMessageFromBuffer(ReportComponentControlMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportComponentControlMessageToBuffer(ReportComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportComponentControlMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportComponentControlBuffer failed - } - } -} - -ReportComponentControlMessage reportComponentControlMessageFromJausMessage(JausMessage jausMessage) -{ - ReportComponentControlMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportComponentControlMessage)malloc( sizeof(ReportComponentControlMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportComponentControlMessageToJausMessage(ReportComponentControlMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportComponentControlMessageSize(ReportComponentControlMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/core/reportComponentStatusMessage.c b/lib/openjaus/libjaus/src/message/inform/core/reportComponentStatusMessage.c deleted file mode 100644 index 7bb635f6c424f899fbfa920dac9ffb2ba6aaed96..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/core/reportComponentStatusMessage.c +++ /dev/null @@ -1,359 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportComponentStatusMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportComponentStatusMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_COMPONENT_STATUS; -static const int maxDataSizeBytes = 5; - -static JausBoolean headerFromBuffer(ReportComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportComponentStatusMessage message); -static unsigned int dataSize(ReportComponentStatusMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportComponentStatusMessage message) -{ - // Set initial values of message fields - message->primaryStatusCode = JAUS_UNDEFINED_STATE; - message->secondaryStatusCode = newJausUnsignedInteger(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausByte tempByte = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->primaryStatusCode = tempByte; - - if(!jausUnsignedIntegerFromBuffer(&(message->secondaryStatusCode), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(((JausByte)message->primaryStatusCode), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedIntegerToBuffer(message->secondaryStatusCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(ReportComponentStatusMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportComponentStatusMessage reportComponentStatusMessageCreate(void) -{ - ReportComponentStatusMessage message; - - message = (ReportComponentStatusMessage)malloc( sizeof(ReportComponentStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void reportComponentStatusMessageDestroy(ReportComponentStatusMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportComponentStatusMessageFromBuffer(ReportComponentStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportComponentStatusMessageToBuffer(ReportComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportComponentStatusMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportComponentStatusBuffer failed - } - } -} - -ReportComponentStatusMessage reportComponentStatusMessageFromJausMessage(JausMessage jausMessage) -{ - ReportComponentStatusMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportComponentStatusMessage)malloc( sizeof(ReportComponentStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportComponentStatusMessageToJausMessage(ReportComponentStatusMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportComponentStatusMessageSize(ReportComponentStatusMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/core/reportTimeMessage.c b/lib/openjaus/libjaus/src/message/inform/core/reportTimeMessage.c deleted file mode 100644 index c5f8ef1fea609b050d85b6daa6431f50e305ba70..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/core/reportTimeMessage.c +++ /dev/null @@ -1,405 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportTimeMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportTimeMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_TIME; -static const int maxDataSizeBytes = 7; - -static JausBoolean headerFromBuffer(ReportTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportTimeMessage message); -static void dataDestroy(ReportTimeMessage message); -static unsigned int dataSize(ReportTimeMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportTimeMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->time = jausTimeCreate(); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportTimeMessage message) -{ - // Free message fields - if(message->time) jausTimeDestroy(message->time); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Unpack according to Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->time = jausTimeCreate(); - if(!message->time) return JAUS_FALSE; - - if(jausByteIsBitSet(message->presenceVector, JAUS_TIME_PV_TIME_STAMP_BIT)) - { - if(!jausTimeStampFromBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_TIME_PV_DATE_STAMP_BIT)) - { - if(!jausDateStampFromBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_DATE_STAMP_SIZE_BYTES; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Pack According to Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_TIME_PV_TIME_STAMP_BIT)) - { - if(!jausTimeStampToBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_TIME_PV_DATE_STAMP_BIT)) - { - if(!jausDateStampToBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_DATE_STAMP_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportTimeMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_TIME_PV_TIME_STAMP_BIT)) - { - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_TIME_PV_DATE_STAMP_BIT)) - { - index += JAUS_DATE_STAMP_SIZE_BYTES; - } - - return index; -} - - - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportTimeMessage reportTimeMessageCreate(void) -{ - ReportTimeMessage message; - - message = (ReportTimeMessage)malloc( sizeof(ReportTimeMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportTimeMessageDestroy(ReportTimeMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportTimeMessageFromBuffer(ReportTimeMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportTimeMessageToBuffer(ReportTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportTimeMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportTimeBuffer failed - } - } -} - -ReportTimeMessage reportTimeMessageFromJausMessage(JausMessage jausMessage) -{ - ReportTimeMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportTimeMessage)malloc( sizeof(ReportTimeMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportTimeMessageToJausMessage(ReportTimeMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportTimeMessageSize(ReportTimeMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/dynamicConfiguration/reportConfigurationMessage.c b/lib/openjaus/libjaus/src/message/inform/dynamicConfiguration/reportConfigurationMessage.c deleted file mode 100644 index 898b9f0f76ccc4ab68f8d2353471949af4db8e69..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/dynamicConfiguration/reportConfigurationMessage.c +++ /dev/null @@ -1,459 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportConfigurationMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportConfigurationMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_CONFIGURATION; -static const int maxDataSizeBytes = 4080; - -static JausBoolean headerFromBuffer(ReportConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportConfigurationMessage message); -static unsigned int dataSize(ReportConfigurationMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportConfigurationMessage message) -{ - // Set initial values of message fields - message->subsystem = jausSubsystemCreate(); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0, i, j; - JausByte nodeCount = 0; - JausByte componentCount = 0; - JausNode tempNode; - JausAddress tempAddress; - JausComponent tempComponent; - - message->subsystem = jausSubsystemCreate(); - message->subsystem->id = message->source->subsystem; - - tempAddress = jausAddressCreate(); - tempAddress->subsystem = message->source->subsystem; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // # nodes - if(!jausByteFromBuffer(&nodeCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i = 0; i < nodeCount; i++) - { - // node id - if(!jausByteFromBuffer(&tempAddress->node, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - //Create node - tempNode = jausNodeCreate(); - tempNode->id = tempAddress->node; - tempNode->subsystem = message->subsystem; - - //read number of components on this node - if(!jausByteFromBuffer(&componentCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(j = 0; j < componentCount; j++) - { - //read component ID - if(!jausByteFromBuffer(&tempAddress->component, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - //read instance ID - if(!jausByteFromBuffer(&tempAddress->instance, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // create component and add to node - tempComponent = jausComponentCreate(); - jausAddressCopy(tempComponent->address, tempAddress); - tempComponent->node = tempNode; - jausArrayAdd(tempNode->components, tempComponent); - } - - // Add this node to the subsystem - jausArrayAdd(message->subsystem->nodes, tempNode); - } - jausAddressDestroy(tempAddress); - return JAUS_TRUE; - } - else - { - jausSubsystemDestroy(message->subsystem); - jausAddressDestroy(tempAddress); - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i = 0; - int j = 0; - JausNode node; - JausComponent component; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // # Nodes - if(!jausByteToBuffer(message->subsystem->nodes->elementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Loop through all nodes - for(i = 0; i < message->subsystem->nodes->elementCount; i++) - { - node = (JausNode)message->subsystem->nodes->elementData[i]; - - // Node Id - if(!jausByteToBuffer(node->id, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Number of Components - if(!jausByteToBuffer(node->components->elementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(j = 0; j < node->components->elementCount; j++) - { - component = (JausComponent)node->components->elementData[j]; - - // Component Id - if(!jausByteToBuffer(component->address->component, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Component Instance - if(!jausByteToBuffer(component->address->instance, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - } - } - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportConfigurationMessage message) -{ - int index = 0; - int i = 0; - int j = 0; - JausNode node; - JausComponent component; - - index += JAUS_BYTE_SIZE_BYTES; - - // Loop through all nodes - for(i = 0; i < message->subsystem->nodes->elementCount; i++) - { - node = (JausNode)message->subsystem->nodes->elementData[i]; - // Node Id - index += JAUS_BYTE_SIZE_BYTES; - // Number of Components - index += JAUS_BYTE_SIZE_BYTES; - - for(j = 0; j < node->components->elementCount; j++) - { - component = (JausComponent)node->components->elementData[j]; - // Component Id - index += JAUS_BYTE_SIZE_BYTES; - // Component Instance - index += JAUS_BYTE_SIZE_BYTES; - } - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportConfigurationMessage reportConfigurationMessageCreate(void) -{ - ReportConfigurationMessage message; - - message = (ReportConfigurationMessage)malloc( sizeof(ReportConfigurationMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportConfigurationMessageDestroy(ReportConfigurationMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - jausSubsystemDestroy(message->subsystem); - free(message); -} - -JausBoolean reportConfigurationMessageFromBuffer(ReportConfigurationMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportConfigurationMessageToBuffer(ReportConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportConfigurationMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportConfigurationBuffer failed - } - } -} - -ReportConfigurationMessage reportConfigurationMessageFromJausMessage(JausMessage jausMessage) -{ - ReportConfigurationMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportConfigurationMessage)malloc( sizeof(ReportConfigurationMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportConfigurationMessageToJausMessage(ReportConfigurationMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportConfigurationMessageSize(ReportConfigurationMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/dynamicConfiguration/reportIdentificationMessage.c b/lib/openjaus/libjaus/src/message/inform/dynamicConfiguration/reportIdentificationMessage.c deleted file mode 100644 index f73ce48ea394c51651c8abfe428b99cb016e3436..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/dynamicConfiguration/reportIdentificationMessage.c +++ /dev/null @@ -1,385 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportIdentificationMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportIdentificationMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_IDENTIFICATION; -static const int maxDataSizeBytes = 84; - -static JausBoolean headerFromBuffer(ReportIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportIdentificationMessage message); -static unsigned int dataSize(ReportIdentificationMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportIdentificationMessage message) -{ - // Set initial values of message fields - message->queryType = newJausByte(0); - message->authority = newJausByte(0); - message->type = newJausUnsignedShort(0); - memset(&message->identification[0], 0, JAUS_IDENTIFICATION_LENGTH_BYTES); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->queryType, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->authority, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->type, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - memcpy(&message->identification, buffer+index, bufferSizeBytes-index > JAUS_IDENTIFICATION_LENGTH_BYTES ? JAUS_IDENTIFICATION_LENGTH_BYTES : bufferSizeBytes-index); - index += bufferSizeBytes-index; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int identificationStringLength = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->queryType, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(message->authority, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->type, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - identificationStringLength = (int)strlen(message->identification); - if(identificationStringLength < 80) - { - if(((int)bufferSizeBytes-index) < identificationStringLength) return JAUS_FALSE; - else memcpy(buffer+index, &message->identification, identificationStringLength); - index += identificationStringLength; - memset(buffer+index, 0, JAUS_IDENTIFICATION_LENGTH_BYTES - identificationStringLength); - index += JAUS_IDENTIFICATION_LENGTH_BYTES - identificationStringLength; - } - else - { - if((bufferSizeBytes-index) < JAUS_IDENTIFICATION_LENGTH_BYTES) return JAUS_FALSE; - memcpy(buffer+index, &message->identification, JAUS_IDENTIFICATION_LENGTH_BYTES); - index += JAUS_IDENTIFICATION_LENGTH_BYTES; - buffer[index-1] = 0; - } - } - - return index; -} - -static unsigned int dataSize(ReportIdentificationMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportIdentificationMessage reportIdentificationMessageCreate(void) -{ - ReportIdentificationMessage message; - - message = (ReportIdentificationMessage)malloc( sizeof(ReportIdentificationMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void reportIdentificationMessageDestroy(ReportIdentificationMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportIdentificationMessageFromBuffer(ReportIdentificationMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportIdentificationMessageToBuffer(ReportIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportIdentificationMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportIdentificationBuffer failed - } - } -} - -ReportIdentificationMessage reportIdentificationMessageFromJausMessage(JausMessage jausMessage) -{ - ReportIdentificationMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportIdentificationMessage)malloc( sizeof(ReportIdentificationMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportIdentificationMessageToJausMessage(ReportIdentificationMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportIdentificationMessageSize(ReportIdentificationMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/dynamicConfiguration/reportServicesMessage.c b/lib/openjaus/libjaus/src/message/inform/dynamicConfiguration/reportServicesMessage.c deleted file mode 100644 index 07f0133e4904e122124a5ce5cbf5f89e4ff28800..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/dynamicConfiguration/reportServicesMessage.c +++ /dev/null @@ -1,511 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportServicesMessage.c -// -// Written By: Bob Toucthon, inspired by Danny Kent -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// This file defines the functionality of a ReportServicesMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_SERVICES; -static const int maxDataSizeBytes = 512000; - -static JausBoolean headerFromBuffer(ReportServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportServicesMessage message); -static void dataDestroy(ReportServicesMessage message); -static unsigned int dataSize(ReportServicesMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportServicesMessage message) -{ - // Set initial values of message fields - message->jausServices = jausArrayCreate(); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportServicesMessage message) -{ - // Free message fields - jausArrayDestroy(message->jausServices, (void *)jausServiceDestroy); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0, i, j; - JausByte serviceCount = 0; - JausByte messageCount = 0; - JausService tempService; - JausUnsignedShort tempCommandCode; - JausUnsignedShort tempUShort; - JausUnsignedInteger tempPresenceVector; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // # services - if(!jausByteFromBuffer(&serviceCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->jausServices = jausArrayCreate(); - - for(i = 0; i < serviceCount; i++) - { - // service type - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //Create service - tempService = jausServiceCreate(tempUShort); - - //read number of input messages for this service - if(!jausByteFromBuffer(&messageCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(j = 0; j < messageCount; j++) - { - //read command code - if(!jausUnsignedShortFromBuffer(&tempCommandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //read presence vector - if(!jausUnsignedIntegerFromBuffer(&tempPresenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // add command to service - jausServiceAddInputCommand(tempService, tempCommandCode, tempPresenceVector); - } - - //read number of output messages for this service - if(!jausByteFromBuffer(&messageCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(j = 0; j < messageCount; j++) - { - //read command code - if(!jausUnsignedShortFromBuffer(&tempCommandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //read presence vector - if(!jausUnsignedIntegerFromBuffer(&tempPresenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // add command to service - jausServiceAddOutputCommand(tempService, tempCommandCode, tempPresenceVector); - } - - // Add this node to the message object - jausArrayAdd(message->jausServices, tempService); - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i = 0; - JausService service; - JausCommand command; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // # Services - if(!jausByteToBuffer(message->jausServices->elementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Loop through all services - for(i = 0; i < message->jausServices->elementCount; i++) - { - service = (JausService) message->jausServices->elementData[i]; - - // Service Type - if(!jausUnsignedShortToBuffer(service->type, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Number of Input Commands - if(!jausByteToBuffer(service->inputCommandCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Loop through inputs - command = service->inputCommandList; - while(command) - { - // Command Code - if(!jausUnsignedShortToBuffer(command->commandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Presence Vector - if(!jausUnsignedIntegerToBuffer(command->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - command = command->next; - } - - // Number of Output Commands - if(!jausByteToBuffer(service->outputCommandCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Loop through outputs - command = service->outputCommandList; - while(command) - { - // Command Code - if(!jausUnsignedShortToBuffer(command->commandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Presence Vector - if(!jausUnsignedIntegerToBuffer(command->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - command = command->next; - } - } - } - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportServicesMessage message) -{ - int index = 0; - int i = 0; - JausService service; - JausCommand command; - - // # Services - index += JAUS_BYTE_SIZE_BYTES; - - // Loop through all services - for(i = 0; i < message->jausServices->elementCount; i++) - { - service = (JausService) message->jausServices->elementData[i]; - - // Service Type - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Number of Input Commands - index += JAUS_BYTE_SIZE_BYTES; - - // Loop through inputs - command = service->inputCommandList; - while(command) - { - // Command Code - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - // Presence Vector - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - command = command->next; - } - - // Number of Output Commands - index += JAUS_BYTE_SIZE_BYTES; - - // Loop through outputs - command = service->outputCommandList; - while(command) - { - // Command Code - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - // Presence Vector - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - command = command->next; - } - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportServicesMessage reportServicesMessageCreate(void) -{ - ReportServicesMessage message; - - message = (ReportServicesMessage)malloc( sizeof(ReportServicesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportServicesMessageDestroy(ReportServicesMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportServicesMessageFromBuffer(ReportServicesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportServicesMessageToBuffer(ReportServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportServicesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportServicesBuffer failed - } - } -} - -ReportServicesMessage reportServicesMessageFromJausMessage(JausMessage jausMessage) -{ - ReportServicesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportServicesMessage)malloc( sizeof(ReportServicesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportServicesMessageToJausMessage(ReportServicesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportServicesMessageSize(ReportServicesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/dynamicConfiguration/reportSubsystemListMessage.c b/lib/openjaus/libjaus/src/message/inform/dynamicConfiguration/reportSubsystemListMessage.c deleted file mode 100644 index ef2c93be0908aae0163522abccbbdfda0d93673d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/dynamicConfiguration/reportSubsystemListMessage.c +++ /dev/null @@ -1,424 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportSubsystemListMessage.c -// -// Written By: Bob Toucthon, inspired by Danny Kent -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// This file defines the functionality of a ReportSubsystemListMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_SUBSYSTEM_LIST; -static const int maxDataSizeBytes = 512000; - -static JausBoolean headerFromBuffer(ReportSubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportSubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportSubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportSubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportSubsystemListMessage message); -static void dataDestroy(ReportSubsystemListMessage message); -static unsigned int dataSize(ReportSubsystemListMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportSubsystemListMessage message) -{ - // Set initial values of message fields - message->subsystemCount = 0; - message->subsystemId = NULL; - message->nodeId = NULL; - message->componentId = NULL; - message->instanceId = NULL; - -} - -// Destructs the message-specific fields -static void dataDestroy(ReportSubsystemListMessage message) -{ - // Free message fields - if(message->subsystemId) - { - free(message->subsystemId); - } - - if(message->nodeId) - { - free(message->nodeId); - } - - if(message->componentId) - { - free(message->componentId); - } - - if(message->instanceId) - { - free(message->instanceId); - } -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportSubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->subsystemCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->subsystemId = (JausByte*)malloc(message->subsystemCount * sizeof(JausByte)); - message->nodeId = (JausByte*)malloc(message->subsystemCount * sizeof(JausByte)); - message->componentId = (JausByte*)malloc(message->subsystemCount * sizeof(JausByte)); - message->instanceId = (JausByte*)malloc(message->subsystemCount * sizeof(JausByte)); - - for(i = 0; i < message->subsystemCount; i++) - { - if(!jausByteFromBuffer(&message->subsystemId[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->nodeId[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->componentId[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->instanceId[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportSubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->subsystemCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Loop through all services - for(i = 0; i < message->subsystemCount; i++) - { - if(!jausByteToBuffer(message->subsystemId[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(message->nodeId[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(message->componentId[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(message->instanceId[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - } - } - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportSubsystemListMessage message) -{ - int index = 0; - - // Subsystem Count - index += JAUS_BYTE_SIZE_BYTES; - - // Subsystem List - index += message->subsystemCount * 4 * JAUS_BYTE_SIZE_BYTES; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportSubsystemListMessage reportSubsystemListMessageCreate(void) -{ - ReportSubsystemListMessage message; - - message = (ReportSubsystemListMessage)malloc( sizeof(ReportSubsystemListMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportSubsystemListMessageDestroy(ReportSubsystemListMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportSubsystemListMessageFromBuffer(ReportSubsystemListMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportSubsystemListMessageToBuffer(ReportSubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportSubsystemListMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportSubsystemListBuffer failed - } - } -} - -ReportSubsystemListMessage reportSubsystemListMessageFromJausMessage(JausMessage jausMessage) -{ - ReportSubsystemListMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportSubsystemListMessage)malloc( sizeof(ReportSubsystemListMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportSubsystemListMessageToJausMessage(ReportSubsystemListMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportSubsystemListMessageSize(ReportSubsystemListMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportSubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportSubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/environment/reportCameraCapabilitiesMessage.c b/lib/openjaus/libjaus/src/message/inform/environment/reportCameraCapabilitiesMessage.c deleted file mode 100644 index b5dc522e0b50fab249bca4b448fab5c349630cca..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/environment/reportCameraCapabilitiesMessage.c +++ /dev/null @@ -1,751 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportCameraCapabilitiesMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportCameraCapabilitiesMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_CAMERA_CAPABILITIES; -static const int maxDataSizeBytes = 81; - -static JausBoolean headerFromBuffer(ReportCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportCameraCapabilitiesMessage message); -static void dataDestroy(ReportCameraCapabilitiesMessage message); -static unsigned int dataSize(ReportCameraCapabilitiesMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportCameraCapabilitiesMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); - message->cameraID = newJausByte(0); - message->cameraDescription[0] = 0; - message->maxHorizontalFovRadians = newJausDouble(0); // Scaled UShort (0, JAUS_PI) - message->minHorizontalFovRadians = newJausDouble(0); // Scaled UShort (0, JAUS_PI) - message->maxVerticalFovRadians = newJausDouble(0); // Scaled UShort (0, JAUS_PI) - message->minVerticalFovRadians = newJausDouble(0); // Scaled UShort (0, JAUS_PI) - message->maxHorizontalResolution = newJausUnsignedShort(0); - message->minHorizontalResolution = newJausUnsignedShort(0); - message->maxVerticalResolution = newJausUnsignedShort(0); - message->minVerticalResolution = newJausUnsignedShort(0); - message->maxFrameRate = newJausUnsignedShort(0); - message->minFrameRate = newJausUnsignedShort(0); - message->maxShutterSpeed = newJausUnsignedShort(0); - message->minShutterSpeed = newJausUnsignedShort(0); - - // Image Control - message->autoFocusAvailable = JAUS_FALSE; - message->autoIrisAvailable = JAUS_FALSE; - message->imageStabilizationAvailable = JAUS_FALSE; - message->whiteBalanceAvailable = JAUS_FALSE; - message->syncFlashAvailable = JAUS_FALSE; - message->redEyeAvailable = JAUS_FALSE; - message->autoShutterAvailable = JAUS_FALSE; - message->videoAutoGainAvailable = JAUS_FALSE; - message->interlacedVideoAvailable = JAUS_FALSE; - - // Audio Control - message->audioEnabledAvailable = newJausUnsignedShort(0); - message->audioAutoGainAvailable = newJausUnsignedShort(0); - message->stereoAudioAvailable = newJausUnsignedShort(0); - message->directionalAudioAvailable = newJausUnsignedShort(0); - message->frontMicrophoneAvailable = newJausUnsignedShort(0); - message->rearMicrophoneAvailable = newJausUnsignedShort(0); - message->leftMicrophoneAvailable = newJausUnsignedShort(0); - message->rightMicrophoneAvailable = newJausUnsignedShort(0); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportCameraCapabilitiesMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - // Presence Vector - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // CameraID - if(!jausByteFromBuffer(&message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Camera Description - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_DESCRIPTION_BIT)) - { - // unpack string of length JAUS_CAMERA_DESCRIPTION_LENGTH_BYTES - if(bufferSizeBytes-index < JAUS_CAMERA_DESCRIPTION_LENGTH_BYTES) return JAUS_FALSE; - - memcpy(&message->cameraDescription, buffer+index, JAUS_CAMERA_DESCRIPTION_LENGTH_BYTES); - index += JAUS_CAMERA_DESCRIPTION_LENGTH_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_HORIZONTAL_FOV_BIT)) - { - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled UShort (0, JAUS_PI) - message->maxHorizontalFovRadians = jausUnsignedShortToDouble(tempUShort, 0, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_HORIZONTAL_FOV_BIT)) - { - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled UShort (0, JAUS_PI) - message->minHorizontalFovRadians = jausUnsignedShortToDouble(tempUShort, 0, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_VERTICAL_FOV_BIT)) - { - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled UShort (0, JAUS_PI) - message->maxVerticalFovRadians = jausUnsignedShortToDouble(tempUShort, 0, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_VERTICAL_FOV_BIT)) - { - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled UShort (0, JAUS_PI) - message->minVerticalFovRadians = jausUnsignedShortToDouble(tempUShort, 0, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_HORIZONTAL_RESOLUTION_BIT)) - { - if(!jausUnsignedShortFromBuffer(&message->maxHorizontalResolution, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_HORIZONTAL_RESOLUTION_BIT)) - { - if(!jausUnsignedShortFromBuffer(&message->minHorizontalResolution, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_VERTICAL_RESOLUTION_BIT)) - { - if(!jausUnsignedShortFromBuffer(&message->maxVerticalResolution, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_VERTICAL_RESOLUTION_BIT)) - { - if(!jausUnsignedShortFromBuffer(&message->minVerticalResolution, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_FRAME_RATE_BIT)) - { - if(!jausUnsignedShortFromBuffer(&message->maxFrameRate, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_FRAME_RATE_BIT)) - { - if(!jausUnsignedShortFromBuffer(&message->minFrameRate, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_SHUTTER_SPEED_BIT)) - { - if(!jausUnsignedShortFromBuffer(&message->maxShutterSpeed, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_SHUTTER_SPEED_BIT)) - { - if(!jausUnsignedShortFromBuffer(&message->minShutterSpeed, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Image Control - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_IMAGE_CONTROL_BIT)) - { - //unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Setup the datastructure's boolean values - message->autoFocusAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_FOCUS_BIT)? JAUS_TRUE : JAUS_FALSE; - message->autoIrisAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_IRIS_BIT)? JAUS_TRUE : JAUS_FALSE; - message->imageStabilizationAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_IMAGE_STABILIZATION_BIT)? JAUS_TRUE : JAUS_FALSE; - message->whiteBalanceAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_WHITE_BALANCE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->syncFlashAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_SYNC_FLASH_BIT)? JAUS_TRUE : JAUS_FALSE; - message->redEyeAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_RED_EYE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->autoShutterAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_SHUTTER_BIT)? JAUS_TRUE : JAUS_FALSE; - message->videoAutoGainAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_GAIN_BIT)? JAUS_TRUE : JAUS_FALSE; - message->interlacedVideoAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_INTERLACED_BIT)? JAUS_TRUE : JAUS_FALSE; - } - - // Audio Control - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_AUDIO_CONTROL_BIT)) - { - //unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - message->audioEnabledAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_AUDIO_BIT)? JAUS_TRUE : JAUS_FALSE; - message->audioAutoGainAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_AUTO_GAIN_BIT)? JAUS_TRUE : JAUS_FALSE; - message->stereoAudioAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_STEREO_BIT)? JAUS_TRUE : JAUS_FALSE; - message->directionalAudioAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_DIRECTIONAL_BIT)? JAUS_TRUE : JAUS_FALSE; - message->frontMicrophoneAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_FRONT_MICROPHONE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->rearMicrophoneAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_REAR_MICROPHONE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->leftMicrophoneAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_LEFT_MICROPHONE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->rightMicrophoneAvailable = jausUnsignedShortIsBitSet(tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_RIGHT_MICROPHONE_BIT)? JAUS_TRUE : JAUS_FALSE; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - // Presence Vector - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // CameraID - if(!jausByteToBuffer(message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Camera Description - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_DESCRIPTION_BIT)) - { - // unpack string of length JAUS_CAMERA_DESCRIPTION_LENGTH_BYTES - if(bufferSizeBytes-index < JAUS_CAMERA_DESCRIPTION_LENGTH_BYTES) return JAUS_FALSE; - - memcpy(buffer+index, message->cameraDescription, JAUS_CAMERA_DESCRIPTION_LENGTH_BYTES); - index += JAUS_CAMERA_DESCRIPTION_LENGTH_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_HORIZONTAL_FOV_BIT)) - { - // Scaled UShort (0, JAUS_PI) - tempUShort = jausUnsignedShortFromDouble(message->maxHorizontalFovRadians, 0, JAUS_PI); - - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_HORIZONTAL_FOV_BIT)) - { - // Scaled UShort (0, JAUS_PI) - tempUShort = jausUnsignedShortFromDouble(message->minHorizontalFovRadians, 0, JAUS_PI); - - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_VERTICAL_FOV_BIT)) - { - // Scaled UShort (0, JAUS_PI) - tempUShort = jausUnsignedShortFromDouble(message->maxVerticalFovRadians, 0, JAUS_PI); - - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_VERTICAL_FOV_BIT)) - { - // Scaled UShort (0, JAUS_PI) - tempUShort = jausUnsignedShortFromDouble(message->minVerticalFovRadians, 0, JAUS_PI); - - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_HORIZONTAL_RESOLUTION_BIT)) - { - if(!jausUnsignedShortToBuffer(message->maxHorizontalResolution, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_HORIZONTAL_RESOLUTION_BIT)) - { - if(!jausUnsignedShortToBuffer(message->minHorizontalResolution, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_VERTICAL_RESOLUTION_BIT)) - { - if(!jausUnsignedShortToBuffer(message->maxVerticalResolution, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_VERTICAL_RESOLUTION_BIT)) - { - if(!jausUnsignedShortToBuffer(message->minVerticalResolution, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_FRAME_RATE_BIT)) - { - if(!jausUnsignedShortToBuffer(message->maxFrameRate, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_FRAME_RATE_BIT)) - { - if(!jausUnsignedShortToBuffer(message->minFrameRate, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_SHUTTER_SPEED_BIT)) - { - if(!jausUnsignedShortToBuffer(message->maxShutterSpeed, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_SHUTTER_SPEED_BIT)) - { - if(!jausUnsignedShortToBuffer(message->minShutterSpeed, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Image Control - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_IMAGE_CONTROL_BIT)) - { - // Setup the datastructure's boolean values - tempUShort = 0; - if(message->autoFocusAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_FOCUS_BIT); - if(message->autoIrisAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_IRIS_BIT); - if(message->imageStabilizationAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_IMAGE_STABILIZATION_BIT); - if(message->whiteBalanceAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_WHITE_BALANCE_BIT); - if(message->syncFlashAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_SYNC_FLASH_BIT); - if(message->redEyeAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_RED_EYE_BIT); - if(message->autoShutterAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_SHUTTER_BIT); - if(message->videoAutoGainAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_AUTO_GAIN_BIT); - if(message->interlacedVideoAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_IMAGE_CONTROL_BF_INTERLACED_BIT); - - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Audio Control - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_AUDIO_CONTROL_BIT)) - { - // Setup the datastructure's boolean values - tempUShort = 0; - if(message->audioEnabledAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_AUDIO_BIT); - if(message->audioAutoGainAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_AUTO_GAIN_BIT); - if(message->stereoAudioAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_STEREO_BIT); - if(message->directionalAudioAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_DIRECTIONAL_BIT); - if(message->frontMicrophoneAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_FRONT_MICROPHONE_BIT); - if(message->rearMicrophoneAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_REAR_MICROPHONE_BIT); - if(message->leftMicrophoneAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_LEFT_MICROPHONE_BIT); - if(message->rightMicrophoneAvailable) jausUnsignedShortSetBit(&tempUShort, JAUS_CAMERA_AUDIO_CONTROL_BF_RIGHT_MICROPHONE_BIT); - - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportCameraCapabilitiesMessage message) -{ - int index = 0; - - // Presence Vector - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // CameraID - index += JAUS_BYTE_SIZE_BYTES; - - // Camera Description - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_DESCRIPTION_BIT)) - { - index += JAUS_CAMERA_DESCRIPTION_LENGTH_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_HORIZONTAL_FOV_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_HORIZONTAL_FOV_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_VERTICAL_FOV_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_VERTICAL_FOV_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_HORIZONTAL_RESOLUTION_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_HORIZONTAL_RESOLUTION_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_VERTICAL_RESOLUTION_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_VERTICAL_RESOLUTION_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_FRAME_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_FRAME_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MAX_SHUTTER_SPEED_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_MIN_SHUTTER_SPEED_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Image Control - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_IMAGE_CONTROL_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Audio Control - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_CAPABILITIES_PV_AUDIO_CONTROL_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportCameraCapabilitiesMessage reportCameraCapabilitiesMessageCreate(void) -{ - ReportCameraCapabilitiesMessage message; - - message = (ReportCameraCapabilitiesMessage)malloc( sizeof(ReportCameraCapabilitiesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportCameraCapabilitiesMessageDestroy(ReportCameraCapabilitiesMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportCameraCapabilitiesMessageFromBuffer(ReportCameraCapabilitiesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportCameraCapabilitiesMessageToBuffer(ReportCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportCameraCapabilitiesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportCameraCapabilitiesBuffer failed - } - } -} - -ReportCameraCapabilitiesMessage reportCameraCapabilitiesMessageFromJausMessage(JausMessage jausMessage) -{ - ReportCameraCapabilitiesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportCameraCapabilitiesMessage)malloc( sizeof(ReportCameraCapabilitiesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportCameraCapabilitiesMessageToJausMessage(ReportCameraCapabilitiesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportCameraCapabilitiesMessageSize(ReportCameraCapabilitiesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/environment/reportCameraCountMessage.c b/lib/openjaus/libjaus/src/message/inform/environment/reportCameraCountMessage.c deleted file mode 100644 index 3664ec42c2bf578545f855cac23e71db8c48bf5d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/environment/reportCameraCountMessage.c +++ /dev/null @@ -1,355 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportCameraCountMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportCameraCountMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_CAMERA_COUNT; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(ReportCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportCameraCountMessage message); -static void dataDestroy(ReportCameraCountMessage message); -static unsigned int dataSize(ReportCameraCountMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportCameraCountMessage message) -{ - // Set initial values of message fields - message->cameraCount = newJausByte(0); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportCameraCountMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->cameraCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->cameraCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportCameraCountMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportCameraCountMessage reportCameraCountMessageCreate(void) -{ - ReportCameraCountMessage message; - - message = (ReportCameraCountMessage)malloc( sizeof(ReportCameraCountMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportCameraCountMessageDestroy(ReportCameraCountMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportCameraCountMessageFromBuffer(ReportCameraCountMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportCameraCountMessageToBuffer(ReportCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportCameraCountMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportCameraCountBuffer failed - } - } -} - -ReportCameraCountMessage reportCameraCountMessageFromJausMessage(JausMessage jausMessage) -{ - ReportCameraCountMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportCameraCountMessage)malloc( sizeof(ReportCameraCountMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportCameraCountMessageToJausMessage(ReportCameraCountMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportCameraCountMessageSize(ReportCameraCountMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/environment/reportCameraFormatOptionsMessage.c b/lib/openjaus/libjaus/src/message/inform/environment/reportCameraFormatOptionsMessage.c deleted file mode 100644 index b31ecff980fff721e104bab4ac3d46b7241d4504..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/environment/reportCameraFormatOptionsMessage.c +++ /dev/null @@ -1,537 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportCameraFormatOptionsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportCameraFormatOptionsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_CAMERA_FORMAT_OPTIONS; -static const int maxDataSizeBytes = 12; - -static JausBoolean headerFromBuffer(ReportCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportCameraFormatOptionsMessage message); -static void dataDestroy(ReportCameraFormatOptionsMessage message); -static unsigned int dataSize(ReportCameraFormatOptionsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportCameraFormatOptionsMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->cameraID = newJausByte(0); - message->audioFormat[0] = UnusedAudioFormat; - message->audioFormat[1] = UnusedAudioFormat; - message->imageFormat[0] = UnusedImageFormat; - message->imageFormat[1] = UnusedImageFormat; - message->imageFormat[2] = UnusedImageFormat; - message->imageFormat[3] = UnusedImageFormat; - message->formatOption = newJausUnsignedInteger(0); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportCameraFormatOptionsMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausByte tempByte = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - // Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Camera ID - if(!jausByteFromBuffer(&message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Audio Format 1 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_AUDIO_FORMAT_ONE_BIT)) - { - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->audioFormat[0] = tempByte; - } - - // Audio Format 2 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_AUDIO_FORMAT_TWO_BIT)) - { - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->audioFormat[1] = tempByte; - } - - // Image Format 1 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_ONE_BIT)) - { - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->imageFormat[0] = tempByte; - } - - // Image Format 2 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_TWO_BIT)) - { - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->imageFormat[1] = tempByte; - } - - // Image Format 3 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_THREE_BIT)) - { - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->imageFormat[2] = tempByte; - } - - // Image Format 4 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_FOUR_BIT)) - { - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->imageFormat[3] = tempByte; - } - - // Format Option - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_FORMAT_OPTIONS_BIT)) - { - if(!jausUnsignedIntegerFromBuffer(&message->formatOption, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - // Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Camera ID - if(!jausByteToBuffer(message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Audio Format 1 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_AUDIO_FORMAT_ONE_BIT)) - { - if(!jausByteToBuffer(((JausByte)message->audioFormat[0]), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // Audio Format 2 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_AUDIO_FORMAT_TWO_BIT)) - { - if(!jausByteToBuffer(((JausByte)message->audioFormat[1]), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // Image Format 1 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_ONE_BIT)) - { - if(!jausByteToBuffer(((JausByte)message->imageFormat[0]), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // Image Format 2 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_TWO_BIT)) - { - if(!jausByteToBuffer(((JausByte)message->imageFormat[1]), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // Image Format 3 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_THREE_BIT)) - { - if(!jausByteToBuffer(((JausByte)message->imageFormat[2]), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // Image Format 4 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_FOUR_BIT)) - { - if(!jausByteToBuffer(((JausByte)message->imageFormat[3]), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // Format Option - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_FORMAT_OPTIONS_BIT)) - { - if(!jausUnsignedIntegerToBuffer(message->formatOption, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportCameraFormatOptionsMessage message) -{ - int index = 0; - - // Presence Vector - index += JAUS_BYTE_SIZE_BYTES; - - // Camera ID - index += JAUS_BYTE_SIZE_BYTES; - - // Audio Format 1 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_AUDIO_FORMAT_ONE_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // Audio Format 2 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_AUDIO_FORMAT_TWO_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // Image Format 1 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_ONE_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // Image Format 2 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_TWO_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // Image Format 3 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_THREE_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // Image Format 4 - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_IMAGE_FORMAT_FOUR_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // Format Option - if(jausByteIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_FORMAT_OPTIONS_PV_FORMAT_OPTIONS_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportCameraFormatOptionsMessage reportCameraFormatOptionsMessageCreate(void) -{ - ReportCameraFormatOptionsMessage message; - - message = (ReportCameraFormatOptionsMessage)malloc( sizeof(ReportCameraFormatOptionsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportCameraFormatOptionsMessageDestroy(ReportCameraFormatOptionsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportCameraFormatOptionsMessageFromBuffer(ReportCameraFormatOptionsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportCameraFormatOptionsMessageToBuffer(ReportCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportCameraFormatOptionsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportCameraFormatOptionsBuffer failed - } - } -} - -ReportCameraFormatOptionsMessage reportCameraFormatOptionsMessageFromJausMessage(JausMessage jausMessage) -{ - ReportCameraFormatOptionsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportCameraFormatOptionsMessage)malloc( sizeof(ReportCameraFormatOptionsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportCameraFormatOptionsMessageToJausMessage(ReportCameraFormatOptionsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportCameraFormatOptionsMessageSize(ReportCameraFormatOptionsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/environment/reportCameraPoseMessage.c b/lib/openjaus/libjaus/src/message/inform/environment/reportCameraPoseMessage.c deleted file mode 100644 index 03fcb82dba3d96e2cc208a5dfdd85f2efb8a675e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/environment/reportCameraPoseMessage.c +++ /dev/null @@ -1,647 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportCameraPoseMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportCameraPoseMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_CAMERA_POSE; -static const int maxDataSizeBytes = 36; - -static JausBoolean headerFromBuffer(ReportCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportCameraPoseMessage message); -static void dataDestroy(ReportCameraPoseMessage message); -static unsigned int dataSize(ReportCameraPoseMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportCameraPoseMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); - message->cameraID = newJausByte(0); - message->cameraName[0] = 0; - message->xCameraOriginMeters = newJausDouble(0); // Scaled Short (-32.767, 32.767) - message->yCameraOriginMeters = newJausDouble(0); // Scaled Short (-32.767, 32.767) - message->zCameraOriginMeters = newJausDouble(0); // Scaled Short (-32.767, 32.767) - message->xCameraAxisDirectionCosineX = newJausDouble(0); // Scaled Short (-1.0, 1.0) - message->xCameraAxisDirectionCosineY = newJausDouble(0); // Scaled Short (-1.0, 1.0) - message->xCameraAxisDirectionCosineZ = newJausDouble(0); // Scaled Short (-1.0, 1.0) - message->zCameraAxisDirectionCosineX = newJausDouble(0); // Scaled Short (-1.0, 1.0) - message->zCameraAxisDirectionCosineY = newJausDouble(0); // Scaled Short (-1.0, 1.0) - message->zCameraAxisDirectionCosineZ = newJausDouble(0); // Scaled Short (-1.0, 1.0) -} - -// Destructs the message-specific fields -static void dataDestroy(ReportCameraPoseMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausShort tempShort = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - // Presence Vector - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // CameraID - if(!jausByteFromBuffer(&message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Camera Name - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_CAMERA_NAME_BIT)) - { - // unpack string of length JAUS_CAMERA_NAME_LENGTH_BYTES - if(bufferSizeBytes-index < JAUS_CAMERA_NAME_LENGTH_BYTES) return JAUS_FALSE; - - memcpy(message->cameraName, buffer+index, JAUS_CAMERA_NAME_LENGTH_BYTES); - index += JAUS_CAMERA_NAME_LENGTH_BYTES; - } - - // Camera Origin X - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_X_ORIGIN_BIT)) - { - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-32.767, 32.767) - message->xCameraOriginMeters = jausShortToDouble(tempShort, -32.767, 32.767); - } - - // Camera Origin Y - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Y_ORIGIN_BIT)) - { - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-32.767, 32.767) - message->yCameraOriginMeters = jausShortToDouble(tempShort, -32.767, 32.767); - } - - // Camera Origin Z - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Z_ORIGIN_BIT)) - { - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-32.767, 32.767) - message->zCameraOriginMeters = jausShortToDouble(tempShort, -32.767, 32.767); - } - - // X Camera Axis Direction Cosine X - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_X_DIRECTION_COSINE_X)) - { - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-1.0, 1.0) - message->xCameraAxisDirectionCosineX = jausShortToDouble(tempShort, -1.0, 1.0); - } - - // X Camera Axis Direction Cosine Y - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_X_DIRECTION_COSINE_Y)) - { - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-1.0, 1.0) - message->xCameraAxisDirectionCosineY = jausShortToDouble(tempShort, -1.0, 1.0); - } - - // X Camera Axis Direction Cosine Z - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_X_DIRECTION_COSINE_Z)) - { - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-1.0, 1.0) - message->xCameraAxisDirectionCosineZ = jausShortToDouble(tempShort, -1.0, 1.0); - } - - // Z Camera Axis Direction Cosine X - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Z_DIRECTION_COSINE_X)) - { - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-1.0, 1.0) - message->zCameraAxisDirectionCosineX = jausShortToDouble(tempShort, -1.0, 1.0); - } - - // Z Camera Axis Direction Cosine Y - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Z_DIRECTION_COSINE_Y)) - { - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-1.0, 1.0) - message->zCameraAxisDirectionCosineY = jausShortToDouble(tempShort, -1.0, 1.0); - } - - // Z Camera Axis Direction Cosine X - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Z_DIRECTION_COSINE_Z)) - { - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-1.0, 1.0) - message->zCameraAxisDirectionCosineZ = jausShortToDouble(tempShort, -1.0, 1.0); - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausShort tempShort = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Presence Vector - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // CameraID - if(!jausByteToBuffer(message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Camera Name - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_CAMERA_NAME_BIT)) - { - // pack string of length JAUS_CAMERA_NAME_LENGTH_BYTES - if(bufferSizeBytes-index < JAUS_CAMERA_NAME_LENGTH_BYTES) return JAUS_FALSE; - - memcpy(buffer+index, message->cameraName, JAUS_CAMERA_NAME_LENGTH_BYTES); - index += JAUS_CAMERA_NAME_LENGTH_BYTES; - } - - // Camera Origin X - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_X_ORIGIN_BIT)) - { - // Scaled Short (-32.767, 32.767) - tempShort = jausShortFromDouble(message->xCameraOriginMeters, -32.767, 32.767); - - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - // Camera Origin Y - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Y_ORIGIN_BIT)) - { - // Scaled Short (-32.767, 32.767) - tempShort = jausShortFromDouble(message->yCameraOriginMeters, -32.767, 32.767); - - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - // Camera Origin Z - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Z_ORIGIN_BIT)) - { - // Scaled Short (-32.767, 32.767) - tempShort = jausShortFromDouble(message->zCameraOriginMeters, -32.767, 32.767); - - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - // X Camera Axis Direction Cosine X - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_X_DIRECTION_COSINE_X)) - { - // Scaled Short (-1.0, 1.0) - tempShort = jausShortFromDouble(message->xCameraAxisDirectionCosineX, -1.0, 1.0); - - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - // X Camera Axis Direction Cosine Y - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_X_DIRECTION_COSINE_Y)) - { - // Scaled Short (-1.0, 1.0) - tempShort = jausShortFromDouble(message->xCameraAxisDirectionCosineY, -1.0, 1.0); - - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - // X Camera Axis Direction Cosine Z - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_X_DIRECTION_COSINE_Z)) - { - // Scaled Short (-1.0, 1.0) - tempShort = jausShortFromDouble(message->xCameraAxisDirectionCosineZ, -1.0, 1.0); - - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - // Z Camera Axis Direction Cosine X - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Z_DIRECTION_COSINE_X)) - { - // Scaled Short (-1.0, 1.0) - tempShort = jausShortFromDouble(message->zCameraAxisDirectionCosineX, -1.0, 1.0); - - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - // Z Camera Axis Direction Cosine Y - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Z_DIRECTION_COSINE_Y)) - { - // Scaled Short (-1.0, 1.0) - tempShort = jausShortFromDouble(message->zCameraAxisDirectionCosineY, -1.0, 1.0); - - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - // Z Camera Axis Direction Cosine X - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Z_DIRECTION_COSINE_Z)) - { - // Scaled Short (-1.0, 1.0) - tempShort = jausShortFromDouble(message->zCameraAxisDirectionCosineZ, -1.0, 1.0); - - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportCameraPoseMessage message) -{ - int index = 0; - - // Presence Vector - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // CameraID - index += JAUS_BYTE_SIZE_BYTES; - - // Camera Name - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_CAMERA_NAME_BIT)) - { - index += JAUS_CAMERA_NAME_LENGTH_BYTES; - } - - // Camera Origin X - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_X_ORIGIN_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - // Camera Origin Y - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Y_ORIGIN_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - // Camera Origin Z - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Z_ORIGIN_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - // X Camera Axis Direction Cosine X - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_X_DIRECTION_COSINE_X)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - // X Camera Axis Direction Cosine Y - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_X_DIRECTION_COSINE_Y)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - // X Camera Axis Direction Cosine Z - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_X_DIRECTION_COSINE_Z)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - // Z Camera Axis Direction Cosine X - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Z_DIRECTION_COSINE_X)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - // Z Camera Axis Direction Cosine Y - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Z_DIRECTION_COSINE_Y)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - // Z Camera Axis Direction Cosine X - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_REPORT_CAMERA_POSE_PV_Z_DIRECTION_COSINE_Z)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportCameraPoseMessage reportCameraPoseMessageCreate(void) -{ - ReportCameraPoseMessage message; - - message = (ReportCameraPoseMessage)malloc( sizeof(ReportCameraPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportCameraPoseMessageDestroy(ReportCameraPoseMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportCameraPoseMessageFromBuffer(ReportCameraPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportCameraPoseMessageToBuffer(ReportCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportCameraPoseMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportCameraPoseBuffer failed - } - } -} - -ReportCameraPoseMessage reportCameraPoseMessageFromJausMessage(JausMessage jausMessage) -{ - ReportCameraPoseMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportCameraPoseMessage)malloc( sizeof(ReportCameraPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportCameraPoseMessageToJausMessage(ReportCameraPoseMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportCameraPoseMessageSize(ReportCameraPoseMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/environment/reportImageMessage.c b/lib/openjaus/libjaus/src/message/inform/environment/reportImageMessage.c deleted file mode 100644 index 967759d52cbdeed54a0e09c865c01e64f054a1df..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/environment/reportImageMessage.c +++ /dev/null @@ -1,383 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportImageMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportImageMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_IMAGE; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(ReportImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportImageMessage message); -static void dataDestroy(ReportImageMessage message); -static unsigned int dataSize(ReportImageMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportImageMessage message) -{ - // Set initial values of message fields - message->cameraID = 0; - message->videoFormat = 0; - message->data = NULL; - message->bufferSizeBytes = 0; -} - -// Destructs the message-specific fields -static void dataDestroy(ReportImageMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - if(!jausByteFromBuffer(&message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->videoFormat, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - memcpy(message->data, buffer+index, bufferSizeBytes-index); - index += bufferSizeBytes-index; - - message->bufferSizeBytes = bufferSizeBytes-index; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(message->videoFormat, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(message->data && message->bufferSizeBytes) - { - memcpy(buffer+index, message->data, message->bufferSizeBytes); - index += message->bufferSizeBytes; - } - } - - return index; -} - -static unsigned int dataSize(ReportImageMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_BYTE_SIZE_BYTES; - - index += message->bufferSizeBytes; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportImageMessage reportImageMessageCreate(void) -{ - ReportImageMessage message; - - message = (ReportImageMessage)malloc( sizeof(ReportImageMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void reportImageMessageDestroy(ReportImageMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportImageMessageFromBuffer(ReportImageMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportImageMessageToBuffer(ReportImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportImageMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportVideoFrameBuffer failed - } - } -} - -ReportImageMessage reportImageMessageFromJausMessage(JausMessage jausMessage) -{ - ReportImageMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportImageMessage)malloc( sizeof(ReportImageMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportImageMessageToJausMessage(ReportImageMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportImageMessageSize(ReportImageMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/environment/reportRelativeObjectPositionMessage.c b/lib/openjaus/libjaus/src/message/inform/environment/reportRelativeObjectPositionMessage.c deleted file mode 100644 index 6b1cfcb0f9221c0b83100f85c790dad4cfa81666..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/environment/reportRelativeObjectPositionMessage.c +++ /dev/null @@ -1,574 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportRelativeObjectPositionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportRelativeObjectPositionMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_RELATIVE_OBJECT_POSITION; -static const int maxDataSizeBytes = 32; - -static JausBoolean headerFromBuffer(ReportRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportRelativeObjectPositionMessage message); -static void dataDestroy(ReportRelativeObjectPositionMessage message); -static unsigned int dataSize(ReportRelativeObjectPositionMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportRelativeObjectPositionMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->time = jausTimeCreate(); - message->rangeMeters = newJausDouble(0); // Scaled Int (-10,000, 10,000) - message->rangeErrorMeters = newJausDouble(0); // Scaled UInt (0, 1000) - message->bearingRadians = newJausDouble(0); // Scaled Int (-JAUS_PI, JAUS_PI) - message->bearingErrorRadians = newJausDouble(0); // Scaled UInt (0, JAUS_PI) - message->inclinationRadians = newJausDouble(0); // Scaled Int (-JAUS_PI, JAUS_PI) - message->inclinationErrorRadians = newJausDouble(0); // Scaled UInt (0, JAUS_PI) - message->confidence = newJausByte(0); - message->objectId = newJausUnsignedShort(0); - -} - -// Destructs the message-specific fields -static void dataDestroy(ReportRelativeObjectPositionMessage message) -{ - // Free message fields - jausTimeDestroy(message->time); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedInteger tempUInt; - JausInteger tempInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->time = jausTimeCreate(); - - if(!jausTimeStampFromBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_TIME_STAMP_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_RANGE_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-10,000, 10,000) - message->rangeMeters = jausIntegerToDouble(tempInt, -10000, 10000); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_RANGE_ERROR_BIT)) - { - //unpack - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Scaled UInt (0, 1000) - message->rangeErrorMeters = jausUnsignedIntegerToDouble(tempUInt, 0, 1000); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_BEARING_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-JAUS_PI, JAUS_PI) - message->bearingRadians = jausIntegerToDouble(tempInt, -JAUS_PI, JAUS_PI); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_BEARING_ERROR_BIT)) - { - //unpack - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Scaled UInt (0, JAUS_PI) - message->bearingErrorRadians = jausUnsignedIntegerToDouble(tempUInt, 0, JAUS_PI); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_INCLINATION_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-JAUS_PI, JAUS_PI) - message->inclinationRadians = jausIntegerToDouble(tempInt, -JAUS_PI, JAUS_PI); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_INCLINATION_ERROR_BIT)) - { - //unpack - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Scaled UInt (0, JAUS_PI) - message->inclinationErrorRadians = jausUnsignedIntegerToDouble(tempUInt, 0, JAUS_PI); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_CONFIDENCE_BIT)) - { - //unpack - if(!jausByteFromBuffer(&message->confidence, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_OBJECT_ID_BIT)) - { - //unpack - if(!jausUnsignedShortFromBuffer(&message->objectId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedInteger tempUInt; - JausInteger tempInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Unpack Message Fields from Buffer - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausTimeStampToBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_TIME_STAMP_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_RANGE_BIT)) - { - // Scaled Int (-10,000, 10,000) - tempInt = jausIntegerFromDouble(message->rangeMeters, -10000, 10000); - - //pack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_RANGE_ERROR_BIT)) - { - // Scaled UInt (0, 1000) - tempUInt = jausUnsignedIntegerFromDouble(message->rangeErrorMeters, 0, 1000); - - //pack - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_BEARING_BIT)) - { - // Scaled Int (-JAUS_PI, JAUS_PI) - tempInt = jausIntegerFromDouble(message->bearingRadians, -JAUS_PI, JAUS_PI); - - //pack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_BEARING_ERROR_BIT)) - { - // Scaled UInt (0, JAUS_PI) - tempUInt = jausUnsignedIntegerFromDouble(message->bearingErrorRadians, 0, JAUS_PI); - - //pack - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_INCLINATION_BIT)) - { - // Scaled Int (-JAUS_PI, JAUS_PI) - tempInt = jausIntegerFromDouble(message->inclinationRadians, -JAUS_PI, JAUS_PI); - - //pack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_INCLINATION_ERROR_BIT)) - { - // Scaled UInt (0, JAUS_PI) - tempUInt = jausUnsignedIntegerFromDouble(message->inclinationErrorRadians, 0, JAUS_PI); - - //pack - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_CONFIDENCE_BIT)) - { - //pack - if(!jausByteToBuffer(message->confidence, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_OBJECT_ID_BIT)) - { - //pack - if(!jausUnsignedShortToBuffer(message->objectId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportRelativeObjectPositionMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_TIME_STAMP_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_RANGE_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_RANGE_ERROR_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_BEARING_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_BEARING_ERROR_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_INCLINATION_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_INCLINATION_ERROR_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_CONFIDENCE_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_RELATIVE_OBJECT_POSITION_PV_OBJECT_ID_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportRelativeObjectPositionMessage reportRelativeObjectPositionMessageCreate(void) -{ - ReportRelativeObjectPositionMessage message; - - message = (ReportRelativeObjectPositionMessage)malloc( sizeof(ReportRelativeObjectPositionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportRelativeObjectPositionMessageDestroy(ReportRelativeObjectPositionMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportRelativeObjectPositionMessageFromBuffer(ReportRelativeObjectPositionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportRelativeObjectPositionMessageToBuffer(ReportRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportRelativeObjectPositionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportRelativeObjectPositionBuffer failed - } - } -} - -ReportRelativeObjectPositionMessage reportRelativeObjectPositionMessageFromJausMessage(JausMessage jausMessage) -{ - ReportRelativeObjectPositionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportRelativeObjectPositionMessage)malloc( sizeof(ReportRelativeObjectPositionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportRelativeObjectPositionMessageToJausMessage(ReportRelativeObjectPositionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportRelativeObjectPositionMessageSize(ReportRelativeObjectPositionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/environment/reportSelectedCameraMessage.c b/lib/openjaus/libjaus/src/message/inform/environment/reportSelectedCameraMessage.c deleted file mode 100644 index c46e185a23088a412fac59c236061442125b8b63..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/environment/reportSelectedCameraMessage.c +++ /dev/null @@ -1,356 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportSelectedCameraMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportSelectedCameraMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_SELECTED_CAMERA; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(ReportSelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportSelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportSelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportSelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportSelectedCameraMessage message); -static void dataDestroy(ReportSelectedCameraMessage message); -static unsigned int dataSize(ReportSelectedCameraMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportSelectedCameraMessage message) -{ - // Set initial values of message fields - message->cameraID = newJausByte(0); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportSelectedCameraMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportSelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // CameraID - if(!jausByteFromBuffer(&message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportSelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // CameraID - if(!jausByteToBuffer(message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportSelectedCameraMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportSelectedCameraMessage reportSelectedCameraMessageCreate(void) -{ - ReportSelectedCameraMessage message; - - message = (ReportSelectedCameraMessage)malloc( sizeof(ReportSelectedCameraMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportSelectedCameraMessageDestroy(ReportSelectedCameraMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportSelectedCameraMessageFromBuffer(ReportSelectedCameraMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportSelectedCameraMessageToBuffer(ReportSelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportSelectedCameraMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportSelectedCameraBuffer failed - } - } -} - -ReportSelectedCameraMessage reportSelectedCameraMessageFromJausMessage(JausMessage jausMessage) -{ - ReportSelectedCameraMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportSelectedCameraMessage)malloc( sizeof(ReportSelectedCameraMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportSelectedCameraMessageToJausMessage(ReportSelectedCameraMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportSelectedCameraMessageSize(ReportSelectedCameraMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportSelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportSelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/event/eventMessage.c b/lib/openjaus/libjaus/src/message/inform/event/eventMessage.c deleted file mode 100644 index b80b357df1d5207285179d84ef1a618d4a31d04d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/event/eventMessage.c +++ /dev/null @@ -1,462 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: eventMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a EventMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_EVENT; -static const int maxDataSizeBytes = 512000; // Max Message size: 500K - -static JausBoolean headerFromBuffer(EventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(EventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(EventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(EventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(EventMessage message); -static void dataDestroy(EventMessage message); -static unsigned int dataSize(EventMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(EventMessage message) -{ - // Set initial values of message fields - - message->eventId = newJausByte(0); - message->eventSequenceNumber = newJausByte(0); - message->reportMessage = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(EventMessage message) -{ - if(message->reportMessage) - { - jausMessageDestroy(message->reportMessage); - } -} - -// Return boolean of success -static JausBoolean dataFromBuffer(EventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort reportCommandCode = 0; - JausUnsignedInteger reportDataSize = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - // EventID - if(!jausByteFromBuffer(&message->eventId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Report CommandCode - if(!jausUnsignedShortFromBuffer(&reportCommandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Sequence Number - if(!jausByteFromBuffer(&message->eventSequenceNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Report DataSize - if(!jausUnsignedIntegerFromBuffer(&reportDataSize, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Jaus Report Message - message->reportMessage = jausMessageCreate(); - if(!message->reportMessage) - { - return JAUS_FALSE; - } - - message->reportMessage->commandCode = reportCommandCode; - message->reportMessage->dataSize = reportDataSize; - if(!jausAddressCopy(message->reportMessage->source, message->source)) return JAUS_FALSE; - if(!jausAddressCopy(message->reportMessage->source, message->source)) return JAUS_FALSE; - - // Check Buffer Size - if(bufferSizeBytes-index < message->reportMessage->dataSize) return JAUS_FALSE; - - // Allocate memory for report body - message->reportMessage->data = (unsigned char *) malloc(message->reportMessage->dataSize); - if(!message->reportMessage->data) return JAUS_FALSE; - - // Copy body of report from buffer - memcpy(message->reportMessage->data, buffer+index, message->reportMessage->dataSize); - index += message->reportMessage->dataSize; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(EventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - // EventID - if(!jausByteToBuffer(message->eventId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Report CommandCode - if(message->reportMessage) - { - if(!jausUnsignedShortToBuffer(message->reportMessage->commandCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - else - { - if(!jausUnsignedShortToBuffer(0, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // Event Sequence Number - if(!jausByteToBuffer(message->eventSequenceNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Report DataSize - if(message->reportMessage) - { - if(!jausUnsignedIntegerToBuffer(message->reportMessage->dataSize, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Check Buffer Size - if(bufferSizeBytes-index < message->reportMessage->dataSize) return JAUS_FALSE; - - // Copy body of report to buffer - memcpy(buffer+index, message->reportMessage->data, message->reportMessage->dataSize); - index += message->reportMessage->dataSize; - } - else - { - if(!jausUnsignedIntegerToBuffer(0, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(EventMessage message) -{ - int index = 0; - - // EventID - index += JAUS_BYTE_SIZE_BYTES; - - // Report CommandCode - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Sequence Number - index += JAUS_BYTE_SIZE_BYTES; - - // Report DataSize - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Jaus Report Message - if(message->reportMessage) - { - index += message->reportMessage->dataSize; - } - - return index; -} - - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -EventMessage eventMessageCreate(void) -{ - EventMessage message; - - message = (EventMessage)malloc( sizeof(EventMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void eventMessageDestroy(EventMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); - message = NULL; -} - -JausBoolean eventMessageFromBuffer(EventMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean eventMessageToBuffer(EventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < eventMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToEventBuffer failed - } - } -} - -EventMessage eventMessageFromJausMessage(JausMessage jausMessage) -{ - EventMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (EventMessage)malloc( sizeof(EventMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage eventMessageToJausMessage(EventMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int eventMessageSize(EventMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(EventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(EventMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/event/reportEventsMessage.c b/lib/openjaus/libjaus/src/message/inform/event/reportEventsMessage.c deleted file mode 100644 index 7f4cbb765c238503c3e5da5983efdafc910aaf36..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/event/reportEventsMessage.c +++ /dev/null @@ -1,623 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportEventsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportEventsMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_EVENTS; -static const int maxDataSizeBytes = 512000; // Max Message size: 500K - -static JausBoolean headerFromBuffer(ReportEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportEventsMessage message); -static void dataDestroy(ReportEventsMessage message); -static unsigned int dataSize(ReportEventsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportEventsMessage message) -{ - // Set initial values of message fields - - message->count = newJausByte(0); - message->presenceVector = NULL; - message->messageCode = NULL; - message->eventType = NULL; - message->eventBoundary = NULL; - message->limitDataField = NULL; - message->lowerLimit = NULL; - message->upperLimit = NULL; - message->stateLimit = NULL; - message->eventId = NULL; - message->queryMessage = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(ReportEventsMessage message) -{ - int i; - - for(i=0; icount; i++) - { - // Free message fields - if(message->presenceVector) free(message->presenceVector); - if(message->messageCode) free(message->messageCode); - if(message->eventType) free(message->eventType); - if(message->eventBoundary) free(message->eventBoundary); - - if(message->lowerLimit && message->lowerLimit[i]) - { - jausEventLimitDestroy(message->lowerLimit[i]); - } - - if(message->upperLimit && message->upperLimit[i]) - { - jausEventLimitDestroy(message->upperLimit[i]); - } - - if(message->stateLimit && message->stateLimit[i]) - { - jausEventLimitDestroy(message->stateLimit[i]); - } - - if(message->eventId) free(message->eventId); - - if(message->queryMessage && message->queryMessage[i]) - { - jausMessageDestroy(message->queryMessage[i]); - } - } -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int i; - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Event Count - if(!jausByteFromBuffer(&message->count, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(message->count == 0) - { - return JAUS_TRUE; - } - - message->presenceVector = (JausByte *)malloc(message->count * sizeof(JausByte)); - message->messageCode = (JausUnsignedShort *)malloc(message->count * sizeof(JausUnsignedShort)); - message->eventType = (JausByte *)malloc(message->count * sizeof(JausByte)); - message->eventBoundary = (JausByte *)malloc(message->count * sizeof(JausByte)); - message->limitDataField = (JausByte *)malloc(message->count * sizeof(JausByte)); - message->lowerLimit = (JausEventLimit *)malloc(message->count * sizeof(JausEventLimit)); - message->upperLimit = (JausEventLimit *)malloc(message->count * sizeof(JausEventLimit)); - message->stateLimit = (JausEventLimit *)malloc(message->count * sizeof(JausEventLimit)); - message->eventId = (JausByte *)malloc(message->count * sizeof(JausByte)); - message->queryMessage = (JausMessage *)malloc(message->count * sizeof(JausMessage)); - - for(i=0; icount; i++) - { - if(!jausByteFromBuffer(&message->presenceVector[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Message Code - if(!jausUnsignedShortFromBuffer(&message->messageCode[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Type - if(!jausByteFromBuffer(&message->eventType[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_BOUNDARY_BIT)) - { - // Event Boundary - if(!jausByteFromBuffer(&message->eventBoundary[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_DATA_FIELD_BIT)) - { - // Data Field - if(!jausByteFromBuffer(&message->limitDataField[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_LOWER_LIMIT_BIT)) - { - // Lower Limit - if(!jausEventLimitFromBuffer(&message->lowerLimit[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->lowerLimit[i]); - } - else - { - message->lowerLimit[i] = NULL; - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_UPPER_LIMIT_BIT)) - { - // Upper Limit - if(!jausEventLimitFromBuffer(&message->upperLimit[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->upperLimit[i]); - } - else - { - message->upperLimit[i] = NULL; - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_STATE_LIMIT_BIT)) - { - // State Limit - if(!jausEventLimitFromBuffer(&message->stateLimit[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->stateLimit[i]); - } - else - { - message->stateLimit[i] = NULL; - } - - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_EVENT_ID_BIT)) - { - if(!jausByteFromBuffer(&message->eventId[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_QUERY_MESSAGE_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - message->queryMessage[i] = jausMessageCreate(); - - // Jaus Message - if(!jausMessageFromBuffer(message->queryMessage[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausMessageSize(message->queryMessage[i]); - } - - }// for icount - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int i; - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Message Count - if(!jausByteToBuffer(message->count, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i=0; icount; i++) - { - // Presence Vector - if(!jausByteToBuffer(message->presenceVector[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Message Code - if(!jausUnsignedShortToBuffer(message->messageCode[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Type - if(!jausByteToBuffer(message->eventType[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_BOUNDARY_BIT)) - { - // Event Boundary - if(!jausByteToBuffer(message->eventBoundary[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_DATA_FIELD_BIT)) - { - // Data Field - if(!jausByteToBuffer(message->limitDataField[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_LOWER_LIMIT_BIT)) - { - // Lower Limit - if(!jausEventLimitToBuffer(message->lowerLimit[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->lowerLimit[i]); - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_UPPER_LIMIT_BIT)) - { - // Upper Limit - if(!jausEventLimitToBuffer(message->upperLimit[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->upperLimit[i]); - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_STATE_LIMIT_BIT)) - { - // State Limit - if(!jausEventLimitToBuffer(message->stateLimit[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausEventLimitSize(message->stateLimit[i]); - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_EVENT_ID_BIT)) - { - if(!jausByteToBuffer(message->eventId[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_QUERY_MESSAGE_BIT)) - { - if(!jausUnsignedIntegerToBuffer((JausUnsignedInteger)jausMessageSize(message->queryMessage[i]), buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Jaus Message - if(!jausMessageToBuffer(message->queryMessage[i], buffer+index, bufferSizeBytes)) return JAUS_FALSE; - index += jausMessageSize(message->queryMessage[i]); - } - } // for icount - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportEventsMessage message) -{ - int i; - int index = 0; - - // Message Count - index += JAUS_BYTE_SIZE_BYTES; - - // Presence Vectors - index += message->count * JAUS_BYTE_SIZE_BYTES; - - // Message Code - index += message->count * JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Event Type - index += message->count * JAUS_BYTE_SIZE_BYTES; - - for(i=0; icount; i++) - { - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_BOUNDARY_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_DATA_FIELD_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_LOWER_LIMIT_BIT)) - { - index += jausEventLimitSize(message->lowerLimit[i]); - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_UPPER_LIMIT_BIT)) - { - index += jausEventLimitSize(message->upperLimit[i]); - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_STATE_LIMIT_BIT)) - { - index += jausEventLimitSize(message->stateLimit[i]); - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_EVENT_ID_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector[i], REPORT_EVENTS_PV_QUERY_MESSAGE_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Jaus Message - index += jausMessageSize(message->queryMessage[i]); - } - } // end for loop - - return index; -} - - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportEventsMessage reportEventsMessageCreate(void) -{ - ReportEventsMessage message; - - message = (ReportEventsMessage)malloc( sizeof(ReportEventsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportEventsMessageDestroy(ReportEventsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); - message = NULL; -} - -JausBoolean reportEventsMessageFromBuffer(ReportEventsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportEventsMessageToBuffer(ReportEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportEventsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportEventsBuffer failed - } - } -} - -ReportEventsMessage reportEventsMessageFromJausMessage(JausMessage jausMessage) -{ - ReportEventsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportEventsMessage)malloc( sizeof(ReportEventsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportEventsMessageToJausMessage(ReportEventsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportEventsMessageSize(ReportEventsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/manipulator/reportJointEffortsMessage.c b/lib/openjaus/libjaus/src/message/inform/manipulator/reportJointEffortsMessage.c deleted file mode 100644 index 287382b4ae75327a822ee5a36ecb86afe958a24b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/manipulator/reportJointEffortsMessage.c +++ /dev/null @@ -1,390 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportJointEffortsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportJointEffortsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_JOINT_EFFORTS; -static const int maxDataSizeBytes = 4096; - -static JausBoolean headerFromBuffer(ReportJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportJointEffortsMessage message); -static void dataDestroy(ReportJointEffortsMessage message); -static unsigned int dataSize(ReportJointEffortsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportJointEffortsMessage message) -{ - // Report initial values of message fields - message->numJoints = newJausByte(0); - message->jointEffort = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(ReportJointEffortsMessage message) -{ - // Free message fields - if(message->jointEffort != NULL) - { - free(message->jointEffort); - } -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - if(!jausByteFromBuffer(&message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->jointEffort = (JausDouble *)malloc(sizeof(JausDouble)*message->numJoints); - - for(i=0; inumJoints; i++) - { - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - // Scaled Short (-100, 100) - message->jointEffort[i] = jausUnsignedShortToDouble(tempUShort, -100, 100); - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i=0; inumJoints; i++) - { - // Scaled Short (-100, 100) - tempUShort = jausUnsignedShortFromDouble(message->jointEffort[i], -100, 100); - - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportJointEffortsMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES * message->numJoints; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportJointEffortsMessage reportJointEffortsMessageCreate(void) -{ - ReportJointEffortsMessage message; - - message = (ReportJointEffortsMessage)malloc( sizeof(ReportJointEffortsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportJointEffortsMessageDestroy(ReportJointEffortsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportJointEffortsMessageFromBuffer(ReportJointEffortsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportJointEffortsMessageToBuffer(ReportJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportJointEffortsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -ReportJointEffortsMessage reportJointEffortsMessageFromJausMessage(JausMessage jausMessage) -{ - ReportJointEffortsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportJointEffortsMessage)malloc( sizeof(ReportJointEffortsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportJointEffortsMessageToJausMessage(ReportJointEffortsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportJointEffortsMessageSize(ReportJointEffortsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/manipulator/reportJointForceTorquesMessage.c b/lib/openjaus/libjaus/src/message/inform/manipulator/reportJointForceTorquesMessage.c deleted file mode 100644 index f6dae73606f7a45ee31ca14494c005c7996ac9f8..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/manipulator/reportJointForceTorquesMessage.c +++ /dev/null @@ -1,390 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportJointForceTorquesMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportJointForceTorquesMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_JOINT_FORCE_TORQUES; -static const int maxDataSizeBytes = 4096; - -static JausBoolean headerFromBuffer(ReportJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportJointForceTorquesMessage message); -static void dataDestroy(ReportJointForceTorquesMessage message); -static unsigned int dataSize(ReportJointForceTorquesMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportJointForceTorquesMessage message) -{ - // Report initial values of message fields - message->numJoints = newJausByte(0); - message->jointForceTorque = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(ReportJointForceTorquesMessage message) -{ - // Free message fields - if(message->jointForceTorque != NULL) - { - free(message->jointForceTorque); - } -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - if(!jausByteFromBuffer(&message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->jointForceTorque = (JausDouble *)malloc(sizeof(JausDouble)*message->numJoints); - - for(i=0; inumJoints; i++) - { - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-1000, 1000) - message->jointForceTorque[i] = jausUnsignedIntegerToDouble(tempUInt, -1000, 1000); - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i=0; inumJoints; i++) - { - // Scaled Short (-1000, 1000) - tempUInt = jausUnsignedIntegerFromDouble(message->jointForceTorque[i], -1000, 1000); - - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportJointForceTorquesMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES * message->numJoints; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportJointForceTorquesMessage reportJointForceTorquesMessageCreate(void) -{ - ReportJointForceTorquesMessage message; - - message = (ReportJointForceTorquesMessage)malloc( sizeof(ReportJointForceTorquesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportJointForceTorquesMessageDestroy(ReportJointForceTorquesMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportJointForceTorquesMessageFromBuffer(ReportJointForceTorquesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportJointForceTorquesMessageToBuffer(ReportJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportJointForceTorquesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -ReportJointForceTorquesMessage reportJointForceTorquesMessageFromJausMessage(JausMessage jausMessage) -{ - ReportJointForceTorquesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportJointForceTorquesMessage)malloc( sizeof(ReportJointForceTorquesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportJointForceTorquesMessageToJausMessage(ReportJointForceTorquesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportJointForceTorquesMessageSize(ReportJointForceTorquesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/manipulator/reportJointPositionsMessage.c b/lib/openjaus/libjaus/src/message/inform/manipulator/reportJointPositionsMessage.c deleted file mode 100644 index 53344d679d2e82a5c2c4ba2105ce35002832122b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/manipulator/reportJointPositionsMessage.c +++ /dev/null @@ -1,390 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportJointPositionsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportJointPositionsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_JOINT_POSITIONS; -static const int maxDataSizeBytes = 4096; - -static JausBoolean headerFromBuffer(ReportJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportJointPositionsMessage message); -static void dataDestroy(ReportJointPositionsMessage message); -static unsigned int dataSize(ReportJointPositionsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportJointPositionsMessage message) -{ - // Report initial values of message fields - message->numJoints = newJausByte(0); - message->jointPosition = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(ReportJointPositionsMessage message) -{ - // Free message fields - if(message->jointPosition != NULL) - { - free(message->jointPosition); - } -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - if(!jausByteFromBuffer(&message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->jointPosition = (JausDouble *)malloc(sizeof(JausDouble)*message->numJoints); - - for(i=0; inumJoints; i++) - { - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-8*JAUS_PI, 8*JAUS_PI) - message->jointPosition[i] = jausUnsignedIntegerToDouble(tempUInt, -8*JAUS_PI, 8*JAUS_PI); - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i=0; inumJoints; i++) - { - // Scaled Short (-8*JAUS_PI, 8*JAUS_PI) - tempUInt = jausUnsignedIntegerFromDouble(message->jointPosition[i], -8*JAUS_PI, 8*JAUS_PI); - - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportJointPositionsMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES * message->numJoints; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportJointPositionsMessage reportJointPositionsMessageCreate(void) -{ - ReportJointPositionsMessage message; - - message = (ReportJointPositionsMessage)malloc( sizeof(ReportJointPositionsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportJointPositionsMessageDestroy(ReportJointPositionsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportJointPositionsMessageFromBuffer(ReportJointPositionsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportJointPositionsMessageToBuffer(ReportJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportJointPositionsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -ReportJointPositionsMessage reportJointPositionsMessageFromJausMessage(JausMessage jausMessage) -{ - ReportJointPositionsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportJointPositionsMessage)malloc( sizeof(ReportJointPositionsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportJointPositionsMessageToJausMessage(ReportJointPositionsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportJointPositionsMessageSize(ReportJointPositionsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/manipulator/reportJointVelocitiesMessage.c b/lib/openjaus/libjaus/src/message/inform/manipulator/reportJointVelocitiesMessage.c deleted file mode 100644 index 00f7dd5d7ed7b1a888955643f4df8fee0bcade23..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/manipulator/reportJointVelocitiesMessage.c +++ /dev/null @@ -1,390 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportJointVelocitiesMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportJointVelocitiesMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_JOINT_VELOCITIES; -static const int maxDataSizeBytes = 4096; - -static JausBoolean headerFromBuffer(ReportJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportJointVelocitiesMessage message); -static void dataDestroy(ReportJointVelocitiesMessage message); -static unsigned int dataSize(ReportJointVelocitiesMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportJointVelocitiesMessage message) -{ - // Report initial values of message fields - message->numJoints = newJausByte(0); - message->jointVelocity = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(ReportJointVelocitiesMessage message) -{ - // Free message fields - if(message->jointVelocity != NULL) - { - free(message->jointVelocity); - } -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - if(!jausByteFromBuffer(&message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->jointVelocity = (JausDouble *)malloc(sizeof(JausDouble)*message->numJoints); - - for(i=0; inumJoints; i++) - { - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-10*JAUS_PI, 10*JAUS_PI) - message->jointVelocity[i] = jausUnsignedIntegerToDouble(tempUInt, -10*JAUS_PI, 10*JAUS_PI); - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i=0; inumJoints; i++) - { - // Scaled Short (-10*JAUS_PI, 10*JAUS_PI) - tempUInt = jausUnsignedIntegerFromDouble(message->jointVelocity[i], -10*JAUS_PI, 10*JAUS_PI); - - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportJointVelocitiesMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES * message->numJoints; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportJointVelocitiesMessage reportJointVelocitiesMessageCreate(void) -{ - ReportJointVelocitiesMessage message; - - message = (ReportJointVelocitiesMessage)malloc( sizeof(ReportJointVelocitiesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportJointVelocitiesMessageDestroy(ReportJointVelocitiesMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportJointVelocitiesMessageFromBuffer(ReportJointVelocitiesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportJointVelocitiesMessageToBuffer(ReportJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportJointVelocitiesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -ReportJointVelocitiesMessage reportJointVelocitiesMessageFromJausMessage(JausMessage jausMessage) -{ - ReportJointVelocitiesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportJointVelocitiesMessage)malloc( sizeof(ReportJointVelocitiesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportJointVelocitiesMessageToJausMessage(ReportJointVelocitiesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportJointVelocitiesMessageSize(ReportJointVelocitiesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/manipulator/reportManipulatorSpecificationsMessage.c b/lib/openjaus/libjaus/src/message/inform/manipulator/reportManipulatorSpecificationsMessage.c deleted file mode 100644 index 30b987d4885f6de850cfbf2dfacff122c20d026c..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/manipulator/reportManipulatorSpecificationsMessage.c +++ /dev/null @@ -1,680 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportManipulatorSpecificationsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportManipulatorSpecificationsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_MANIPULATOR_SPECIFICATIONS; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(ReportManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportManipulatorSpecificationsMessage message); -static void dataDestroy(ReportManipulatorSpecificationsMessage message); -static unsigned int dataSize(ReportManipulatorSpecificationsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportManipulatorSpecificationsMessage message) -{ - // Set initial values of message fields - message->numJoints = newJausByte(0); - message->jointType = NULL; - message->jointOffset = NULL; - message->linkLength = NULL; - message->twistAngle = NULL; - message->jointMinValue = NULL; - message->jointMaxValue = NULL; - message->jointMaxVelocity = NULL; - message->coordinateSysX = newJausDouble(0); - message->coordinateSysY = newJausDouble(0); - message->coordinateSysZ = newJausDouble(0); - message->coordinateSysA = newJausDouble(0); - message->coordinateSysB = newJausDouble(0); - message->coordinateSysC = newJausDouble(0); - message->coordinateSysD = newJausDouble(0); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportManipulatorSpecificationsMessage message) -{ - // Free message fields - if(message->jointType != NULL) - { - free(message->jointType); - } - - if(message->jointOffset != NULL) - { - free(message->jointOffset); - } - - if(message->linkLength != NULL) - { - free(message->linkLength); - } - - if(message->twistAngle != NULL) - { - free(message->twistAngle); - } - - if(message->jointMinValue != NULL) - { - free(message->jointMinValue); - } - - if(message->jointMaxValue != NULL) - { - free(message->jointMaxValue); - } - - if(message->jointMaxVelocity != NULL) - { - free(message->jointMaxVelocity); - } - -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedShort tempUShort; - JausUnsignedInteger tempUInt; - - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(message->numJoints == 0) - { - message->jointType = NULL; - message->jointOffset = NULL; - message->linkLength = NULL; - message->twistAngle = NULL; - message->jointMinValue = NULL; - message->jointMaxValue = NULL; - message->jointMaxVelocity = NULL; - return JAUS_TRUE; - } - - message->jointType = (JausByte *)malloc(sizeof(JausByte)*message->numJoints); - message->jointOffset = (JausDouble *)malloc(sizeof(JausDouble)*message->numJoints); - message->linkLength = (JausDouble *)malloc(sizeof(JausDouble)*message->numJoints - 1); - message->twistAngle = (JausDouble *)malloc(sizeof(JausDouble)*message->numJoints - 1); - message->jointMinValue = (JausDouble *)malloc(sizeof(JausDouble)*message->numJoints); - message->jointMaxValue = (JausDouble *)malloc(sizeof(JausDouble)*message->numJoints); - message->jointMaxVelocity = (JausDouble *)malloc(sizeof(JausDouble)*message->numJoints); - - if(!jausByteFromBuffer(&message->jointType[message->numJoints - 1], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->jointOffset[message->numJoints - 1] = (JausDouble)tempUShort; - if(message->jointType[message->numJoints - 1] == 1) // Handle special scaling for revolute joints - { - message->jointOffset[message->numJoints - 1] *= 0.001; - } - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->jointMinValue[message->numJoints - 1] = (JausDouble)tempUShort; - if(message->jointType[message->numJoints - 1] == 1) // Handle special scaling for revolute joints - { - message->jointMinValue[message->numJoints - 1] *= 0.001; - } - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->jointMaxValue[message->numJoints - 1] = (JausDouble)tempUShort; - if(message->jointType[message->numJoints - 1] == 1) // Handle special scaling for revolute joints - { - message->jointMaxValue[message->numJoints - 1] *= 0.001; - } - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->jointMaxVelocity[message->numJoints - 1] = (JausDouble)tempUShort; - if(message->jointType[message->numJoints - 1] == 1) // Handle special scaling for revolute joints - { - message->jointMaxVelocity[message->numJoints - 1] *= 0.001; - } - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - message->coordinateSysX = jausUnsignedIntegerToDouble(tempUInt, -30, 30); // Scaled Short (-30, 30) - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - message->coordinateSysY = jausUnsignedIntegerToDouble(tempUInt, -30, 30); // Scaled Short (-30, 30) - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - message->coordinateSysZ = jausUnsignedIntegerToDouble(tempUInt, -30, 30); // Scaled Short (-30, 30) - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - message->coordinateSysD = jausUnsignedIntegerToDouble(tempUInt, -1, 1); // Scaled Short (-30, 30) - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - message->coordinateSysA = jausUnsignedIntegerToDouble(tempUInt, -1, 1); // Scaled Short (-1, 1) - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - message->coordinateSysB = jausUnsignedIntegerToDouble(tempUInt, -1, 1); // Scaled Short (-1, 1) - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - message->coordinateSysC = jausUnsignedIntegerToDouble(tempUInt, -1, 1); // Scaled Short (-1, 1) - - - for(i=0; inumJoints - 1; i++) - { - if(!jausByteFromBuffer(&message->jointType[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->linkLength[i] = (JausDouble)tempUShort; - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->twistAngle[i] = (JausDouble)tempUShort * 0.001; - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->jointOffset[i] = (JausDouble)tempUShort; - if(message->jointType[i] == 1) // Handle special scaling for revolute joints - { - message->jointOffset[i] *= 0.001; - } - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->jointMinValue[i] = (JausDouble)tempUShort; - if(message->jointType[i] == 1) // Handle special scaling for revolute joints - { - message->jointMinValue[i] *= 0.001; - } - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->jointMaxValue[i] = (JausDouble)tempUShort; - if(message->jointType[i] == 1) // Handle special scaling for revolute joints - { - message->jointMaxValue[i] *= 0.001; - } - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->jointMaxVelocity[i] = (JausDouble)tempUShort; - if(message->jointType[i] == 1) // Handle special scaling for revolute joints - { - message->jointMaxVelocity[i] *= 0.001; - } - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i; - JausUnsignedShort tempUShort; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Unpack Message Fields from Buffer - if(!jausByteToBuffer(message->numJoints, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(message->numJoints == 0) - { - return index; - } - - if(!jausByteToBuffer(message->jointType[message->numJoints - 1], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(message->jointType[message->numJoints - 1] == 1) // Handle special scaling for revolute joints - { - message->jointOffset[message->numJoints - 1] *= 1000.0; - } - tempUShort = (JausUnsignedShort)message->jointOffset[message->numJoints - 1]; - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(message->jointType[message->numJoints - 1] == 1) // Handle special scaling for revolute joints - { - message->jointMinValue[message->numJoints - 1] *= 1000.0; - } - tempUShort = (JausUnsignedShort)message->jointMinValue[message->numJoints - 1]; - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(message->jointType[message->numJoints - 1] == 1) // Handle special scaling for revolute joints - { - message->jointMaxValue[message->numJoints - 1] *= 1000.0; - } - tempUShort = (JausUnsignedShort)message->jointMaxValue[message->numJoints - 1]; - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(message->jointType[message->numJoints - 1] == 1) // Handle special scaling for revolute joints - { - message->jointMaxVelocity[message->numJoints - 1] *= 1000.0; - } - tempUShort = (JausUnsignedShort)message->jointMaxVelocity[message->numJoints - 1]; - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->coordinateSysX, -30, 30); // Scaled Short (-30, 30) - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->coordinateSysY, -30, 30); // Scaled Short (-30, 30) - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->coordinateSysZ, -30, 30); // Scaled Short (-30, 30) - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->coordinateSysD, -1, 1); // Scaled Short (-30, 30) - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->coordinateSysA, -1, 1); // Scaled Short (-1, 1) - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->coordinateSysB, -1, 1); // Scaled Short (-1, 1) - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->coordinateSysC, -1, 1); // Scaled Short (-1, 1) - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - - for(i=0; inumJoints - 1; i++) - { - if(!jausByteToBuffer(message->jointType[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - tempUShort = (JausUnsignedShort)message->linkLength[i]; - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - tempUShort = (JausUnsignedShort) (message->twistAngle[i] * 1000.0); - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(message->jointType[i] == 1) // Handle special scaling for revolute joints - { - message->jointOffset[i] *= 1000.0; - } - tempUShort = (JausUnsignedShort)message->jointOffset[i]; - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(message->jointType[i] == 1) // Handle special scaling for revolute joints - { - message->jointMinValue[i] *= 1000.0; - } - tempUShort = (JausUnsignedShort)message->jointMinValue[i]; - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(message->jointType[i] == 1) // Handle special scaling for revolute joints - { - message->jointMaxValue[i] *= 1000.0; - } - tempUShort = (JausUnsignedShort)message->jointMaxValue[i]; - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(message->jointType[i] == 1) // Handle special scaling for revolute joints - { - message->jointMaxVelocity[i] *= 1000.0; - } - tempUShort = (JausUnsignedShort)message->jointMaxVelocity[i]; - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportManipulatorSpecificationsMessage message) -{ - int index = 0; - - // Num joints - index += JAUS_BYTE_SIZE_BYTES; - - if(message->numJoints == 0) - { - return index; - } - - // Joint Types - index += message->numJoints * JAUS_BYTE_SIZE_BYTES; - - // Joint offset, max, min, & max velocity - index += message->numJoints * 4 * JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // link lengths & twist angles - index += (message->numJoints - 1) * 2 * JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Coordinate system - index += 7 * JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportManipulatorSpecificationsMessage reportManipulatorSpecificationsMessageCreate(void) -{ - ReportManipulatorSpecificationsMessage message; - - message = (ReportManipulatorSpecificationsMessage)malloc( sizeof(ReportManipulatorSpecificationsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportManipulatorSpecificationsMessageDestroy(ReportManipulatorSpecificationsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportManipulatorSpecificationsMessageFromBuffer(ReportManipulatorSpecificationsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportManipulatorSpecificationsMessageToBuffer(ReportManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportManipulatorSpecificationsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportManipulatorSpecificationsBuffer failed - } - } -} - -ReportManipulatorSpecificationsMessage reportManipulatorSpecificationsMessageFromJausMessage(JausMessage jausMessage) -{ - ReportManipulatorSpecificationsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportManipulatorSpecificationsMessage)malloc( sizeof(ReportManipulatorSpecificationsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportManipulatorSpecificationsMessageToJausMessage(ReportManipulatorSpecificationsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportManipulatorSpecificationsMessageSize(ReportManipulatorSpecificationsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/manipulator/reportToolPointMessage.c b/lib/openjaus/libjaus/src/message/inform/manipulator/reportToolPointMessage.c deleted file mode 100644 index 4b39c84b11f96c7997ba90f0dfc1f3e66c2bc824..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/manipulator/reportToolPointMessage.c +++ /dev/null @@ -1,381 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportToolPointMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportToolPointMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_TOOL_POINT; -static const int maxDataSizeBytes = 12; - -static JausBoolean headerFromBuffer(ReportToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportToolPointMessage message); -static void dataDestroy(ReportToolPointMessage message); -static unsigned int dataSize(ReportToolPointMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportToolPointMessage message) -{ - // Report initial values of message fields - message->x = newJausDouble(0); - message->y = newJausDouble(0); - message->z = newJausDouble(0); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportToolPointMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-15, 15) - message->x = jausUnsignedIntegerToDouble(tempUInt, -15, 15); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-15, 15) - message->y = jausUnsignedIntegerToDouble(tempUInt, -15, 15); - - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - // Scaled Short (-15, 15) - message->z = jausUnsignedIntegerToDouble(tempUInt, -15, 15); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Scaled Short (-15, 15) - tempUInt = jausUnsignedIntegerFromDouble(message->x, -15, 15); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->y, -15, 15); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - tempUInt = jausUnsignedIntegerFromDouble(message->z, -15, 15); - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportToolPointMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportToolPointMessage reportToolPointMessageCreate(void) -{ - ReportToolPointMessage message; - - message = (ReportToolPointMessage)malloc( sizeof(ReportToolPointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportToolPointMessageDestroy(ReportToolPointMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportToolPointMessageFromBuffer(ReportToolPointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportToolPointMessageToBuffer(ReportToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportToolPointMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -ReportToolPointMessage reportToolPointMessageFromJausMessage(JausMessage jausMessage) -{ - ReportToolPointMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportToolPointMessage)malloc( sizeof(ReportToolPointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportToolPointMessageToJausMessage(ReportToolPointMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportToolPointMessageSize(ReportToolPointMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/payload/reportPayloadDataElementMessage.c b/lib/openjaus/libjaus/src/message/inform/payload/reportPayloadDataElementMessage.c deleted file mode 100644 index 6e5a989ea411392b941dd28856d4680a624e2692..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/payload/reportPayloadDataElementMessage.c +++ /dev/null @@ -1,442 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportPayloadDataElementMessage.c -// -// Written By: Bob Toucthon -// -// Version: 3.3.0a -// -// Date: // Date: 3/20/06 -// -// This file defines the functionality of a reportPayloadDataElementMessage -// NOTE WELL: this message will also be used for general purpose information exchange - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_PAYLOAD_DATA_ELEMENT; -static const int maxDataSizeBytes = 512000; - -static JausBoolean headerFromBuffer(ReportPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportPayloadDataElementMessage message); -static void dataDestroy(ReportPayloadDataElementMessage message); -static unsigned int dataSize(ReportPayloadDataElementMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportPayloadDataElementMessage message) -{ - // Set initial values of message fields - message->jausPayloadInterface = NULL; - message->numberInterfaces = 0; - message->indexes = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(ReportPayloadDataElementMessage message) -{ - // Free message fields - if(!message->indexes) free(message->indexes); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0, i = 0; - JausByte payloadInformationDataElementCount = 0; - JausByte informationInterfaceNumber; - JausInformationInterface informationInterface = NULL; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // # payload interfaces - if(!jausByteFromBuffer(&payloadInformationDataElementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->numberInterfaces = payloadInformationDataElementCount; - message->indexes = NULL; - - if(!payloadInformationDataElementCount) return JAUS_TRUE; // nothing to do - - message->indexes = malloc(payloadInformationDataElementCount * sizeof(int)); - - for(i = 0; i < payloadInformationDataElementCount; i++) - { - // unpack payloadDataElement Index number (indexing starts at 1) - if(!jausByteFromBuffer(&informationInterfaceNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - message->indexes[i] = informationInterfaceNumber; - - // get information interface for the current # - if(message->jausPayloadInterface && (message->jausPayloadInterface->jausInformationInterfaces->elementCount >= informationInterfaceNumber) ) - { - informationInterface = (JausInformationInterface) message->jausPayloadInterface->jausInformationInterfaces->elementData[informationInterfaceNumber - 1]; - } - - // unpack and set payloadDataElement's value - if(!jausInformationValueFromBuffer(informationInterface, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausInformationValueSizeBytes(informationInterface); - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i = 0; - JausByte payloadInformationDataElementCount = 0; - int informationInterfaceNumber = 0; - JausInformationInterface informationInterface = NULL; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // # payload interfaces - payloadInformationDataElementCount = message->numberInterfaces; - - if(!jausByteToBuffer(payloadInformationDataElementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i = 0; i < payloadInformationDataElementCount; i++) - { - // get payloadDataElement identifier - - // get/pack payloadDataElement index - informationInterfaceNumber = message->indexes[i]; - if(message->jausPayloadInterface && (message->jausPayloadInterface->jausInformationInterfaces->elementCount >= informationInterfaceNumber) ) - { - if(!jausByteToBuffer(informationInterfaceNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - else return JAUS_FALSE; - - // get corresponding informationInterface - informationInterface = (JausInformationInterface) message->jausPayloadInterface->jausInformationInterfaces->elementData[informationInterfaceNumber - 1]; - // get/pack payloadDataElement's value - if(!jausInformationValueToBuffer(informationInterface, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausInformationValueSizeBytes(informationInterface); - } - } - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportPayloadDataElementMessage message) -{ - int index = 0; - int i = 0; - JausByte payloadInformationDataElementCount = 0; - int informationInterfaceNumber = 0; - JausInformationInterface informationInterface = NULL; - - // Pack Message Fields to Buffer - // # payload interfaces - payloadInformationDataElementCount = message->numberInterfaces; - - index += JAUS_BYTE_SIZE_BYTES; - - for(i = 0; i < payloadInformationDataElementCount; i++) - { - // get payloadDataElement identifier - - // get/pack payloadDataElement index - informationInterfaceNumber = message->indexes[i]; - if(message->jausPayloadInterface && (message->jausPayloadInterface->jausInformationInterfaces->elementCount >= informationInterfaceNumber) ) - { - index += JAUS_BYTE_SIZE_BYTES; - } - else return 0; - - // get corresponding informationInterface - informationInterface = (JausInformationInterface) message->jausPayloadInterface->jausInformationInterfaces->elementData[informationInterfaceNumber - 1]; - index += jausInformationValueSizeBytes(informationInterface); - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportPayloadDataElementMessage reportPayloadDataElementMessageCreate(void) -{ - ReportPayloadDataElementMessage message; - - message = (ReportPayloadDataElementMessage)malloc( sizeof(ReportPayloadDataElementMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportPayloadDataElementMessageDestroy(ReportPayloadDataElementMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportPayloadDataElementMessageFromBuffer(ReportPayloadDataElementMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportPayloadDataElementMessageToBuffer(ReportPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportPayloadDataElementMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportPayloadDataElementBuffer failed - } - } -} - -ReportPayloadDataElementMessage reportPayloadDataElementMessageFromJausMessage(JausMessage jausMessage) -{ - ReportPayloadDataElementMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportPayloadDataElementMessage)malloc( sizeof(ReportPayloadDataElementMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportPayloadDataElementMessageToJausMessage(ReportPayloadDataElementMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportPayloadDataElementMessageSize(ReportPayloadDataElementMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/payload/reportPayloadInterfaceMessage.c b/lib/openjaus/libjaus/src/message/inform/payload/reportPayloadInterfaceMessage.c deleted file mode 100644 index a63264253e4d40a460a855e7dc1b506030c5f05d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/payload/reportPayloadInterfaceMessage.c +++ /dev/null @@ -1,1116 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportPayloadInterfaceMessage.c -// -// Written By: Bob Toucthon -// -// Version: 3.3.0a -// -// Date: // Date: 3/13/06 -// -// This file defines the functionality of a ReportPayloadInterfaceMessage -// NOTE WELL: this message will also be used for general purpose information exchange - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_PAYLOAD_INTERFACE; -static const int maxDataSizeBytes = 512000; - -static JausBoolean headerFromBuffer(ReportPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportPayloadInterfaceMessage message); -static void dataDestroy(ReportPayloadInterfaceMessage message); -static unsigned int dataSize(ReportPayloadInterfaceMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportPayloadInterfaceMessage message) -{ - // Set initial values of message fields - message->jausPayloadInterface = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(ReportPayloadInterfaceMessage message) -{ - // Free message fields - // We Don't Destroy the message->jausPayloadInterface because it belongs to the component, not this message - //jausPayloadInterfaceDestroy(message->jausPayloadInterface); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0, i = 0, len = 0; - JausByte payloadCommandInterfaceCount = 0; - JausByte payloadInformationInterfaceCount = 0; - JausByte tempByte, typeCode; - JausUnsignedShort tempUShort, tempX=0, tempY=0, tempW=0, tempH=0; - char * identifierString = NULL; - char * tempString = NULL; - JausTypeCode minValue, defaultValue, maxValue; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // unpack presence vector - if(!jausByteFromBuffer(&message->jausPayloadInterface->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // # payload interfaces - if(!jausByteFromBuffer(&payloadCommandInterfaceCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&payloadInformationInterfaceCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if((payloadCommandInterfaceCount + payloadInformationInterfaceCount) < 1) return JAUS_FALSE; - - for(i = 0; i < payloadCommandInterfaceCount; i++) - { - // unpack command identifier - len = (int)strlen((char *)(buffer+index)); - identifierString = malloc(len + 1); - strncpy(identifierString, (char *)(buffer+index), bufferSizeBytes-index); - index += len + 1; - - // unpack payloadInterface type - if(!jausByteFromBuffer(&typeCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Create payloadInterface with this identifier and typeCode - jausAddNewCommandInterface(message->jausPayloadInterface, identifierString, typeCode); - - // unpack/set units - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - jausSetCommandInterfaceUnits(message->jausPayloadInterface, identifierString, tempByte); - index += JAUS_BYTE_SIZE_BYTES; - - // unpack/set blocking flag - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - if(tempByte & 0x01) jausSetCommandInterfaceBlockingFlag(message->jausPayloadInterface, identifierString); - index += JAUS_BYTE_SIZE_BYTES; - - // unpack/set min/default/max values - if(!jausMinMaxDefaultFromBuffer(&minValue, buffer+index, bufferSizeBytes-index, typeCode)) return JAUS_FALSE; - index += jausMinMaxDefaultSizeBytes(typeCode); - - if(!jausMinMaxDefaultFromBuffer(&defaultValue, buffer+index, bufferSizeBytes-index, typeCode)) return JAUS_FALSE; - index += jausMinMaxDefaultSizeBytes(typeCode); - - if(!jausMinMaxDefaultFromBuffer(&maxValue, buffer+index, bufferSizeBytes-index, typeCode)) return JAUS_FALSE; - index += jausMinMaxDefaultSizeBytes(typeCode); - - jausSetCommandInterfaceMinMax(message->jausPayloadInterface, identifierString, minValue, maxValue); - jausSetCommandInterfaceDefault(message->jausPayloadInterface, identifierString, defaultValue); - - // unpack enumeration length - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // unpack/set enumeration if present - if(tempUShort != 0) - { - tempString = malloc(tempUShort); - strcpy(tempString, (char *)(buffer+index)); - index += tempUShort; - jausSetCommandInterfaceEnumeration(message->jausPayloadInterface, identifierString, tempString); - } - - // unpack/set HMI recommendation, if in PV - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_RECOMMENDATION_BIT)) - { - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - jausSetCommandInterfaceHmiRecommendation(message->jausPayloadInterface, identifierString, tempByte); - index += JAUS_BYTE_SIZE_BYTES; - } - - // unpack/set HMI location, if in PV - tempUShort = index; // set to test if any new parameters were available - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_XPOS_BIT)) - { - if(!jausUnsignedShortFromBuffer(&tempX, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_YPOS_BIT)) - { - if(!jausUnsignedShortFromBuffer(&tempY, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_WIDTH_BIT)) - { - if(!jausUnsignedShortFromBuffer(&tempW, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_HEIGHT_BIT)) - { - if(!jausUnsignedShortFromBuffer(&tempH, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - if(tempUShort != index) - { - jausSetCommandInterfaceHmiParameters(message->jausPayloadInterface, identifierString, tempX,tempY,tempW,tempH); - } - } - - for(i = 0; i < payloadInformationInterfaceCount; i++) - { - // unpack command identifier - len = (int)strlen((char *)(buffer+index)); - identifierString = malloc(len + 1); - strncpy(identifierString, (char *)(buffer+index), bufferSizeBytes-index); - index += len + 1; - - // unpack command association - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // unpack jausPayloadInterface type - if(!jausByteFromBuffer(&typeCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Create payloadInterface with this identifier and typeCode - jausAddNewInformationInterface(message->jausPayloadInterface, identifierString, typeCode); - - // set command association - jausSetInformationInterfaceCommandInterfaceAssoc(message->jausPayloadInterface, identifierString, tempByte); - - // unpack/set units - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - jausSetInformationInterfaceUnits(message->jausPayloadInterface, identifierString, tempByte); - index += JAUS_BYTE_SIZE_BYTES; - - // unpack/set min/default/max values - if(!jausMinMaxDefaultFromBuffer(&minValue, buffer+index, bufferSizeBytes-index, typeCode)) return JAUS_FALSE; - index += jausMinMaxDefaultSizeBytes(typeCode); - - if(!jausMinMaxDefaultFromBuffer(&defaultValue, buffer+index, bufferSizeBytes-index, typeCode)) return JAUS_FALSE; - index += jausMinMaxDefaultSizeBytes(typeCode); - - if(!jausMinMaxDefaultFromBuffer(&maxValue, buffer+index, bufferSizeBytes-index, typeCode)) return JAUS_FALSE; - index += jausMinMaxDefaultSizeBytes(typeCode); - - jausSetInformationInterfaceMinMax(message->jausPayloadInterface, identifierString, minValue, maxValue); - jausSetInformationInterfaceDefault(message->jausPayloadInterface, identifierString, defaultValue); - - // unpack enumeration length - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // unpack/set enumeration if present - if(tempUShort != 0) - { - tempString = malloc(tempUShort); - strcpy(tempString, (char *)(buffer+index)); - index += tempUShort; - jausSetInformationInterfaceEnumeration(message->jausPayloadInterface, identifierString, tempString); - } - - // unpack/set HMI recommendation, if in PV - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_RECOMMENDATION_BIT)) - { - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - jausSetInformationInterfaceHmiRecommendation(message->jausPayloadInterface, identifierString, tempByte); - index += JAUS_BYTE_SIZE_BYTES; - } - - // unpack/set HMI location, if in PV - tempUShort = index; // set to test if any new parameters were available - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_XPOS_BIT)) - { - if(!jausUnsignedShortFromBuffer(&tempX, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_YPOS_BIT)) - { - if(!jausUnsignedShortFromBuffer(&tempY, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_WIDTH_BIT)) - { - if(!jausUnsignedShortFromBuffer(&tempW, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_HEIGHT_BIT)) - { - if(!jausUnsignedShortFromBuffer(&tempH, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - if(tempUShort != index) // only bother doing this if something new was available - { - jausSetInformationInterfaceHmiParameters(message->jausPayloadInterface, identifierString, tempX,tempY,tempW,tempH); - } - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0, len = 0; - int i = 0; - int successFlag = SUCCESS; - JausByte payloadCommandInterfaceCount = 0; - JausByte payloadInformationInterfaceCount = 0; - JausByte tempByte, typeCode; - JausUnsignedShort tempUShort; - char * identifierString = NULL; - char * tempString = NULL; - JausTypeCode minValue, defaultValue, maxValue; - - if(bufferSizeBytes >= dataSize(message)) - { - if(!message->jausPayloadInterface) - { - return 0; - } - - // Pack Message Fields to Buffer - // pack presence vector - if(!jausByteToBuffer(message->jausPayloadInterface->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // # payload interfaces - payloadCommandInterfaceCount = message->jausPayloadInterface->jausCommandInterfaces->elementCount; - payloadInformationInterfaceCount = message->jausPayloadInterface->jausInformationInterfaces->elementCount; - - if(!jausByteToBuffer(payloadCommandInterfaceCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(payloadInformationInterfaceCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i = 0; i < payloadCommandInterfaceCount; i++) - { - // get/pack command identifier - successFlag = SUCCESS; - identifierString = jausGetCommandInterfaceIdentifierByIndex(message->jausPayloadInterface, i + 1, &successFlag); - if (successFlag) - { - len = (int)strlen(identifierString); - strncpy((char *)(buffer+index), identifierString, bufferSizeBytes-index); - index += len + 1; - } - - // get/pack payloadInterface type - successFlag = SUCCESS; - typeCode = jausGetCommandInterfaceTypeCode(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausByteToBuffer(typeCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // get/pack units - successFlag = SUCCESS; - tempByte = jausGetCommandInterfaceUnits(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // get/pack blocking flag - successFlag = SUCCESS; - if(jausGetCommandInterfaceBlockingFlag(message->jausPayloadInterface, identifierString, &successFlag)) - { - if(!jausByteToBuffer(0x01, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - else if (successFlag) - { - if(!jausByteToBuffer(0x00, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // get/pack min/default/max values - successFlag = SUCCESS; - minValue = jausGetCommandInterfaceMin(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausMinMaxDefaultToBuffer(minValue, buffer+index, bufferSizeBytes-index, typeCode)) return JAUS_FALSE; - index += jausMinMaxDefaultSizeBytes(typeCode); - } - - successFlag = SUCCESS; - defaultValue = jausGetCommandInterfaceDefault(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausMinMaxDefaultToBuffer(defaultValue, buffer+index, bufferSizeBytes-index, typeCode)) return JAUS_FALSE; - index += jausMinMaxDefaultSizeBytes(typeCode); - } - - successFlag = SUCCESS; - maxValue = jausGetCommandInterfaceMax(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausMinMaxDefaultToBuffer(maxValue, buffer+index, bufferSizeBytes-index, typeCode)) return JAUS_FALSE; - index += jausMinMaxDefaultSizeBytes(typeCode); - } - - // get/pack enumeration length - successFlag = SUCCESS; - tempUShort = jausGetCommandInterfaceEnumerationLength(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // get/pack enumeration if present - if(tempUShort != 0) - { - tempString = jausGetCommandInterfaceEnumeration(message->jausPayloadInterface, identifierString, &successFlag); - strcpy((char *)(buffer+index), tempString); - index += tempUShort; - } - - // get/pack HMI recommendation, if in PV - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_RECOMMENDATION_BIT)) - { - successFlag = SUCCESS; - tempByte = jausGetCommandInterfaceHmiRecommendation(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - } - // get/pack HMI location, if in PV - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_XPOS_BIT)) - { - tempUShort = jausGetCommandInterfaceHmiXPositionPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_YPOS_BIT)) - { - tempUShort = jausGetCommandInterfaceHmiYPositionPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_WIDTH_BIT)) - { - tempUShort = jausGetCommandInterfaceHmiWidthPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_HEIGHT_BIT)) - { - tempUShort = jausGetCommandInterfaceHmiHeightPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - } - - for(i = 0; i < payloadInformationInterfaceCount; i++) - { - // get/pack information identifier - successFlag = SUCCESS; - identifierString = jausGetInformationInterfaceIdentifierByIndex(message->jausPayloadInterface, i + 1, &successFlag); - if (successFlag) - { - len = (int)strlen(identifierString); - strncpy((char *)(buffer+index), identifierString, bufferSizeBytes-index); - index += len + 1; - } - - // get/pack command interface association - successFlag = SUCCESS; - tempByte = jausGetInformationInterfaceCommandInterfaceAssoc(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // get/pack payloadInterface type - successFlag = SUCCESS; - typeCode = jausGetInformationInterfaceTypeCode(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausByteToBuffer(typeCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // get/pack units - successFlag = SUCCESS; - tempByte = jausGetInformationInterfaceUnits(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - // get/pack min/default/max values - successFlag = SUCCESS; - minValue = jausGetInformationInterfaceMin(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausMinMaxDefaultToBuffer(minValue, buffer+index, bufferSizeBytes-index, typeCode)) return JAUS_FALSE; - index += jausMinMaxDefaultSizeBytes(typeCode); - } - - successFlag = SUCCESS; - defaultValue = jausGetInformationInterfaceDefault(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausMinMaxDefaultToBuffer(defaultValue, buffer+index, bufferSizeBytes-index, typeCode)) return JAUS_FALSE; - index += jausMinMaxDefaultSizeBytes(typeCode); - } - - successFlag = SUCCESS; - maxValue = jausGetInformationInterfaceMax(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausMinMaxDefaultToBuffer(maxValue, buffer+index, bufferSizeBytes-index, typeCode)) return JAUS_FALSE; - index += jausMinMaxDefaultSizeBytes(typeCode); - } - - // get/pack enumeration length - successFlag = SUCCESS; - tempUShort = jausGetInformationInterfaceEnumerationLength(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // get/pack enumeration if present - if(tempUShort != 0) - { - tempString = jausGetInformationInterfaceEnumeration(message->jausPayloadInterface, identifierString, &successFlag); - strcpy((char *)(buffer+index), tempString); - index += tempUShort; - } - - // get/pack HMI recommendation, if in PV - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_RECOMMENDATION_BIT)) - { - successFlag = SUCCESS; - tempByte = jausGetInformationInterfaceHmiRecommendation(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - } - // get/pack HMI location, if in PV - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_XPOS_BIT)) - { - tempUShort = jausGetInformationInterfaceHmiXPositionPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_YPOS_BIT)) - { - tempUShort = jausGetInformationInterfaceHmiYPositionPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_WIDTH_BIT)) - { - tempUShort = jausGetInformationInterfaceHmiWidthPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_HEIGHT_BIT)) - { - tempUShort = jausGetInformationInterfaceHmiHeightPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - } - } - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportPayloadInterfaceMessage message) -{ - int index = 0, len = 0; - int i = 0; - int successFlag = SUCCESS; - JausByte payloadCommandInterfaceCount = 0; - JausByte payloadInformationInterfaceCount = 0; - JausByte tempByte, typeCode; - JausUnsignedShort tempUShort; - char * identifierString = NULL; - char * tempString = NULL; - JausTypeCode minValue, defaultValue, maxValue; - - if(!message->jausPayloadInterface) - { - return 0; - } - - index += JAUS_BYTE_SIZE_BYTES; - - // # payload interfaces - payloadCommandInterfaceCount = message->jausPayloadInterface->jausCommandInterfaces->elementCount; - payloadInformationInterfaceCount = message->jausPayloadInterface->jausInformationInterfaces->elementCount; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_BYTE_SIZE_BYTES; - - for(i = 0; i < payloadCommandInterfaceCount; i++) - { - // get/pack command identifier - successFlag = SUCCESS; - identifierString = jausGetCommandInterfaceIdentifierByIndex(message->jausPayloadInterface, i + 1, &successFlag); - if (successFlag) - { - len = (int)strlen(identifierString); - index += len + 1; - } - - // get/pack payloadInterface type - successFlag = SUCCESS; - typeCode = jausGetCommandInterfaceTypeCode(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // get/pack units - successFlag = SUCCESS; - tempByte = jausGetCommandInterfaceUnits(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // get/pack blocking flag - successFlag = SUCCESS; - if(jausGetCommandInterfaceBlockingFlag(message->jausPayloadInterface, identifierString, &successFlag)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - else if (successFlag) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // get/pack min/default/max values - successFlag = SUCCESS; - minValue = jausGetCommandInterfaceMin(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += jausMinMaxDefaultSizeBytes(typeCode); - } - - successFlag = SUCCESS; - defaultValue = jausGetCommandInterfaceDefault(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += jausMinMaxDefaultSizeBytes(typeCode); - } - - successFlag = SUCCESS; - maxValue = jausGetCommandInterfaceMax(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += jausMinMaxDefaultSizeBytes(typeCode); - } - - // get/pack enumeration length - successFlag = SUCCESS; - tempUShort = jausGetCommandInterfaceEnumerationLength(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // get/pack enumeration if present - if(tempUShort != 0) - { - tempString = jausGetCommandInterfaceEnumeration(message->jausPayloadInterface, identifierString, &successFlag); - index += tempUShort; - } - - // get/pack HMI recommendation, if in PV - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_RECOMMENDATION_BIT)) - { - successFlag = SUCCESS; - tempByte = jausGetCommandInterfaceHmiRecommendation(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_BYTE_SIZE_BYTES; - } - } - // get/pack HMI location, if in PV - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_XPOS_BIT)) - { - tempUShort = jausGetCommandInterfaceHmiXPositionPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_YPOS_BIT)) - { - tempUShort = jausGetCommandInterfaceHmiYPositionPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_WIDTH_BIT)) - { - tempUShort = jausGetCommandInterfaceHmiWidthPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_HEIGHT_BIT)) - { - tempUShort = jausGetCommandInterfaceHmiHeightPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - } - - for(i = 0; i < payloadInformationInterfaceCount; i++) - { - // get/pack information identifier - successFlag = SUCCESS; - identifierString = jausGetInformationInterfaceIdentifierByIndex(message->jausPayloadInterface, i + 1, &successFlag); - if (successFlag) - { - len = (int)strlen(identifierString); - index += len + 1; - } - - // get/pack command interface association - successFlag = SUCCESS; - tempByte = jausGetInformationInterfaceCommandInterfaceAssoc(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // get/pack payloadInterface type - successFlag = SUCCESS; - typeCode = jausGetInformationInterfaceTypeCode(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // get/pack units - successFlag = SUCCESS; - tempByte = jausGetInformationInterfaceUnits(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - // get/pack min/default/max values - successFlag = SUCCESS; - minValue = jausGetInformationInterfaceMin(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += jausMinMaxDefaultSizeBytes(typeCode); - } - - successFlag = SUCCESS; - defaultValue = jausGetInformationInterfaceDefault(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += jausMinMaxDefaultSizeBytes(typeCode); - } - - successFlag = SUCCESS; - maxValue = jausGetInformationInterfaceMax(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += jausMinMaxDefaultSizeBytes(typeCode); - } - - // get/pack enumeration length - successFlag = SUCCESS; - tempUShort = jausGetInformationInterfaceEnumerationLength(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - // get/pack enumeration if present - if(tempUShort != 0) - { - tempString = jausGetInformationInterfaceEnumeration(message->jausPayloadInterface, identifierString, &successFlag); - index += (int) strlen(tempString); - } - - // get/pack HMI recommendation, if in PV - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_RECOMMENDATION_BIT)) - { - successFlag = SUCCESS; - tempByte = jausGetInformationInterfaceHmiRecommendation(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_BYTE_SIZE_BYTES; - } - } - // get/pack HMI location, if in PV - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_XPOS_BIT)) - { - tempUShort = jausGetInformationInterfaceHmiXPositionPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_YPOS_BIT)) - { - tempUShort = jausGetInformationInterfaceHmiYPositionPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_WIDTH_BIT)) - { - tempUShort = jausGetInformationInterfaceHmiWidthPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - - if(jausByteIsBitSet(message->jausPayloadInterface->presenceVector, JAUS_PAYLOAD_INTERFACE_PV_HMI_HEIGHT_BIT)) - { - tempUShort = jausGetInformationInterfaceHmiHeightPixels(message->jausPayloadInterface, identifierString, &successFlag); - if (successFlag) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - } - } - - return index; -} - - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportPayloadInterfaceMessage reportPayloadInterfaceMessageCreate(void) -{ - ReportPayloadInterfaceMessage message; - - message = (ReportPayloadInterfaceMessage)malloc( sizeof(ReportPayloadInterfaceMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportPayloadInterfaceMessageDestroy(ReportPayloadInterfaceMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportPayloadInterfaceMessageFromBuffer(ReportPayloadInterfaceMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportPayloadInterfaceMessageToBuffer(ReportPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportPayloadInterfaceMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportPayloadInterfaceBuffer failed - } - } -} - -ReportPayloadInterfaceMessage reportPayloadInterfaceMessageFromJausMessage(JausMessage jausMessage) -{ - ReportPayloadInterfaceMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportPayloadInterfaceMessage)malloc( sizeof(ReportPayloadInterfaceMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportPayloadInterfaceMessageToJausMessage(ReportPayloadInterfaceMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportPayloadInterfaceMessageSize(ReportPayloadInterfaceMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/planning/reportMissionStatusMessage.c b/lib/openjaus/libjaus/src/message/inform/planning/reportMissionStatusMessage.c deleted file mode 100644 index 824dd3b81de11a457c7bd1cc6ab7b883fdd7ae36..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/planning/reportMissionStatusMessage.c +++ /dev/null @@ -1,474 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportMissionStatusMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo -// AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a -// ReportMissionStatusMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/09/08 - - - -#include -#include -#include "jaus.h" - -#ifndef MISSION_DEFAULT_TYPES -#define DEFAULT_TO_FIRST_MISSION 0 -#define DEFAULT_TO_FIRST_MESSAGE_IN_TASK 0 -#define DEFAULT_TO_MISSION_SPECIFIED 0 -#define DEFAULT_TO_ALL_MISSIONS 0 -#endif - -static const int commandCode = JAUS_REPORT_MISSION_STATUS; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(ReportMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static int dataToBuffer(ReportMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static void dataInitialize(ReportMissionStatusMessage message); -static void dataDestroy(ReportMissionStatusMessage message); -static unsigned int dataSize(ReportMissionStatusMessage message); - -// ************************************************************************* // -// USER CONFIGURED FUNCTIONS -// ************************************************************************* // - -// Initializes the message-specific fields -static void dataInitialize(ReportMissionStatusMessage message) -{ - message->type = newJausByte(JAUS_MISSION); - message->status = newJausByte(JAUS_FINISHED); - message->secondaryStatus = newJausByte(JAUS_NON_ERROR_COND); - message->missionId = newJausUnsignedShort(DEFAULT_TO_FIRST_MISSION); - message->taskId = newJausUnsignedShort(DEFAULT_TO_MISSION_SPECIFIED); - message->taskMsgId = newJausUnsignedShort(DEFAULT_TO_FIRST_MESSAGE_IN_TASK); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportMissionStatusMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->type, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->status, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->secondaryStatus, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->missionId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->taskId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->taskMsgId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->type, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->status, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->secondaryStatus, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->missionId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->taskId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->taskMsgId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportMissionStatusMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; //type - index += JAUS_BYTE_SIZE_BYTES; //status - index += JAUS_BYTE_SIZE_BYTES; //secondaryStatus - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //missionId - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //taskId - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //taskMsgId - - return index; -} - -// ************************************************************************* // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************* // - -ReportMissionStatusMessage reportMissionStatusMessageCreate(void) -{ - ReportMissionStatusMessage message; - - message = (ReportMissionStatusMessage) - malloc( sizeof(ReportMissionStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportMissionStatusMessageDestroy(ReportMissionStatusMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportMissionStatusMessageFromBuffer - (ReportMissionStatusMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportMissionStatusMessageToBuffer - (ReportMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportMissionStatusMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, - buffer+JAUS_HEADER_SIZE_BYTES, - bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportMissionStatusBuffer failed - } - } -} - -ReportMissionStatusMessage reportMissionStatusMessageFromJausMessage - (JausMessage jausMessage) -{ - ReportMissionStatusMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportMissionStatusMessage) - malloc( sizeof(ReportMissionStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportMissionStatusMessageToJausMessage - (ReportMissionStatusMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, - jausMessage->data, - jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportMissionStatusMessageSize(ReportMissionStatusMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | - (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/planning/reportSpoolingPreferenceMessage.c b/lib/openjaus/libjaus/src/message/inform/planning/reportSpoolingPreferenceMessage.c deleted file mode 100644 index a680fb3f1cf91dfacdc1f90e4fbced41242edad3..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/planning/reportSpoolingPreferenceMessage.c +++ /dev/null @@ -1,370 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportSpoolingPreferenceMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportSpoolingPreferenceMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_SPOOLING_PREFERENCE; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(ReportSpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportSpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportSpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportSpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportSpoolingPreferenceMessage message); -static void dataDestroy(ReportSpoolingPreferenceMessage message); -static unsigned int dataSize(ReportSpoolingPreferenceMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportSpoolingPreferenceMessage message) -{ - // Set initial values of message fields - message->spoolType = newJausByte(0); - message->data = newJausInteger(0); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportSpoolingPreferenceMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportSpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->spoolType, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausIntegerFromBuffer(&message->data, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportSpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - if(!jausByteToBuffer(message->spoolType, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausIntegerToBuffer(message->data, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportSpoolingPreferenceMessage message) -{ - int index = 0; - - // spoolType - index += JAUS_BYTE_SIZE_BYTES; - // data - index += JAUS_INTEGER_SIZE_BYTES; - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportSpoolingPreferenceMessage reportSpoolingPreferenceMessageCreate(void) -{ - ReportSpoolingPreferenceMessage message; - - message = (ReportSpoolingPreferenceMessage)malloc( sizeof(ReportSpoolingPreferenceMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportSpoolingPreferenceMessageDestroy(ReportSpoolingPreferenceMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportSpoolingPreferenceMessageFromBuffer(ReportSpoolingPreferenceMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportSpoolingPreferenceMessageToBuffer(ReportSpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportSpoolingPreferenceMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportSpoolingPreferenceBuffer failed - } - } -} - -ReportSpoolingPreferenceMessage reportSpoolingPreferenceMessageFromJausMessage(JausMessage jausMessage) -{ - ReportSpoolingPreferenceMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportSpoolingPreferenceMessage)malloc( sizeof(ReportSpoolingPreferenceMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportSpoolingPreferenceMessageToJausMessage(ReportSpoolingPreferenceMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportSpoolingPreferenceMessageSize(ReportSpoolingPreferenceMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportSpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportSpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportDiscreteDevicesMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportDiscreteDevicesMessage.c deleted file mode 100644 index 7b691b3548bd0c5030be4b7e5c958778e0b110f5..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportDiscreteDevicesMessage.c +++ /dev/null @@ -1,476 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportDiscreteDevicesMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportDiscreteDevicesMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_DISCRETE_DEVICES; -static const int maxDataSizeBytes = 5; - -static JausBoolean headerFromBuffer(ReportDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportDiscreteDevicesMessage message); -static unsigned int dataSize(ReportDiscreteDevicesMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportDiscreteDevicesMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->gear = newJausByte(0); - message->transferCase = newJausByte(0); - - // Main Propulsion - message->mainPropulsion = JAUS_FALSE; - message->mainFuelSupply = JAUS_FALSE; - message->auxFuelSupply = JAUS_FALSE; - message->powerAuxDevices = JAUS_FALSE; - message->startingDevice = JAUS_FALSE; - message->coldStart = JAUS_FALSE; - message->automaticStart = JAUS_FALSE; - message->automaticStop = JAUS_FALSE; - - // Parking, Brake and Horn - message->parkingBrake = JAUS_FALSE; - message->horn = JAUS_FALSE; -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausByte tempByte; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Unpack according to presence vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_PROPULSION_BIT)) - { - //unpack - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->mainPropulsion = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_MAIN_POWER_BIT)? JAUS_TRUE : JAUS_FALSE; - message->mainFuelSupply = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_MAIN_FUEL_BIT)? JAUS_TRUE : JAUS_FALSE; - message->auxFuelSupply = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_AUXILARY_FUEL_BIT)? JAUS_TRUE : JAUS_FALSE; - message->powerAuxDevices = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_AUXILARY_POWER_BIT)? JAUS_TRUE : JAUS_FALSE; - message->startingDevice = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_STARTING_DEVICE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->coldStart = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_COLD_START_BIT)? JAUS_TRUE : JAUS_FALSE; - message->automaticStart = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_AUTO_START_BIT)? JAUS_TRUE : JAUS_FALSE; - message->automaticStop = jausByteIsBitSet(tempByte, JAUS_DEVICES_PROPULSION_BF_AUTO_SHUTDOWN_BIT)? JAUS_TRUE : JAUS_FALSE; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_PARKING_BIT)) - { - //unpack - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->parkingBrake = jausByteIsBitSet(tempByte, JAUS_DEVICES_OTHER_BF_PARKING_BRAKE_BIT)? JAUS_TRUE : JAUS_FALSE; - message->horn = jausByteIsBitSet(tempByte, JAUS_DEVICES_OTHER_BF_HORN_BIT)? JAUS_TRUE : JAUS_FALSE; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_GEAR_BIT)) - { - //unpack - if(!jausByteFromBuffer(&message->gear, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_TRANSFER_BIT)) - { - //unpack - if(!jausByteFromBuffer(&message->transferCase, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausByte tempByte = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Pack according to presence vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_PROPULSION_BIT)) - { - tempByte = 0; - if(message->mainPropulsion) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_MAIN_POWER_BIT); - if(message->mainFuelSupply) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_MAIN_FUEL_BIT); - if(message->auxFuelSupply) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_AUXILARY_FUEL_BIT); - if(message->powerAuxDevices) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_AUXILARY_POWER_BIT); - if(message->startingDevice) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_STARTING_DEVICE_BIT); - if(message->coldStart) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_COLD_START_BIT); - if(message->automaticStart) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_AUTO_START_BIT); - if(message->automaticStop) jausByteSetBit(&tempByte, JAUS_DEVICES_PROPULSION_BF_AUTO_SHUTDOWN_BIT); - - //pack - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_PARKING_BIT)) - { - tempByte = 0; - if(message->parkingBrake) jausByteSetBit(&tempByte, JAUS_DEVICES_OTHER_BF_PARKING_BRAKE_BIT); - if(message->horn) jausByteSetBit(&tempByte, JAUS_DEVICES_OTHER_BF_HORN_BIT); - - //pack - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_GEAR_BIT)) - { - //pack - if(!jausByteToBuffer(message->gear, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_TRANSFER_BIT)) - { - //pack - if(!jausByteToBuffer(message->transferCase, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportDiscreteDevicesMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_PROPULSION_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_PARKING_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_GEAR_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_DEVICES_PV_TRANSFER_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportDiscreteDevicesMessage reportDiscreteDevicesMessageCreate(void) -{ - ReportDiscreteDevicesMessage message; - - message = (ReportDiscreteDevicesMessage)malloc( sizeof(ReportDiscreteDevicesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportDiscreteDevicesMessageDestroy(ReportDiscreteDevicesMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportDiscreteDevicesMessageFromBuffer(ReportDiscreteDevicesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportDiscreteDevicesMessageToBuffer(ReportDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportDiscreteDevicesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportDescreteDevicesBuffer failed - } - } -} - -ReportDiscreteDevicesMessage reportDiscreteDevicesMessageFromJausMessage(JausMessage jausMessage) -{ - ReportDiscreteDevicesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportDiscreteDevicesMessage)malloc( sizeof(ReportDiscreteDevicesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportDiscreteDevicesMessageToJausMessage(ReportDiscreteDevicesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportDiscreteDevicesMessageSize(ReportDiscreteDevicesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportGlobalPathSegmentMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportGlobalPathSegmentMessage.c deleted file mode 100644 index 6e40c2a0a9a51f5ddc965e66e777224c65db451e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportGlobalPathSegmentMessage.c +++ /dev/null @@ -1,488 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportGlobalPathSegmentMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportGlobalPathSegmentMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_GLOBAL_PATH_SEGMENT; -static const int maxDataSizeBytes = 29; - -static JausBoolean headerFromBuffer(ReportGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportGlobalPathSegmentMessage message); -static unsigned int dataSize(ReportGlobalPathSegmentMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportGlobalPathSegmentMessage message) -{ - // Report initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->pathSegmentNumber = newJausUnsignedShort(0); - message->p1LatitudeDeg = newJausDouble(0); // Scaled Integer (-90, 90) - message->p1LongitudeDeg = newJausDouble(0); // Scaled Integer (-180, 180) - message->p1AltitudeM = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->p2LatitudeDeg = newJausDouble(0); // Scaled Integer (-90, 90) - message->p2LongitudeDeg = newJausDouble(0); // Scaled Integer (-180, 180) - message->p2AltitudeM = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->weightingFactor = newJausDouble(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Use Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->pathSegmentNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //unpack - //JausDouble p1LatitudeDeg // Scaled Integer (-90, 90) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p1LatitudeDeg = jausIntegerToDouble(tempInteger, -90, 90); - - //unpack - //JausDouble p1LongitudeDeg // Scaled Integer (-180, 180) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p1LongitudeDeg = jausIntegerToDouble(tempInteger, -180, 180); - - if(jausByteIsBitSet(message->presenceVector, JAUS_PATH_SEGMENT_PV_P1_ALTITUDE_BIT)) - { - //unpack - //JausDouble p1AltitudeM // Scaled Integer (-10000, 35000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - message->p1AltitudeM = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - //unpack - //JausDouble p2LatitudeDeg // Scaled Integer (-90, 90) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p2LatitudeDeg = jausIntegerToDouble(tempInteger, -90, 90); - - //unpack - //JausDouble p2LongitudeDeg // Scaled Integer (-180, 180) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p2LongitudeDeg = jausIntegerToDouble(tempInteger, -180, 180); - - if(jausByteIsBitSet(message->presenceVector, JAUS_PATH_SEGMENT_PV_P2_ALTITUDE_BIT)) - { - //unpack - //JausDouble p2AltitudeM // Scaled Integer (-10000, 35000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - message->p2AltitudeM = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->weightingFactor = jausUnsignedShortToDouble(tempUShort, 0, 500); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Use Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->pathSegmentNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //pack - //JausDouble p1LatitudeDeg // Scaled Integer (-90, 90) - tempInteger = jausIntegerFromDouble(message->p1LatitudeDeg, -90, 90); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - //pack - //JausDouble p1LongitudeDeg // Scaled Integer (-180, 180) - tempInteger = jausIntegerFromDouble(message->p1LongitudeDeg, -180, 180); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_PATH_SEGMENT_PV_P1_ALTITUDE_BIT)) - { - //pack - //JausDouble p1AltitudeM // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->p1AltitudeM, -10000, 35000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - //JausDouble p2LatitudeDeg // Scaled Integer (-90, 90) - tempInteger = jausIntegerFromDouble(message->p2LatitudeDeg, -90, 90); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - //pack - //JausDouble p2LongitudeDeg // Scaled Integer (-180, 180) - tempInteger = jausIntegerFromDouble(message->p2LongitudeDeg, -180, 180); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_PATH_SEGMENT_PV_P2_ALTITUDE_BIT)) - { - //pack - //JausDouble p2AltitudeM // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->p2AltitudeM, -10000, 35000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - tempUShort = jausUnsignedShortFromDouble(message->weightingFactor, 0, 500); - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - } - return index; -} - -static unsigned int dataSize(ReportGlobalPathSegmentMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_PATH_SEGMENT_PV_P1_ALTITUDE_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - index += JAUS_INTEGER_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_PATH_SEGMENT_PV_P2_ALTITUDE_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportGlobalPathSegmentMessage reportGlobalPathSegmentMessageCreate(void) -{ - ReportGlobalPathSegmentMessage message; - - message = (ReportGlobalPathSegmentMessage)malloc( sizeof(ReportGlobalPathSegmentMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportGlobalPathSegmentMessageDestroy(ReportGlobalPathSegmentMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportGlobalPathSegmentMessageFromBuffer(ReportGlobalPathSegmentMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportGlobalPathSegmentMessageToBuffer(ReportGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportGlobalPathSegmentMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportGlobalPathSegmentBuffer failed - } - } -} - -ReportGlobalPathSegmentMessage reportGlobalPathSegmentMessageFromJausMessage(JausMessage jausMessage) -{ - ReportGlobalPathSegmentMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportGlobalPathSegmentMessage)malloc( sizeof(ReportGlobalPathSegmentMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportGlobalPathSegmentMessageToJausMessage(ReportGlobalPathSegmentMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportGlobalPathSegmentMessageSize(ReportGlobalPathSegmentMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportGlobalPoseMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportGlobalPoseMessage.c deleted file mode 100644 index 9a1f7b414dd5e7ee4a7dfe8ab6315127491f01c1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportGlobalPoseMessage.c +++ /dev/null @@ -1,611 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportGlobalPoseMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportGlobalPoseMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_GLOBAL_POSE; -static const int maxDataSizeBytes = 30; - -static JausBoolean headerFromBuffer(ReportGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportGlobalPoseMessage message); -static void dataDestroy(ReportGlobalPoseMessage message); -static unsigned int dataSize(ReportGlobalPoseMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportGlobalPoseMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); - message->latitudeDegrees = newJausDouble(0); // Scaled Int (-90, 90) - message->longitudeDegrees = newJausDouble(0); // Scaled Int (-180, 180) - message->elevationMeters = newJausDouble(0); // Scaled Int (-10000, 35000) - message->positionRmsMeters = newJausDouble(0); // Scaled UInt (0, 100) - message->rollRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->pitchRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->yawRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->attitudeRmsRadians = newJausDouble(0); // Scaled Short (0, JAUS_PI) - message->time = jausTimeCreate(); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportGlobalPoseMessage message) -{ - // Free message fields - if(message->time) jausTimeDestroy(message->time); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInt; - JausUnsignedInteger tempUInt; - JausShort tempShort; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Use Presence Vector - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_LATITUDE_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-90, 90) - message->latitudeDegrees = jausIntegerToDouble(tempInt, -90, 90); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_LONGITUDE_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-180, 180) - message->longitudeDegrees = jausIntegerToDouble(tempInt, -180, 180); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_ELEVATION_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-10000, 35000) - message->elevationMeters = jausIntegerToDouble(tempInt, -10000, 35000); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_POSITION_RMS_BIT)) - { - //unpack - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Scaled Int (0, 100) - message->positionRmsMeters = jausUnsignedIntegerToDouble(tempUInt, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_ROLL_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - message->rollRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_PITCH_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - message->pitchRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_YAW_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - message->yawRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_ATTITUDE_RMS_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, JAUS_PI) - message->attitudeRmsRadians = jausUnsignedShortToDouble(tempUShort, 0, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_TIME_STAMP_BIT)) - { - // Create JausTime pointer - message->time = jausTimeCreate(); - if(!message->time) return JAUS_FALSE; - - //unpack - if(!jausTimeStampFromBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - else - { - message->time = NULL; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInt; - JausUnsignedInteger tempUInt; - JausShort tempShort; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Use Presence Vector - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_LATITUDE_BIT)) - { - // Scaled Int (-90, 90) - tempInt = jausIntegerFromDouble(message->latitudeDegrees, -90, 90); - - //pack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_LONGITUDE_BIT)) - { - // Scaled Int (-180, 180) - tempInt = jausIntegerFromDouble(message->longitudeDegrees, -180, 180); - - //pack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_ELEVATION_BIT)) - { - // Scaled Int (-10000, 35000) - tempInt = jausIntegerFromDouble(message->elevationMeters, -10000, 35000); - - //unpack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_POSITION_RMS_BIT)) - { - // Scaled Int (0, 100) - tempUInt = jausUnsignedIntegerFromDouble(message->positionRmsMeters, 0, 100); - - //unpack - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_ROLL_BIT)) - { - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->rollRadians, -JAUS_PI, JAUS_PI); - - // unpack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_PITCH_BIT)) - { - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->pitchRadians, -JAUS_PI, JAUS_PI); - - // unpack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_YAW_BIT)) - { - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->yawRadians, -JAUS_PI, JAUS_PI); - - // unpack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_ATTITUDE_RMS_BIT)) - { - // Scaled Unsigned Short (0, JAUS_PI) - tempUShort = jausUnsignedShortFromDouble(message->attitudeRmsRadians, 0, JAUS_PI); - - // unpack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_TIME_STAMP_BIT)) - { - //unpack - if(!jausTimeStampToBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportGlobalPoseMessage message) -{ - int index = 0; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_LATITUDE_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_LONGITUDE_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_ELEVATION_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_POSITION_RMS_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_ROLL_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_PITCH_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_YAW_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_ATTITUDE_RMS_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_TIME_STAMP_BIT)) - { - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportGlobalPoseMessage reportGlobalPoseMessageCreate(void) -{ - ReportGlobalPoseMessage message; - - message = (ReportGlobalPoseMessage)malloc( sizeof(ReportGlobalPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportGlobalPoseMessageDestroy(ReportGlobalPoseMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportGlobalPoseMessageFromBuffer(ReportGlobalPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportGlobalPoseMessageToBuffer(ReportGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportGlobalPoseMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportGlobalPoseBuffer failed - } - } -} - -ReportGlobalPoseMessage reportGlobalPoseMessageFromJausMessage(JausMessage jausMessage) -{ - ReportGlobalPoseMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportGlobalPoseMessage)malloc( sizeof(ReportGlobalPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportGlobalPoseMessageToJausMessage(ReportGlobalPoseMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportGlobalPoseMessageSize(ReportGlobalPoseMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportGlobalVectorMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportGlobalVectorMessage.c deleted file mode 100644 index 1ae429400a7c9f1bc9bb45abfacf4371f23464c3..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportGlobalVectorMessage.c +++ /dev/null @@ -1,497 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportGlobalVectorMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportGlobalVectorMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_GLOBAL_VECTOR; -static const int maxDataSizeBytes = 13; - -static JausBoolean headerFromBuffer(ReportGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportGlobalVectorMessage message); -static unsigned int dataSize(ReportGlobalVectorMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportGlobalVectorMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - - message->speedMps = newJausDouble(0); // Scaled Unsigned Short (0, 10000) Mps = Meters Per Second - message->altitudeMeters = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->headingRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->rollRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->pitchRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Unpack according to presence vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_SPEED_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 10000) - message->speedMps = jausUnsignedShortToDouble(tempUShort, 0, 10000); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_ALTITUDE_BIT)) - { - // unpack - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Integer (-10000, 35000) - message->altitudeMeters = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_HEADING_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - message->headingRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_ROLL_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - message->rollRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_PITCH_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - message->pitchRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Pack according to presence vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_SPEED_BIT)) - { - // Scaled Unsigned Short (0, 10000) - tempUShort = jausUnsignedShortFromDouble(message->speedMps, 0, 10000); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_ALTITUDE_BIT)) - { - // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->altitudeMeters, -10000, 35000); - - // pack - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_HEADING_BIT)) - { - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->headingRadians, -JAUS_PI, JAUS_PI); - - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_ROLL_BIT)) - { - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->rollRadians, -JAUS_PI, JAUS_PI); - - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_PITCH_BIT)) - { - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->pitchRadians, -JAUS_PI, JAUS_PI); - - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportGlobalVectorMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_SPEED_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_ALTITUDE_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_HEADING_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_ROLL_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_VECTOR_PV_PITCH_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportGlobalVectorMessage reportGlobalVectorMessageCreate(void) -{ - ReportGlobalVectorMessage message; - - message = (ReportGlobalVectorMessage)malloc( sizeof(ReportGlobalVectorMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportGlobalVectorMessageDestroy(ReportGlobalVectorMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportGlobalVectorMessageFromBuffer(ReportGlobalVectorMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportGlobalVectorMessageToBuffer(ReportGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportGlobalVectorMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportGlobalVectorBuffer failed - } - } -} - -ReportGlobalVectorMessage reportGlobalVectorMessageFromJausMessage(JausMessage jausMessage) -{ - ReportGlobalVectorMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportGlobalVectorMessage)malloc( sizeof(ReportGlobalVectorMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportGlobalVectorMessageToJausMessage(ReportGlobalVectorMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportGlobalVectorMessageSize(ReportGlobalVectorMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportGlobalWaypointMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportGlobalWaypointMessage.c deleted file mode 100644 index 8a0c7de96d5bb5eda3a2c7182b5684f4b31e90c1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportGlobalWaypointMessage.c +++ /dev/null @@ -1,497 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportGlobalWaypointMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportGlobalWaypointMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_GLOBAL_WAYPOINT; -static const int maxDataSizeBytes = 21; - -static JausBoolean headerFromBuffer(ReportGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportGlobalWaypointMessage message); -static unsigned int dataSize(ReportGlobalWaypointMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportGlobalWaypointMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->waypointNumber = newJausUnsignedShort(0); - message->latitudeDegrees = newJausDouble(0); // Scaled Integer (-90, 90) - message->longitudeDegrees = newJausDouble(0); // Scaled Integer (-180, 180) - message->elevationMeters = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->rollRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->pitchRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->yawRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Use Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->waypointNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //unpack - //JausDouble latitudeDegrees // Scaled Integer (-90, 90) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->latitudeDegrees = jausIntegerToDouble(tempInteger, -90, 90); - - //unpack - //JausDouble longitudeDegrees // Scaled Integer (-180, 180) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->longitudeDegrees = jausIntegerToDouble(tempInteger, -180, 180); - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_ELEVATION_BIT)) - { - //unpack - //JausDouble elevationMeters // Scaled Integer (-10000, 35000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - message->elevationMeters = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_ROLL_BIT)) - { - //unpack - //JausDouble rollRadians // Scaled Short (-JAUS_PI, JAUS_PI) - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - message->rollRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_PITCH_BIT)) - { - //unpack - //JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - message->pitchRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_YAW_BIT)) - { - //unpack - //JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - message->yawRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Use Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->waypointNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //pack - //JausDouble latitudeDegrees // Scaled Integer (-90, 90) - tempInteger = jausIntegerFromDouble(message->latitudeDegrees, -90, 90); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - //pack - //JausDouble longitudeDegrees // Scaled Integer (-180, 180) - tempInteger = jausIntegerFromDouble(message->longitudeDegrees, -180, 180); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_ELEVATION_BIT)) - { - //pack - //JausDouble elevationMeters // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->elevationMeters, -10000, 35000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_ROLL_BIT)) - { - //pack - //JausDouble rollRadians // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->rollRadians, -JAUS_PI, JAUS_PI); - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_PITCH_BIT)) - { - //pack - //JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->pitchRadians, -JAUS_PI, JAUS_PI); - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_YAW_BIT)) - { - //pack - //JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->yawRadians, -JAUS_PI, JAUS_PI); - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - } - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportGlobalWaypointMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_ELEVATION_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_ROLL_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_PITCH_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_WAYPOINT_PV_YAW_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportGlobalWaypointMessage reportGlobalWaypointMessageCreate(void) -{ - ReportGlobalWaypointMessage message; - - message = (ReportGlobalWaypointMessage)malloc( sizeof(ReportGlobalWaypointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportGlobalWaypointMessageDestroy(ReportGlobalWaypointMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportGlobalWaypointMessageFromBuffer(ReportGlobalWaypointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportGlobalWaypointMessageToBuffer(ReportGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportGlobalWaypointMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportGlobalWaypointBuffer failed - } - } -} - -ReportGlobalWaypointMessage reportGlobalWaypointMessageFromJausMessage(JausMessage jausMessage) -{ - ReportGlobalWaypointMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportGlobalWaypointMessage)malloc( sizeof(ReportGlobalWaypointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportGlobalWaypointMessageToJausMessage(ReportGlobalWaypointMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportGlobalWaypointMessageSize(ReportGlobalWaypointMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportLocalPathSegmentMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportLocalPathSegmentMessage.c deleted file mode 100644 index 6bae990c95d8cdb3c1ab1a8feaee1c56be82e067..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportLocalPathSegmentMessage.c +++ /dev/null @@ -1,488 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportLocalPathSegmentMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportLocalPathSegmentMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_LOCAL_PATH_SEGMENT; -static const int maxDataSizeBytes = 29; - -static JausBoolean headerFromBuffer(ReportLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportLocalPathSegmentMessage message); -static unsigned int dataSize(ReportLocalPathSegmentMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportLocalPathSegmentMessage message) -{ - // Report initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->pathSegmentNumber = newJausUnsignedShort(0); - message->p1XM = newJausDouble(0); // Scaled Integer (-100000, 100000) - message->p1YM = newJausDouble(0); // Scaled Integer (-100000, 100000) - message->p1ZM = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->p2XM = newJausDouble(0); // Scaled Integer (-100000, 100000) - message->p2YM = newJausDouble(0); // Scaled Integer (-100000, 100000) - message->p2ZM = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->weightingFactor = newJausDouble(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Use Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->pathSegmentNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //unpack - //JausDouble p1XM // Scaled Integer (-100000, 100000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p1XM = jausIntegerToDouble(tempInteger, -100000, 100000); - - //unpack - //JausDouble p1YM // Scaled Integer (-100000, 100000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p1YM = jausIntegerToDouble(tempInteger, -100000, 100000); - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_PATH_SEGMENT_PV_P1_Z_BIT)) - { - //unpack - //JausDouble p1ZM // Scaled Integer (-10000, 35000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - message->p1ZM = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - //unpack - //JausDouble p2XM // Scaled Integer (-100000, 100000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p2XM = jausIntegerToDouble(tempInteger, -100000, 100000); - - //unpack - //JausDouble p2YM // Scaled Integer (-100000, 100000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->p2YM = jausIntegerToDouble(tempInteger, -100000, 100000); - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_PATH_SEGMENT_PV_P2_Z_BIT)) - { - //unpack - //JausDouble p2ZM // Scaled Integer (-10000, 35000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - message->p2ZM = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - message->weightingFactor = jausUnsignedShortToDouble(tempUShort, 0, 500); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Use Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->pathSegmentNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //pack - //JausDouble p1XM // Scaled Integer (-100000, 100000) - tempInteger = jausIntegerFromDouble(message->p1XM, -100000, 100000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - //pack - //JausDouble p1YM // Scaled Integer (-100000, 100000) - tempInteger = jausIntegerFromDouble(message->p1YM, -100000, 100000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_PATH_SEGMENT_PV_P1_Z_BIT)) - { - //pack - //JausDouble p1ZM // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->p1ZM, -10000, 35000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - //JausDouble p2XM // Scaled Integer (-100000, 100000) - tempInteger = jausIntegerFromDouble(message->p2XM, -100000, 100000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - //pack - //JausDouble p2YM // Scaled Integer (-100000, 100000) - tempInteger = jausIntegerFromDouble(message->p2YM, -100000, 100000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_PATH_SEGMENT_PV_P2_Z_BIT)) - { - //pack - //JausDouble p2ZM // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->p2ZM, -10000, 35000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - tempUShort = jausUnsignedShortFromDouble(message->weightingFactor, 0, 500); - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - } - return index; -} - -static unsigned int dataSize(ReportLocalPathSegmentMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_PATH_SEGMENT_PV_P1_Z_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - index += JAUS_INTEGER_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_PATH_SEGMENT_PV_P2_Z_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportLocalPathSegmentMessage reportLocalPathSegmentMessageCreate(void) -{ - ReportLocalPathSegmentMessage message; - - message = (ReportLocalPathSegmentMessage)malloc( sizeof(ReportLocalPathSegmentMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportLocalPathSegmentMessageDestroy(ReportLocalPathSegmentMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportLocalPathSegmentMessageFromBuffer(ReportLocalPathSegmentMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportLocalPathSegmentMessageToBuffer(ReportLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportLocalPathSegmentMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportLocalPathSegmentBuffer failed - } - } -} - -ReportLocalPathSegmentMessage reportLocalPathSegmentMessageFromJausMessage(JausMessage jausMessage) -{ - ReportLocalPathSegmentMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportLocalPathSegmentMessage)malloc( sizeof(ReportLocalPathSegmentMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportLocalPathSegmentMessageToJausMessage(ReportLocalPathSegmentMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportLocalPathSegmentMessageSize(ReportLocalPathSegmentMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportLocalPoseMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportLocalPoseMessage.c deleted file mode 100644 index 227992556d7e40471f0bf5880020312de1526944..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportLocalPoseMessage.c +++ /dev/null @@ -1,610 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportLocalPoseMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportLocalPoseMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_LOCAL_POSE; -static const int maxDataSizeBytes = 30; - -static JausBoolean headerFromBuffer(ReportLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportLocalPoseMessage message); -static void dataDestroy(ReportLocalPoseMessage message); -static unsigned int dataSize(ReportLocalPoseMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportLocalPoseMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); - message->xM = newJausDouble(0); // Scaled Int (-100000, 100000) - message->yM = newJausDouble(0); // Scaled Int (-100000, 100000) - message->zM = newJausDouble(0); // Scaled Int (-10000, 35000) - message->positionRmsMeters = newJausDouble(0); // Scaled UInt (0, 100) - message->rollRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->pitchRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->yawRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->attitudeRmsRadians = newJausDouble(0); // Scaled Short (0, JAUS_PI) - message->time = jausTimeCreate(); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportLocalPoseMessage message) -{ - // Free message fields - if(message->time) jausTimeDestroy(message->time); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInt; - JausUnsignedInteger tempUInt; - JausShort tempShort; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Use Presence Vector - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_X_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-100000, 100000) - message->xM = jausIntegerToDouble(tempInt, -100000, 100000); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_Y_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-100000, 100000) - message->yM = jausIntegerToDouble(tempInt, -100000, 100000); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_Z_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-10000, 35000) - message->zM = jausIntegerToDouble(tempInt, -10000, 35000); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_POSITION_RMS_BIT)) - { - //unpack - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Scaled Int (0, 100) - message->positionRmsMeters = jausUnsignedIntegerToDouble(tempUInt, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_ROLL_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - message->rollRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_PITCH_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - message->pitchRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_YAW_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - message->yawRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_ATTITUDE_RMS_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, JAUS_PI) - message->attitudeRmsRadians = jausUnsignedShortToDouble(tempUShort, 0, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_TIME_STAMP_BIT)) - { - message->time = jausTimeCreate(); - if(!message->time) return JAUS_FALSE; - - //unpack - if(!jausTimeStampFromBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - else - { - message->time = NULL; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInt; - JausUnsignedInteger tempUInt; - JausShort tempShort; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Use Presence Vector - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_X_BIT)) - { - // Scaled Int (-100000, 100000) - tempInt = jausIntegerFromDouble(message->xM, -100000, 100000); - - //pack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_Y_BIT)) - { - // Scaled Int (-100000, 100000) - tempInt = jausIntegerFromDouble(message->yM, -100000, 100000); - - //pack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_Z_BIT)) - { - // Scaled Int (-10000, 35000) - tempInt = jausIntegerFromDouble(message->zM, -10000, 35000); - - //unpack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_POSITION_RMS_BIT)) - { - // Scaled Int (0, 100) - tempUInt = jausUnsignedIntegerFromDouble(message->positionRmsMeters, 0, 100); - - //unpack - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_ROLL_BIT)) - { - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->rollRadians, -JAUS_PI, JAUS_PI); - - // unpack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_PITCH_BIT)) - { - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->pitchRadians, -JAUS_PI, JAUS_PI); - - // unpack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_YAW_BIT)) - { - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->yawRadians, -JAUS_PI, JAUS_PI); - - // unpack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_ATTITUDE_RMS_BIT)) - { - // Scaled Unsigned Short (0, JAUS_PI) - tempUShort = jausUnsignedShortFromDouble(message->attitudeRmsRadians, 0, JAUS_PI); - - // unpack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_TIME_STAMP_BIT)) - { - //unpack - if(!jausTimeStampToBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportLocalPoseMessage message) -{ - int index = 0; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_X_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_Y_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_Z_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_POSITION_RMS_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_ROLL_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_PITCH_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_YAW_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_ATTITUDE_RMS_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_LOCAL_POSE_PV_TIME_STAMP_BIT)) - { - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportLocalPoseMessage reportLocalPoseMessageCreate(void) -{ - ReportLocalPoseMessage message; - - message = (ReportLocalPoseMessage)malloc( sizeof(ReportLocalPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportLocalPoseMessageDestroy(ReportLocalPoseMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportLocalPoseMessageFromBuffer(ReportLocalPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportLocalPoseMessageToBuffer(ReportLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportLocalPoseMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportLocalPoseBuffer failed - } - } -} - -ReportLocalPoseMessage reportLocalPoseMessageFromJausMessage(JausMessage jausMessage) -{ - ReportLocalPoseMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportLocalPoseMessage)malloc( sizeof(ReportLocalPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportLocalPoseMessageToJausMessage(ReportLocalPoseMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportLocalPoseMessageSize(ReportLocalPoseMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportLocalVectorMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportLocalVectorMessage.c deleted file mode 100644 index e2e97484abb30cd85408c407f65fdedb8a992d74..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportLocalVectorMessage.c +++ /dev/null @@ -1,380 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportLocalVectorMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportLocalVectorMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_LOCAL_VECTOR; -static const int maxDataSizeBytes = 6; - -static JausBoolean headerFromBuffer(ReportLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportLocalVectorMessage message); -static unsigned int dataSize(ReportLocalVectorMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportLocalVectorMessage message) -{ - // Report initial values of message fields - message->speedMps = newJausDouble(0); // Scaled Unsigned Int (0, 10000) Mps = Meters Per Second - message->headingRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - // unpack - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - // Scaled Unsigned Short (0, 10000) - message->speedMps = jausIntegerToDouble(tempInteger, 0, 10000); - - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - // Scaled Short (-JAUS_PI, JAUS_PI) - message->headingRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - // Scaled Unsigned Short (0, 10000) - tempInteger = jausIntegerFromDouble(message->speedMps, 0, 10000); - // pack - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->headingRadians, -JAUS_PI, JAUS_PI); - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - } - - return index; -} - -static unsigned int dataSize(ReportLocalVectorMessage message) -{ - int index = 0; - - index += JAUS_INTEGER_SIZE_BYTES; - index += JAUS_SHORT_SIZE_BYTES; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportLocalVectorMessage reportLocalVectorMessageCreate(void) -{ - ReportLocalVectorMessage message; - - message = (ReportLocalVectorMessage)malloc( sizeof(ReportLocalVectorMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportLocalVectorMessageDestroy(ReportLocalVectorMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportLocalVectorMessageFromBuffer(ReportLocalVectorMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportLocalVectorMessageToBuffer(ReportLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportLocalVectorMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportLocalVectorBuffer failed - } - } -} - -ReportLocalVectorMessage reportLocalVectorMessageFromJausMessage(JausMessage jausMessage) -{ - ReportLocalVectorMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportLocalVectorMessage)malloc( sizeof(ReportLocalVectorMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportLocalVectorMessageToJausMessage(ReportLocalVectorMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportLocalVectorMessageSize(ReportLocalVectorMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportLocalWaypointMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportLocalWaypointMessage.c deleted file mode 100644 index 54182157ba47f713edeca2a2d196982e7547f3a2..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportLocalWaypointMessage.c +++ /dev/null @@ -1,496 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportLocalWaypointMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportLocalWaypointMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_LOCAL_WAYPOINT; -static const int maxDataSizeBytes = 21; - -static JausBoolean headerFromBuffer(ReportLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportLocalWaypointMessage message); -static unsigned int dataSize(ReportLocalWaypointMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportLocalWaypointMessage message) -{ - // Report initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->waypointNumber = newJausUnsignedShort(0); - message->xM = newJausDouble(0); // Scaled Integer (-100000, 100000) - message->yM = newJausDouble(0); // Scaled Integer (-100000, 100000) - message->zM = newJausDouble(0); // Scaled Integer (-10000, 35000) - message->rollRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->pitchRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - message->yawRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Use Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->waypointNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //unpack - //JausDouble xM // Scaled Integer (-100000, 100000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->xM = jausIntegerToDouble(tempInteger, -100000, 100000); - - //unpack - //JausDouble yM // Scaled Integer (-100000, 100000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - message->yM = jausIntegerToDouble(tempInteger, -100000, 100000); - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_Z_BIT)) - { - //unpack - //JausDouble zM // Scaled Integer (-10000, 35000) - if(!jausIntegerFromBuffer(&tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - message->zM = jausIntegerToDouble(tempInteger, -10000, 35000); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_ROLL_BIT)) - { - //unpack - //JausDouble rollRadians // Scaled Short (-JAUS_PI, JAUS_PI) - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - message->rollRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_PITCH_BIT)) - { - //unpack - //JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - message->pitchRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_YAW_BIT)) - { - //unpack - //JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - message->yawRadians = jausShortToDouble(tempShort, -JAUS_PI, JAUS_PI); - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInteger; - JausShort tempShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Use Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->waypointNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - //pack - //JausDouble xM // Scaled Integer (-100000, 100000) - tempInteger = jausIntegerFromDouble(message->xM, -100000, 100000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - //pack - //JausDouble yM // Scaled Integer (-100000, 100000) - tempInteger = jausIntegerFromDouble(message->yM, -100000, 100000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_Z_BIT)) - { - //pack - //JausDouble zM // Scaled Integer (-10000, 35000) - tempInteger = jausIntegerFromDouble(message->zM, -10000, 35000); - if(!jausIntegerToBuffer(tempInteger, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_ROLL_BIT)) - { - //pack - //JausDouble rollRadians // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->rollRadians, -JAUS_PI, JAUS_PI); - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_PITCH_BIT)) - { - //pack - //JausDouble pitchRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->pitchRadians, -JAUS_PI, JAUS_PI); - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_YAW_BIT)) - { - //pack - //JausDouble yawRadians; // Scaled Short (-JAUS_PI, JAUS_PI) - tempShort = jausShortFromDouble(message->yawRadians, -JAUS_PI, JAUS_PI); - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - } - return index; -} - -static unsigned int dataSize(ReportLocalWaypointMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - index += JAUS_INTEGER_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_Z_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_ROLL_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_PITCH_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_LOCAL_WAYPOINT_PV_YAW_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportLocalWaypointMessage reportLocalWaypointMessageCreate(void) -{ - ReportLocalWaypointMessage message; - - message = (ReportLocalWaypointMessage)malloc( sizeof(ReportLocalWaypointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportLocalWaypointMessageDestroy(ReportLocalWaypointMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportLocalWaypointMessageFromBuffer(ReportLocalWaypointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportLocalWaypointMessageToBuffer(ReportLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportLocalWaypointMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportLocalWaypointBuffer failed - } - } -} - -ReportLocalWaypointMessage reportLocalWaypointMessageFromJausMessage(JausMessage jausMessage) -{ - ReportLocalWaypointMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportLocalWaypointMessage)malloc( sizeof(ReportLocalWaypointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportLocalWaypointMessageToJausMessage(ReportLocalWaypointMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportLocalWaypointMessageSize(ReportLocalWaypointMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportPathSegmentCountMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportPathSegmentCountMessage.c deleted file mode 100644 index f4393223815a4f821974ced9b0e7e5c9962fb4b1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportPathSegmentCountMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportPathSegmentCountMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportPathSegmentCountMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_PATH_SEGMENT_COUNT; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(ReportPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportPathSegmentCountMessage message); -static unsigned int dataSize(ReportPathSegmentCountMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportPathSegmentCountMessage message) -{ - // Set initial values of message fields - message->pathSegmentCount = newJausUnsignedShort(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->pathSegmentCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->pathSegmentCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(ReportPathSegmentCountMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportPathSegmentCountMessage reportPathSegmentCountMessageCreate(void) -{ - ReportPathSegmentCountMessage message; - - message = (ReportPathSegmentCountMessage)malloc( sizeof(ReportPathSegmentCountMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void reportPathSegmentCountMessageDestroy(ReportPathSegmentCountMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportPathSegmentCountMessageFromBuffer(ReportPathSegmentCountMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportPathSegmentCountMessageToBuffer(ReportPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportPathSegmentCountMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportPathSegmentCountBuffer failed - } - } -} - -ReportPathSegmentCountMessage reportPathSegmentCountMessageFromJausMessage(JausMessage jausMessage) -{ - ReportPathSegmentCountMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportPathSegmentCountMessage)malloc( sizeof(ReportPathSegmentCountMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportPathSegmentCountMessageToJausMessage(ReportPathSegmentCountMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportPathSegmentCountMessageSize(ReportPathSegmentCountMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportPlatformOperationalDataMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportPlatformOperationalDataMessage.c deleted file mode 100644 index 14edd01a4d641d4ae329271ff3ce45557a05fc78..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportPlatformOperationalDataMessage.c +++ /dev/null @@ -1,481 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportPlatformOperationalDataMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportPlatformOperationalDataMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_PLATFORM_OPERATIONAL_DATA; -static const int maxDataSizeBytes = 10; - -static JausBoolean headerFromBuffer(ReportPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportPlatformOperationalDataMessage message); -static unsigned int dataSize(ReportPlatformOperationalDataMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportPlatformOperationalDataMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->engineTemperatureCelsius = newJausDouble(0); // Scaled Short (-75, 180) - message->odometerMeters = newJausUnsignedInteger(0); - message->batteryVoltagePercent = newJausDouble(0); // Scaled Byte (0, 127) - message->fuelLevelPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->oilPressurePercent = newJausDouble(0); // Scaled Byte (0, 127) -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausShort tempShort; - JausByte tempByte; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Use Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_ENGINE_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-75, 180) - message->engineTemperatureCelsius = jausShortToDouble(tempShort, -75, 180); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_ODOMETER_BIT)) - { - // unpack - if(!jausUnsignedIntegerFromBuffer(&message->odometerMeters, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_BATTERY_BIT)) - { - // unpack - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 127) - message->batteryVoltagePercent = jausByteToDouble(tempByte, 0, 127); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_FUEL_BIT)) - { - // unpack - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->fuelLevelPercent = jausByteToDouble(tempByte, 0, 100); - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_OIL_BIT)) - { - // unpack - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 127) - message->oilPressurePercent = jausByteToDouble(tempByte, 0, 127); - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausShort tempShort; - JausByte tempByte; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Use Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_ENGINE_BIT)) - { - // pack - // Scaled Short (-75, 180) - tempShort = jausShortFromDouble(message->engineTemperatureCelsius, -75, 180); - - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_ODOMETER_BIT)) - { - if(!jausUnsignedIntegerToBuffer(message->odometerMeters, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_BATTERY_BIT)) - { - // pack - // Scaled Byte (0, 127) - tempByte = jausByteFromDouble(message->batteryVoltagePercent, 0, 127); - - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_FUEL_BIT)) - { - // pack - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->fuelLevelPercent, 0, 100); - - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_OIL_BIT)) - { - // pack - // Scaled Byte (0, 127) - tempByte = jausByteFromDouble(message->oilPressurePercent, 0, 127); - - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportPlatformOperationalDataMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_ENGINE_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_ODOMETER_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_BATTERY_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_FUEL_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, JAUS_OPERATIONAL_PV_OIL_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportPlatformOperationalDataMessage reportPlatformOperationalDataMessageCreate(void) -{ - ReportPlatformOperationalDataMessage message; - - message = (ReportPlatformOperationalDataMessage)malloc( sizeof(ReportPlatformOperationalDataMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - return message; -} - -void reportPlatformOperationalDataMessageDestroy(ReportPlatformOperationalDataMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportPlatformOperationalDataMessageFromBuffer(ReportPlatformOperationalDataMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportPlatformOperationalDataMessageToBuffer(ReportPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportPlatformOperationalDataMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportPlatformOperationalDataBuffer failed - } - } -} - -ReportPlatformOperationalDataMessage reportPlatformOperationalDataMessageFromJausMessage(JausMessage jausMessage) -{ - ReportPlatformOperationalDataMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportPlatformOperationalDataMessage)malloc( sizeof(ReportPlatformOperationalDataMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportPlatformOperationalDataMessageToJausMessage(ReportPlatformOperationalDataMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportPlatformOperationalDataMessageSize(ReportPlatformOperationalDataMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportPlatformSpecificationsMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportPlatformSpecificationsMessage.c deleted file mode 100644 index b99a4343deeab8d586f9c6a331df967d7c5d7efd..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportPlatformSpecificationsMessage.c +++ /dev/null @@ -1,904 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportPlatformSpecificationsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportPlatformSpecificationsMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_PLATFORM_SPECIFICATIONS; -static const int maxDataSizeBytes = 59; - -static JausBoolean headerFromBuffer(ReportPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportPlatformSpecificationsMessage message); -static unsigned int dataSize(ReportPlatformSpecificationsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportPlatformSpecificationsMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedInteger(JAUS_INTEGER_PRESENCE_VECTOR_ALL_ON); - message->platformName[0] = 0; - message-> frontMeters= newJausDouble(0); // Scaled Unsigned Short (0, 32.767) - message-> backMeters= newJausDouble(0); // Scaled Unsigned Short (0, 32.767) - message-> rightMeters= newJausDouble(0); // Scaled Unsigned Short (0, 32.767) - message-> leftMeters= newJausDouble(0); // Scaled Unsigned Short (0, 32.767) - message-> bottomMeters= newJausDouble(0); // Scaled Unsigned Short (0, 32.767) - message-> topMeters= newJausDouble(0); // Scaled Unsigned Short (0, 32.767) - message-> xCgMeters= newJausDouble(0); // Scaled Unsigned Short (0, 32.767) - message-> yCgMeters= newJausDouble(0); // Scaled Unsigned Short (0, 32.767) - message-> zCgMeters= newJausDouble(0); // Scaled Unsigned Short (0, 32.767) - message-> turningRadiusMeters= newJausDouble(0); // Scaled Unsigned Short (0, 65.535) - message-> wheelBaseMeters= newJausDouble(0); // Scaled Unsigned Short (0, 65.535) - message-> trackWidthMeters= newJausDouble(0); // Scaled Unsigned Short (0, 65.535) - message-> pitchOverRadians= newJausDouble(0); // Scaled Unsigned Short (0, 2.56) - message-> rollOverRadians= newJausDouble(0); // Scaled Unsigned Short (0, 2.56) - message-> maximumVelocityXMps= newJausDouble(0); // Scaled Unsigned Short (0, 65.535) Mps = Meters per Second - message-> maximumVelocityYMps= newJausDouble(0); // Scaled Unsigned Short (0, 65.535) Mps = Meters per Second - message-> maximumVelocityZMps= newJausDouble(0); // Scaled Unsigned Short (0, 65.535) Mps = Meters per Second - message-> maximumRollRateRps= newJausDouble(0); // Scaled Unsigned Short (0, 32.767) Rps = Radians per Second - message-> maximumPitchRateRps= newJausDouble(0); // Scaled Unsigned Short (0, 32.767) Rps = Radians per Second - message-> maximumYawRateRps= newJausDouble(0); // Scaled Unsigned Short (0, 32.767) Rps = Radians per Second -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Unpack Using Presence Vector - if(!jausUnsignedIntegerFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_PLATFORM_NAME_BIT)) - { - // unpack string of length JAUS_PLATFORM_NAME_LENGTH_BYTES - if(bufferSizeBytes-index < JAUS_PLATFORM_NAME_LENGTH_BYTES) return JAUS_FALSE; - - memcpy(message->platformName, buffer+index, JAUS_PLATFORM_NAME_LENGTH_BYTES); - index += JAUS_PLATFORM_NAME_LENGTH_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_FRONT_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 32.767) - message->frontMeters = jausUnsignedShortToDouble(tempUShort, 0, 32.767); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_BACK_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 32.767) - message->backMeters = jausUnsignedShortToDouble(tempUShort, 0, 32.767); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_RIGHT_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 32.767) - message->rightMeters = jausUnsignedShortToDouble(tempUShort, 0, 32.767); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_LEFT_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 32.767) - message->leftMeters = jausUnsignedShortToDouble(tempUShort, 0, 32.767); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_BOTTOM_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 32.767) - message->bottomMeters = jausUnsignedShortToDouble(tempUShort, 0, 32.767); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_TOP_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 32.767) - message->topMeters = jausUnsignedShortToDouble(tempUShort, 0, 32.767); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_X_CG_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 32.767) - message->xCgMeters = jausUnsignedShortToDouble(tempUShort, 0, 32.767); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_Y_CG_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 32.767) - message->yCgMeters = jausUnsignedShortToDouble(tempUShort, 0, 32.767); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_Z_CG_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 32.767) - message->zCgMeters = jausUnsignedShortToDouble(tempUShort, 0, 32.767); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_TURNING_RADIUS_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 65.535) - message->turningRadiusMeters = jausUnsignedShortToDouble(tempUShort, 0, 65.535); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_WHEEL_BASE_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 65.535) - message->wheelBaseMeters = jausUnsignedShortToDouble(tempUShort, 0, 65.535); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_TRACK_WIDTH_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 65.535) - message->trackWidthMeters = jausUnsignedShortToDouble(tempUShort, 0, 65.535); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_PITCH_OVER_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 2.56) - message->pitchOverRadians = jausUnsignedShortToDouble(tempUShort, 0, 2.56); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_ROLL_OVER_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 2.56) - message->rollOverRadians = jausUnsignedShortToDouble(tempUShort, 0, 2.56); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_VELOCITY_X_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 65.535) - message->maximumVelocityXMps = jausUnsignedShortToDouble(tempUShort, 0, 65.535); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_VELOCITY_Y_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 65.535) - message->maximumVelocityYMps = jausUnsignedShortToDouble(tempUShort, 0, 65.535); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_VELOCITY_Z_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 65.535) - message->maximumVelocityZMps = jausUnsignedShortToDouble(tempUShort, 0, 65.535); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_ROLL_RATE_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 32.767) - message->maximumRollRateRps = jausUnsignedShortToDouble(tempUShort, 0, 32.767); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_PITCH_RATE_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 32.767) - message->maximumPitchRateRps = jausUnsignedShortToDouble(tempUShort, 0, 32.767); - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_YAW_RATE_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 32.767) - message->maximumYawRateRps = jausUnsignedShortToDouble(tempUShort, 0, 32.767); - } - - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Pack using Presence Vector - if(!jausUnsignedIntegerToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_PLATFORM_NAME_BIT)) - { - // pack string of length JAUS_PLATFORM_NAME_LENGTH_BYTES - if(bufferSizeBytes-index < JAUS_PLATFORM_NAME_LENGTH_BYTES) return JAUS_FALSE; - - memcpy(buffer+index, message->platformName, JAUS_PLATFORM_NAME_LENGTH_BYTES); - index += JAUS_PLATFORM_NAME_LENGTH_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_FRONT_BIT)) - { - // Scaled Unsigned Short (0, 32.767) - tempUShort = jausUnsignedShortFromDouble(message->frontMeters, 0, 32.767); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_BACK_BIT)) - { - // Scaled Unsigned Short (0, 32.767) - tempUShort = jausUnsignedShortFromDouble(message->backMeters, 0, 32.767); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_RIGHT_BIT)) - { - // Scaled Unsigned Short (0, 32.767) - tempUShort = jausUnsignedShortFromDouble(message->rightMeters, 0, 32.767); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_LEFT_BIT)) - { - // Scaled Unsigned Short (0, 32.767) - tempUShort = jausUnsignedShortFromDouble(message->leftMeters, 0, 32.767); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_BOTTOM_BIT)) - { - // Scaled Unsigned Short (0, 32.767) - tempUShort = jausUnsignedShortFromDouble(message->bottomMeters, 0, 32.767); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_TOP_BIT)) - { - // Scaled Unsigned Short (0, 32.767) - tempUShort = jausUnsignedShortFromDouble(message->topMeters, 0, 32.767); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_X_CG_BIT)) - { - // Scaled Unsigned Short (0, 32.767) - tempUShort = jausUnsignedShortFromDouble(message->xCgMeters, 0, 32.767); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_Y_CG_BIT)) - { - // Scaled Unsigned Short (0, 32.767) - tempUShort = jausUnsignedShortFromDouble(message->yCgMeters, 0, 32.767); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_Z_CG_BIT)) - { - // Scaled Unsigned Short (0, 32.767) - tempUShort = jausUnsignedShortFromDouble(message->zCgMeters, 0, 32.767); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_TURNING_RADIUS_BIT)) - { - // Scaled Unsigned Short (0, 65.535) - tempUShort = jausUnsignedShortFromDouble(message->turningRadiusMeters, 0, 65.535); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_WHEEL_BASE_BIT)) - { - // Scaled Unsigned Short (0, 65.535) - tempUShort = jausUnsignedShortFromDouble(message->wheelBaseMeters, 0, 65.535); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_TRACK_WIDTH_BIT)) - { - // Scaled Unsigned Short (0, 65.535) - tempUShort = jausUnsignedShortFromDouble(message->trackWidthMeters, 0, 65.535); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_PITCH_OVER_BIT)) - { - // Scaled Unsigned Short (0, 2.56) - tempUShort = jausUnsignedShortFromDouble(message->pitchOverRadians, 0, 2.56); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_ROLL_OVER_BIT)) - { - // Scaled Unsigned Short (0, 2.56) - tempUShort = jausUnsignedShortFromDouble(message->rollOverRadians, 0, 2.56); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_VELOCITY_X_BIT)) - { - // Scaled Unsigned Short (0, 65.535) - tempUShort = jausUnsignedShortFromDouble(message->maximumVelocityXMps, 0, 65.535); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_VELOCITY_Y_BIT)) - { - // Scaled Unsigned Short (0, 65.535) - tempUShort = jausUnsignedShortFromDouble(message->maximumVelocityYMps, 0, 65.535); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_VELOCITY_Z_BIT)) - { - // Scaled Unsigned Short (0, 65.535) - tempUShort = jausUnsignedShortFromDouble(message->maximumVelocityZMps, 0, 65.535); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_ROLL_RATE_BIT)) - { - // Scaled Unsigned Short (0, 32.767) - tempUShort = jausUnsignedShortFromDouble(message->maximumRollRateRps, 0, 32.767); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_PITCH_RATE_BIT)) - { - // Scaled Unsigned Short (0, 32.767) - tempUShort = jausUnsignedShortFromDouble(message->maximumPitchRateRps, 0, 32.767); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_YAW_RATE_BIT)) - { - // Scaled Unsigned Short (0, 32.767) - tempUShort = jausUnsignedShortFromDouble(message->maximumYawRateRps, 0, 32.767); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportPlatformSpecificationsMessage message) -{ - int index = 0; - - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_PLATFORM_NAME_BIT)) - { - index += JAUS_PLATFORM_NAME_LENGTH_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_FRONT_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_BACK_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_RIGHT_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_LEFT_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_BOTTOM_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_TOP_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_X_CG_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_Y_CG_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_Z_CG_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_TURNING_RADIUS_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_WHEEL_BASE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_TRACK_WIDTH_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_PITCH_OVER_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_ROLL_OVER_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_VELOCITY_X_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_VELOCITY_Y_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_VELOCITY_Z_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_ROLL_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_PITCH_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedIntegerIsBitSet(message->presenceVector, JAUS_DISCRETE_PV_MAX_YAW_RATE_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportPlatformSpecificationsMessage reportPlatformSpecificationsMessageCreate(void) -{ - ReportPlatformSpecificationsMessage message; - - message = (ReportPlatformSpecificationsMessage)malloc( sizeof(ReportPlatformSpecificationsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportPlatformSpecificationsMessageDestroy(ReportPlatformSpecificationsMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportPlatformSpecificationsMessageFromBuffer(ReportPlatformSpecificationsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportPlatformSpecificationsMessageToBuffer(ReportPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportPlatformSpecificationsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportPlatformSpecificationsBuffer failed - } - } -} - -ReportPlatformSpecificationsMessage reportPlatformSpecificationsMessageFromJausMessage(JausMessage jausMessage) -{ - ReportPlatformSpecificationsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportPlatformSpecificationsMessage)malloc( sizeof(ReportPlatformSpecificationsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportPlatformSpecificationsMessageToJausMessage(ReportPlatformSpecificationsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportPlatformSpecificationsMessageSize(ReportPlatformSpecificationsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportTravelSpeedMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportTravelSpeedMessage.c deleted file mode 100644 index f9ccc6c5893b74b345e03f35e70efb19ba1f2280..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportTravelSpeedMessage.c +++ /dev/null @@ -1,359 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportTravelSpeedMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportTravelSpeedMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_TRAVEL_SPEED; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(ReportTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportTravelSpeedMessage message); -static unsigned int dataSize(ReportTravelSpeedMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportTravelSpeedMessage message) -{ - // Set initial values of message fields - message->speedMps = newJausDouble(0); //Scaled Unsigned Short (0, 10000) Mps = Meters Per Second -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, 10000) - message->speedMps = jausUnsignedShortToDouble(tempUShort, 0, 10000); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort tempUShort; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - // Scaled Unsigned Short (0, 10000) - tempUShort = jausUnsignedShortFromDouble(message->speedMps, 0, 10000); - - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(ReportTravelSpeedMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportTravelSpeedMessage reportTravelSpeedMessageCreate(void) -{ - ReportTravelSpeedMessage message; - - message = (ReportTravelSpeedMessage)malloc( sizeof(ReportTravelSpeedMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void reportTravelSpeedMessageDestroy(ReportTravelSpeedMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportTravelSpeedMessageFromBuffer(ReportTravelSpeedMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportTravelSpeedMessageToBuffer(ReportTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportTravelSpeedMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportTravelSpeedBuffer failed - } - } -} - -ReportTravelSpeedMessage reportTravelSpeedMessageFromJausMessage(JausMessage jausMessage) -{ - ReportTravelSpeedMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportTravelSpeedMessage)malloc( sizeof(ReportTravelSpeedMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportTravelSpeedMessageToJausMessage(ReportTravelSpeedMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportTravelSpeedMessageSize(ReportTravelSpeedMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportVelocityStateMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportVelocityStateMessage.c deleted file mode 100644 index 227e884548ca97a50c7cdb21994d580fc6e4ef2d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportVelocityStateMessage.c +++ /dev/null @@ -1,609 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportVelocityStateMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportVelocityStateMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_VELOCITY_STATE; -static const int maxDataSizeBytes = 30; - -static JausBoolean headerFromBuffer(ReportVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportVelocityStateMessage message); -static void dataDestroy(ReportVelocityStateMessage message); -static unsigned int dataSize(ReportVelocityStateMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportVelocityStateMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); - message->velocityXMps = newJausDouble(0); // Scaled Int (-65.534, 65.534) Mps = Meters per Second - message->velocityYMps = newJausDouble(0); // Scaled Int (-65.534, 65.534) Mps = Meters per Second - message->velocityZMps = newJausDouble(0); // Scaled Int (-65.534, 65.534) Mps = Meters per Secon - message->velocityRmsMps = newJausDouble(0); // Scaled UInt (0, 100) Mps = Meters per Second - message->rollRateRps = newJausDouble(0); // Scaled Short (-32.767, 32.767) Rps = Radians per Second - message->pitchRateRps = newJausDouble(0); // Scaled Short (-32.767, 32.767) Rps = Radians per Second - message->yawRateRps = newJausDouble(0); // Scaled Short (-32.767, 32.767) Rps = Radians per Second - message->rateRmsRps = newJausDouble(0); // Scaled UShort (0, JAUS_PI) Rps = Radians per Second - message->time = jausTimeCreate(); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportVelocityStateMessage message) -{ - // Free message fields - if(message->time) jausTimeDestroy(message->time); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInt; - JausShort tempShort; - JausUnsignedShort tempUShort; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Use Presence Vector - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_X_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-65.534, 65.534) - message->velocityXMps = jausIntegerToDouble(tempInt, -65.534, 65.534); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_Y_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-65.534, 65.534) - message->velocityYMps = jausIntegerToDouble(tempInt, -65.534, 65.534); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_Z_BIT)) - { - //unpack - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-65.534, 65.534) - message->velocityZMps = jausIntegerToDouble(tempInt, -65.534, 65.534); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_RMS_BIT)) - { - //unpack - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Scaled UInt (0, 100) - message->velocityRmsMps = jausUnsignedIntegerToDouble(tempUInt, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_ROLL_RATE_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (-32.767, 32.767) - message->rollRateRps = jausShortToDouble(tempShort, -32.767, 32.767); - - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_PITCH_RATE_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (-32.767, 32.767) - message->pitchRateRps = jausShortToDouble(tempShort, -32.767, 32.767); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_YAW_RATE_BIT)) - { - // unpack - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (-32.767, 32.767) - message->yawRateRps = jausShortToDouble(tempShort, -32.767, 32.767); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_RATE_RMS_BIT)) - { - // unpack - if(!jausUnsignedShortFromBuffer(&tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Unsigned Short (0, JAUS_PI) - message->rateRmsRps = jausUnsignedShortToDouble(tempUShort, 0, JAUS_PI); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_TIME_STAMP_BIT)) - { - message->time = jausTimeCreate(); - if(!message->time) return JAUS_FALSE; - - //unpack - if(!jausTimeStampFromBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - else - { - message->time = NULL; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInt; - JausShort tempShort; - JausUnsignedShort tempUShort; - JausUnsignedInteger tempUInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Use Presence Vector - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_X_BIT)) - { - // Scaled Int (-65.534, 65.534) - tempInt = jausIntegerFromDouble(message->velocityXMps, -65.534, 65.534); - - //pack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_Y_BIT)) - { - // Scaled Int (-65.534, 65.534) - tempInt = jausIntegerFromDouble(message->velocityYMps, -65.534, 65.534); - - //pack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_Z_BIT)) - { - // Scaled Int (-65.534, 65.534) - tempInt = jausIntegerFromDouble(message->velocityZMps, -65.534, 65.534); - - //pack - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_RMS_BIT)) - { - // Scaled UInt (0, 100) - tempUInt = jausUnsignedIntegerFromDouble(message->velocityRmsMps, 0, 100); - - //pack - if(!jausUnsignedIntegerToBuffer(tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_ROLL_RATE_BIT)) - { - // Scaled Short (-32.767, 32.767) - tempShort = jausShortFromDouble(message->rollRateRps, -32.767, 32.767); - - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_PITCH_RATE_BIT)) - { - // Scaled Short (-32.767, 32.767) - tempShort = jausShortFromDouble(message->pitchRateRps, -32.767, 32.767); - - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_YAW_RATE_BIT)) - { - // Scaled Unsigned Short (-32.767, 32.767) - tempShort = jausShortFromDouble(message->yawRateRps, -32.767, 32.767); - - // pack - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_RATE_RMS_BIT)) - { - // Scaled Unsigned Short (0, JAUS_PI) - tempUShort = jausUnsignedShortFromDouble(message->rateRmsRps, 0, JAUS_PI); - - // pack - if(!jausUnsignedShortToBuffer(tempUShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_TIME_STAMP_BIT)) - { - //pack - if(!jausTimeStampToBuffer(message->time, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportVelocityStateMessage message) -{ - int index = 0; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_X_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_Y_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_Z_BIT)) - { - index += JAUS_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_VELOCITY_RMS_BIT)) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_ROLL_RATE_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_PITCH_RATE_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_YAW_RATE_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_RATE_RMS_BIT)) - { - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_VELOCITY_PV_TIME_STAMP_BIT)) - { - index += JAUS_TIME_STAMP_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportVelocityStateMessage reportVelocityStateMessageCreate(void) -{ - ReportVelocityStateMessage message; - - message = (ReportVelocityStateMessage)malloc( sizeof(ReportVelocityStateMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportVelocityStateMessageDestroy(ReportVelocityStateMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportVelocityStateMessageFromBuffer(ReportVelocityStateMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportVelocityStateMessageToBuffer(ReportVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportVelocityStateMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportVelocityStateBuffer failed - } - } -} - -ReportVelocityStateMessage reportVelocityStateMessageFromJausMessage(JausMessage jausMessage) -{ - ReportVelocityStateMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportVelocityStateMessage)malloc( sizeof(ReportVelocityStateMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportVelocityStateMessageToJausMessage(ReportVelocityStateMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportVelocityStateMessageSize(ReportVelocityStateMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportWaypointCountMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportWaypointCountMessage.c deleted file mode 100644 index 53aaa5bd1ce28a22a4a48d33f50d436eab32d888..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportWaypointCountMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportWaypointCountMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportWaypointCountMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_WAYPOINT_COUNT; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(ReportWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportWaypointCountMessage message); -static unsigned int dataSize(ReportWaypointCountMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportWaypointCountMessage message) -{ - // Set initial values of message fields - message->waypointCount = newJausUnsignedShort(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->waypointCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->waypointCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(ReportWaypointCountMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportWaypointCountMessage reportWaypointCountMessageCreate(void) -{ - ReportWaypointCountMessage message; - - message = (ReportWaypointCountMessage)malloc( sizeof(ReportWaypointCountMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void reportWaypointCountMessageDestroy(ReportWaypointCountMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportWaypointCountMessageFromBuffer(ReportWaypointCountMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportWaypointCountMessageToBuffer(ReportWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportWaypointCountMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportWaypointCountBuffer failed - } - } -} - -ReportWaypointCountMessage reportWaypointCountMessageFromJausMessage(JausMessage jausMessage) -{ - ReportWaypointCountMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportWaypointCountMessage)malloc( sizeof(ReportWaypointCountMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportWaypointCountMessageToJausMessage(ReportWaypointCountMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportWaypointCountMessageSize(ReportWaypointCountMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/platform/reportWrenchEffortMessage.c b/lib/openjaus/libjaus/src/message/inform/platform/reportWrenchEffortMessage.c deleted file mode 100644 index 60d48027b368f708056f0d8f8d061b68fb99ef10..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/platform/reportWrenchEffortMessage.c +++ /dev/null @@ -1,675 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportWrenchEffortMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportWrenchEffortMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_WRENCH_EFFORT; -static const int maxDataSizeBytes = 20; - -static JausBoolean headerFromBuffer(ReportWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportWrenchEffortMessage message); -static unsigned int dataSize(ReportWrenchEffortMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportWrenchEffortMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); - - message->propulsiveLinearEffortXPercent = newJausDouble(0); // Scaled Short (-100, 100) - message->propulsiveLinearEffortYPercent = newJausDouble(0); // Scaled Short (-100, 100) - message->propulsiveLinearEffortZPercent = newJausDouble(0); // Scaled Short (-100, 100) - message->propulsiveRotationalEffortXPercent = newJausDouble(0); // Scaled Short (-100, 100) - message->propulsiveRotationalEffortZPercent = newJausDouble(0); // Scaled Short (-100, 100) - message->propulsiveRotationalEffortYPercent = newJausDouble(0); // Scaled Short (-100, 100) - - message->resistiveLinearEffortXPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->resistiveLinearEffortYPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->resistiveLinearEffortZPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->resistiveRotationalEffortXPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->resistiveRotationalEffortZPercent = newJausDouble(0); // Scaled Byte (0, 100) - message->resistiveRotationalEffortYPercent = newJausDouble(0); // Scaled Byte (0, 100) -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausShort tempShort; - JausByte tempByte; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Unpack according to presence vector - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_X_BIT)) - { - // unpack propulsive linear effort X - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->propulsiveLinearEffortXPercent = jausShortToDouble(tempShort, -100, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Y_BIT)) - { - // unpack propulsive linear effort Y - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->propulsiveLinearEffortYPercent = jausShortToDouble(tempShort, -100, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Z_BIT)) - { - // unpack propulsive linear effort Z - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->propulsiveLinearEffortZPercent = jausShortToDouble(tempShort, -100, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_X_BIT)) - { - // unpack propulsive rotational effort X - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->propulsiveRotationalEffortXPercent = jausShortToDouble(tempShort, -100, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Y_BIT)) - { - // unpack propulsive rotational effort Y - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->propulsiveRotationalEffortYPercent = jausShortToDouble(tempShort, -100, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Z_BIT)) - { - // unpack propulsive rotational effort Z - if(!jausShortFromBuffer(&tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - - // Scaled Short (-100, 100) - message->propulsiveRotationalEffortZPercent = jausShortToDouble(tempShort, -100, 100); - } - - // Resistive - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_X_BIT)) - { - // unpack resistive linear effort X - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->resistiveLinearEffortXPercent = jausByteToDouble(tempByte, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_Y_BIT)) - { - // unpack resistive linear effort Y - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->resistiveLinearEffortYPercent = jausByteToDouble(tempByte, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_Z_BIT)) - { - // unpack resistive linear effort Z - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->resistiveLinearEffortZPercent = jausByteToDouble(tempByte, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_X_BIT)) - { - // unpack resistive rotational effort X - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->resistiveRotationalEffortXPercent = jausByteToDouble(tempByte, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Y_BIT)) - { - // unpack resistive rotational effort Y - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->resistiveRotationalEffortYPercent = jausByteToDouble(tempByte, 0, 100); - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Z_BIT)) - { - // unpack resistive rotational effort Z - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Scaled Byte (0, 100) - message->resistiveRotationalEffortZPercent = jausByteToDouble(tempByte, 0, 100); - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausShort tempShort; - JausByte tempByte; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Pack according to Presence Vector - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_X_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->propulsiveLinearEffortXPercent, -100, 100); - - // pack propulsive linear effort X - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Y_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->propulsiveLinearEffortYPercent, -100, 100); - - // pack propulsive linear effort Y - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Z_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->propulsiveLinearEffortZPercent, -100, 100); - - // pack propulsive linear effort Z - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_X_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->propulsiveRotationalEffortXPercent, -100, 100); - - // pack propulsive rotational effort X - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Y_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->propulsiveRotationalEffortYPercent, -100, 100); - - // pack propulsive rotational effort Y - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Z_BIT)) - { - // Scaled Short (-100, 100) - tempShort = jausShortFromDouble(message->propulsiveRotationalEffortZPercent, -100, 100); - - // pack propulsive rotational effort Z - if(!jausShortToBuffer(tempShort, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_SHORT_SIZE_BYTES; - } - - // Resistive - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_X_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->resistiveLinearEffortXPercent, 0, 100); - - // pack resistive linear effort X - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_Y_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->resistiveLinearEffortYPercent, 0, 100); - - // pack resistive linear effort Y - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_Z_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->resistiveLinearEffortZPercent, 0, 100); - - // pack resistive linear effort Z - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_X_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->resistiveRotationalEffortXPercent, 0, 100); - - // pack resistive rotational effort X - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Y_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->resistiveRotationalEffortYPercent, 0, 100); - - // pack resistive rotational effort Y - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Z_BIT)) - { - // Scaled Byte (0, 100) - tempByte = jausByteFromDouble(message->resistiveRotationalEffortZPercent, 0, 100); - - // pack resistive rotational effort Z - if(!jausByteToBuffer(tempByte, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - } - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportWrenchEffortMessage message) -{ - int index = 0; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_X_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Y_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_Z_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_X_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Y_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Z_BIT)) - { - index += JAUS_SHORT_SIZE_BYTES; - } - - // Resistive - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_X_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_Y_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_Z_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_X_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Y_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_WRENCH_PV_RESISTIVE_ROTATIONAL_Z_BIT)) - { - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportWrenchEffortMessage reportWrenchEffortMessageCreate(void) -{ - ReportWrenchEffortMessage message; - - message = (ReportWrenchEffortMessage)malloc( sizeof(ReportWrenchEffortMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportWrenchEffortMessageDestroy(ReportWrenchEffortMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportWrenchEffortMessageFromBuffer(ReportWrenchEffortMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportWrenchEffortMessageToBuffer(ReportWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportWrenchEffortMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportWrenchEffortBuffer failed - } - } -} - -ReportWrenchEffortMessage reportWrenchEffortMessageFromJausMessage(JausMessage jausMessage) -{ - ReportWrenchEffortMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportWrenchEffortMessage)malloc( sizeof(ReportWrenchEffortMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportWrenchEffortMessageToJausMessage(ReportWrenchEffortMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportWrenchEffortMessageSize(ReportWrenchEffortMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksBoundsMessage.c b/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksBoundsMessage.c deleted file mode 100644 index 149a26ab7c97e294393645190244f641aebb3626..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksBoundsMessage.c +++ /dev/null @@ -1,428 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportVksBoundsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportVksBoundsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_VKS_BOUNDS; -static const int maxDataSizeBytes = 19; - -static JausBoolean headerFromBuffer(ReportVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportVksBoundsMessage message); -static void dataDestroy(ReportVksBoundsMessage message); -static unsigned int dataSize(ReportVksBoundsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportVksBoundsMessage message) -{ - // Set initial values of message fields - message->requestId = newJausByte(0); - message->featureClass = newJausUnsignedShort(0); - message->southWestLatitudeDegrees = newJausDouble(0.0); - message->southWestLongitudeDegrees = newJausDouble(0.0); - message->northEastLatitudeDegrees = newJausDouble(0.0); - message->northEastLongitudeDegrees = newJausDouble(0.0); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportVksBoundsMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInt; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Request Id - if(!jausByteFromBuffer(&message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Feature Class - if(!jausUnsignedShortFromBuffer(&message->featureClass, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // SW Latitude - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-90, 90) - message->southWestLatitudeDegrees = jausIntegerToDouble(tempInt, -90, 90); - - // SW Longitude - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-180, 180) - message->southWestLongitudeDegrees = jausIntegerToDouble(tempInt, -180, 180); - - // NE Latitude - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-90, 90) - message->northEastLatitudeDegrees = jausIntegerToDouble(tempInt, -90, 90); - - // NE Longitude - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-180, 180) - message->northEastLongitudeDegrees = jausIntegerToDouble(tempInt, -180, 180); - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausInteger tempInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Request Id - if(!jausByteToBuffer(message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Feature Class - if(!jausUnsignedShortToBuffer(message->featureClass, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Scaled Int (-90, 90) - tempInt = jausIntegerFromDouble(message->southWestLatitudeDegrees, -90, 90); - - // SW Latitude - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-180, 180) - tempInt = jausIntegerFromDouble(message->southWestLongitudeDegrees, -180, 180); - - // SW Longitude - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-90, 90) - tempInt = jausIntegerFromDouble(message->northEastLatitudeDegrees, -90, 90); - - // NE Latitude - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-180, 180) - tempInt = jausIntegerFromDouble(message->northEastLongitudeDegrees, -180, 180); - - // NE Longitude - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(ReportVksBoundsMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportVksBoundsMessage reportVksBoundsMessageCreate(void) -{ - ReportVksBoundsMessage message; - - message = (ReportVksBoundsMessage)malloc( sizeof(ReportVksBoundsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void reportVksBoundsMessageDestroy(ReportVksBoundsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportVksBoundsMessageFromBuffer(ReportVksBoundsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportVksBoundsMessageToBuffer(ReportVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportVksBoundsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportVksBoundsBuffer failed - } - } -} - -ReportVksBoundsMessage reportVksBoundsMessageFromJausMessage(JausMessage jausMessage) -{ - ReportVksBoundsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportVksBoundsMessage)malloc( sizeof(ReportVksBoundsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportVksBoundsMessageToJausMessage(ReportVksBoundsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportVksBoundsMessageSize(ReportVksBoundsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksDataTransferTerminationMessage.c b/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksDataTransferTerminationMessage.c deleted file mode 100644 index f3904183b54813260853251ee11a8eb0e070b85b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksDataTransferTerminationMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportVksDataTransferTerminationMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportVksDataTransferTerminationMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_VKS_DATA_TRANSFER_TERMINATION; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(ReportVksDataTransferTerminationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportVksDataTransferTerminationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportVksDataTransferTerminationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportVksDataTransferTerminationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportVksDataTransferTerminationMessage message); -static void dataDestroy(ReportVksDataTransferTerminationMessage message); -static unsigned int dataSize(ReportVksDataTransferTerminationMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportVksDataTransferTerminationMessage message) -{ - // Set initial values of message fields -} - -// Destructs the message-specific fields -static void dataDestroy(ReportVksDataTransferTerminationMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportVksDataTransferTerminationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportVksDataTransferTerminationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(ReportVksDataTransferTerminationMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportVksDataTransferTerminationMessage reportVksDataTransferTerminationMessageCreate(void) -{ - ReportVksDataTransferTerminationMessage message; - - message = (ReportVksDataTransferTerminationMessage)malloc( sizeof(ReportVksDataTransferTerminationMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void reportVksDataTransferTerminationMessageDestroy(ReportVksDataTransferTerminationMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportVksDataTransferTerminationMessageFromBuffer(ReportVksDataTransferTerminationMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportVksDataTransferTerminationMessageToBuffer(ReportVksDataTransferTerminationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportVksDataTransferTerminationMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportVksDataTransferTerminationBuffer failed - } - } -} - -ReportVksDataTransferTerminationMessage reportVksDataTransferTerminationMessageFromJausMessage(JausMessage jausMessage) -{ - ReportVksDataTransferTerminationMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportVksDataTransferTerminationMessage)malloc( sizeof(ReportVksDataTransferTerminationMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportVksDataTransferTerminationMessageToJausMessage(ReportVksDataTransferTerminationMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int reportVksDataTransferTerminationMessageSize(ReportVksDataTransferTerminationMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportVksDataTransferTerminationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportVksDataTransferTerminationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksFeatureClassMetadataMessage.c b/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksFeatureClassMetadataMessage.c deleted file mode 100644 index b7571bcad2f0a99626133ce3f429c89afd7ffa7f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksFeatureClassMetadataMessage.c +++ /dev/null @@ -1,387 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportVksFeatureClassMetadataMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportVksFeatureClassMetadataMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_VKS_FEATURE_CLASS_METADATA; -static const int maxDataSizeBytes = 65539; - -static JausBoolean headerFromBuffer(ReportVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportVksFeatureClassMetadataMessage message); -static void dataDestroy(ReportVksFeatureClassMetadataMessage message); -static unsigned int dataSize(ReportVksFeatureClassMetadataMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportVksFeatureClassMetadataMessage message) -{ - // Set initial values of message fields - message->fcClass = featureClassCreate(); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportVksFeatureClassMetadataMessage message) -{ - // Free message fields - if(message->fcClass) - { - featureClassDestroy(message->fcClass); - } -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort stringLength; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - message->fcClass = featureClassCreate(); - if(!message->fcClass) return JAUS_FALSE; - - if(!jausUnsignedShortFromBuffer(&message->fcClass->id, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&stringLength, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - memcpy(message->fcClass->metaData, buffer+index, stringLength); - index += stringLength; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - JausUnsignedShort stringLength; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->fcClass->id, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - stringLength = (JausUnsignedShort) strlen(message->fcClass->metaData); - if(!jausUnsignedShortToBuffer(stringLength, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if((bufferSizeBytes-index) < stringLength) return JAUS_FALSE; - memcpy(buffer+index, message->fcClass->metaData, stringLength); - index += stringLength; - } - - return index; -} - -static unsigned int dataSize(ReportVksFeatureClassMetadataMessage message) -{ - int index = 0; - JausUnsignedShort stringLength; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - stringLength = (JausUnsignedShort) strlen(message->fcClass->metaData); - index += stringLength; - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportVksFeatureClassMetadataMessage reportVksFeatureClassMetadataMessageCreate(void) -{ - ReportVksFeatureClassMetadataMessage message; - - message = (ReportVksFeatureClassMetadataMessage)malloc( sizeof(ReportVksFeatureClassMetadataMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void reportVksFeatureClassMetadataMessageDestroy(ReportVksFeatureClassMetadataMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportVksFeatureClassMetadataMessageFromBuffer(ReportVksFeatureClassMetadataMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportVksFeatureClassMetadataMessageToBuffer(ReportVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportVksFeatureClassMetadataMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportVksFeatureClassMetadataBuffer failed - } - } -} - -ReportVksFeatureClassMetadataMessage reportVksFeatureClassMetadataMessageFromJausMessage(JausMessage jausMessage) -{ - ReportVksFeatureClassMetadataMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportVksFeatureClassMetadataMessage)malloc( sizeof(ReportVksFeatureClassMetadataMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportVksFeatureClassMetadataMessageToJausMessage(ReportVksFeatureClassMetadataMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportVksFeatureClassMetadataMessageSize(ReportVksFeatureClassMetadataMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksObjectsCreationMessage.c b/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksObjectsCreationMessage.c deleted file mode 100644 index bfad4df7bdb4715b3b7200968f2ed1749690be01..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksObjectsCreationMessage.c +++ /dev/null @@ -1,399 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportVksObjectsCreationMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportVksObjectsCreationMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_VKS_OBJECTS_CREATION; -static const int maxDataSizeBytes = 262143; // As calculated. 1 + 2 + (65535 * 4) - -static JausBoolean headerFromBuffer(ReportVksObjectsCreationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportVksObjectsCreationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportVksObjectsCreationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportVksObjectsCreationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportVksObjectsCreationMessage message); -static void dataDestroy(ReportVksObjectsCreationMessage message); -static unsigned int dataSize(ReportVksObjectsCreationMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportVksObjectsCreationMessage message) -{ - // Set initial values of message fields - message->requestId = newJausByte(0); // 1: The request id sent by the requesting service - message->objectCount = newJausUnsignedShort(0); // 2: Total number of objects reported - message->objectIds = NULL; // 3: unique id for object created, 0x0000000 is reserved for an error -} - -// Destructs the message-specific fields -static void dataDestroy(ReportVksObjectsCreationMessage message) -{ - // Free message fields - if(message->objectIds) - free(message->objectIds); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportVksObjectsCreationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - unsigned short i = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Request Id - if(!jausByteFromBuffer(&message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Object Count - if(!jausUnsignedShortFromBuffer(&message->objectCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Allocate memory for object Ids - message->objectIds = (JausUnsignedInteger *)malloc(message->objectCount * JAUS_UNSIGNED_INTEGER_SIZE_BYTES); - - // Unpack Object Ids - for(i = 0; i < message->objectCount; i++) - { - if(!jausUnsignedIntegerFromBuffer(&message->objectIds[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportVksObjectsCreationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - unsigned short i = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Request Id - if(!jausByteToBuffer(message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Object Count - if(!jausUnsignedShortToBuffer(message->objectCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Pack Object Ids - for(i = 0; i < message->objectCount; i++) - { - if(!jausUnsignedIntegerToBuffer(message->objectIds[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - return index; -} - -static unsigned int dataSize(ReportVksObjectsCreationMessage message) -{ - int index = 0; - unsigned short i = 0; - - // Request Id - index += JAUS_BYTE_SIZE_BYTES; - - // Object Count - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Object Ids - for(i = 0; i < message->objectCount; i++) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportVksObjectsCreationMessage reportVksObjectsCreationMessageCreate(void) -{ - ReportVksObjectsCreationMessage message; - - message = (ReportVksObjectsCreationMessage)malloc( sizeof(ReportVksObjectsCreationMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void reportVksObjectsCreationMessageDestroy(ReportVksObjectsCreationMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportVksObjectsCreationMessageFromBuffer(ReportVksObjectsCreationMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportVksObjectsCreationMessageToBuffer(ReportVksObjectsCreationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportVksObjectsCreationMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportVksObjectsCreationBuffer failed - } - } -} - -ReportVksObjectsCreationMessage reportVksObjectsCreationMessageFromJausMessage(JausMessage jausMessage) -{ - ReportVksObjectsCreationMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportVksObjectsCreationMessage)malloc( sizeof(ReportVksObjectsCreationMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportVksObjectsCreationMessageToJausMessage(ReportVksObjectsCreationMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportVksObjectsCreationMessageSize(ReportVksObjectsCreationMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportVksObjectsCreationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportVksObjectsCreationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksObjectsMessage.c b/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksObjectsMessage.c deleted file mode 100644 index 6eaba052103e8e7d3a583cf49340b5431d5573c7..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/inform/worldModel/reportVksObjectsMessage.c +++ /dev/null @@ -1,458 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: reportVksObjectsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a ReportVksObjectsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_REPORT_VKS_OBJECTS; -static const int maxDataSizeBytes = 512000; // Max Message size: 500K - -static JausBoolean headerFromBuffer(ReportVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(ReportVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(ReportVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(ReportVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(ReportVksObjectsMessage message); -static void dataDestroy(ReportVksObjectsMessage message); -static unsigned int dataSize(ReportVksObjectsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(ReportVksObjectsMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->requestId = newJausByte(0); - message->objectCount = newJausUnsignedShort(0); - message->vectorObjects = jausArrayCreate(); -} - -// Destructs the message-specific fields -static void dataDestroy(ReportVksObjectsMessage message) -{ - // Free message fields - jausArrayDestroy(message->vectorObjects, (void *)vectorObjectDestroy); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(ReportVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i = 0; - JausUnsignedInteger tempUInt; - JausWorldModelVectorObject object = NULL; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request Id - if(!jausByteFromBuffer(&message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Object Count - if(!jausUnsignedShortFromBuffer(&message->objectCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Actual object data is optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_REPORT_DATA_BIT)) - { - message->vectorObjects = jausArrayCreate(); - if(!message->vectorObjects) return JAUS_FALSE; - - for(i = 0; i < message->objectCount; i++) - { - // Object Id - if(!jausUnsignedIntegerFromBuffer(&tempUInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Object Data - object = vectorObjectFromBuffer(buffer+index, bufferSizeBytes-index, JAUS_TRUE); // Always include buffer information - if(!object) return JAUS_FALSE; - index += vectorObjectSizeBytes(object, JAUS_TRUE); // Always include buffer information - - object->id = tempUInt; - jausArrayAdd(message->vectorObjects, object); - } - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(ReportVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i = 0; - JausWorldModelVectorObject object = NULL; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request Id - if(!jausByteToBuffer(message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Actual object data is optional - if(!jausByteIsBitSet(message->presenceVector, VKS_PV_REPORT_DATA_BIT)) - { - // Object Count - if(!jausUnsignedShortToBuffer(message->objectCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - else - { - // Object Count - if(!jausUnsignedShortToBuffer((JausUnsignedShort)message->vectorObjects->elementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - for(i = 0; i < message->vectorObjects->elementCount; i++) - { - object = (JausWorldModelVectorObject) message->vectorObjects->elementData[i]; - - // Object Id - if(!jausUnsignedIntegerToBuffer(object->id, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Object Data - if(!vectorObjectToBuffer(object, buffer+index, bufferSizeBytes-index, JAUS_TRUE)) return JAUS_FALSE; - index += vectorObjectSizeBytes(object, JAUS_TRUE); - } - } - } - - return index; -} - -static unsigned int dataSize(ReportVksObjectsMessage message) -{ - int index = 0; - int i = 0; - JausWorldModelVectorObject object = NULL; - - // Presence Vector - index += JAUS_BYTE_SIZE_BYTES; - - // Request Id - index += JAUS_BYTE_SIZE_BYTES; - - // Actual object data is optional - if(!jausByteIsBitSet(message->presenceVector, VKS_PV_REPORT_DATA_BIT)) - { - // Object Count - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - else - { - // Object Count - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - for(i = 0; i < message->vectorObjects->elementCount; i++) - { - object = (JausWorldModelVectorObject) message->vectorObjects->elementData[i]; - - // Object Id - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - // Object Data - index += vectorObjectSizeBytes(object, JAUS_TRUE); - } - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -ReportVksObjectsMessage reportVksObjectsMessageCreate(void) -{ - ReportVksObjectsMessage message; - - message = (ReportVksObjectsMessage)malloc( sizeof(ReportVksObjectsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void reportVksObjectsMessageDestroy(ReportVksObjectsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean reportVksObjectsMessageFromBuffer(ReportVksObjectsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean reportVksObjectsMessageToBuffer(ReportVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < reportVksObjectsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToReportVksObjectsBuffer failed - } - } -} - -ReportVksObjectsMessage reportVksObjectsMessageFromJausMessage(JausMessage jausMessage) -{ - ReportVksObjectsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (ReportVksObjectsMessage)malloc( sizeof(ReportVksObjectsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage reportVksObjectsMessageToJausMessage(ReportVksObjectsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int reportVksObjectsMessageSize(ReportVksObjectsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(ReportVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(ReportVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/jausMessage.c b/lib/openjaus/libjaus/src/message/jausMessage.c deleted file mode 100644 index 99b89824fc33a22c20406524af24df76724de24f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/jausMessage.c +++ /dev/null @@ -1,789 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the attributes of a JausMessage and all pre-defined -// command codes according to RA 3.2 - -#include -#include -#include -#include "jaus.h" - -static const int commandCode = 0; -static const int maxDataSizeBytes = 0; - -//Private Functions -static JausBoolean headerToBuffer(JausMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerFromBuffer(JausMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -JausMessage jausMessageCreate(void) -{ - JausMessage message; - - message = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - //Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - message->data = NULL; - - return message; -} - -void jausMessageDestroy(JausMessage message) -{ - if(message) - { - if(message->data) - { - free(message->data); - } - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); - } -} - - -unsigned int jausMessageSize(JausMessage message) -{ - return (unsigned int)(message->dataSize + JAUS_HEADER_SIZE_BYTES); -} - -JausBoolean jausMessageToBuffer(JausMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < jausMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - memcpy(buffer + JAUS_HEADER_SIZE_BYTES, message->data, message->dataSize); - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; //headerToJausBuffer failed - } - } -} - -JausBoolean jausMessageFromBuffer(JausMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer + index, bufferSizeBytes - index)) - { - index += JAUS_HEADER_SIZE_BYTES; - - if(bufferSizeBytes - index < message->dataSize) - { - return JAUS_FALSE; // not sufficient size - } - else - { - message->data = (unsigned char*) malloc(message->dataSize); - memcpy(message->data, buffer+index, message->dataSize); - return JAUS_TRUE; - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean jausMessageIsRejectableCommand(JausMessage message) -{ - if(!message) - { - return JAUS_FALSE; - } - - switch(message->commandCode) - { - case JAUS_SET_COMPONENT_AUTHORITY: - case JAUS_SHUTDOWN: - case JAUS_STANDBY: - case JAUS_RESUME: - case JAUS_RESET: - case JAUS_SET_EMERGENCY: - case JAUS_CLEAR_EMERGENCY: - case JAUS_SET_TIME: - case JAUS_RELEASE_COMPONENT_CONTROL: - case JAUS_SET_WRENCH_EFFORT: - case JAUS_SET_DISCRETE_DEVICES: - case JAUS_SET_GLOBAL_VECTOR: - case JAUS_SET_LOCAL_VECTOR: - case JAUS_SET_TRAVEL_SPEED: - case JAUS_SET_GLOBAL_WAYPOINT: - case JAUS_SET_LOCAL_WAYPOINT: - case JAUS_SET_GLOBAL_PATH_SEGMENT: - case JAUS_SET_LOCAL_PATH_SEGMENT: - case JAUS_SET_JOINT_EFFORTS: - case JAUS_SET_JOINT_POSITIONS: - case JAUS_SET_JOINT_VELOCITIES: - case JAUS_SET_TOOL_POINT: - case JAUS_SET_END_EFFECTOR_POSE: - case JAUS_SET_END_EFFECTOR_VELOCITY_STATE: - case JAUS_SET_JOINT_MOTION: - case JAUS_SET_END_EFFECTOR_PATH_MOTION: - case JAUS_SET_CAMERA_POSE: - case JAUS_SELECT_CAMERA: - case JAUS_SET_CAMERA_CAPABILITIES: - case JAUS_SET_CAMERA_FORMAT_OPTIONS: - return JAUS_TRUE; - - default: - return JAUS_FALSE; - } - return JAUS_FALSE; -} - -char *jausMessageCommandCodeString(JausMessage message) -{ - return jausCommandCodeString(message->commandCode); -} - -char *jausCommandCodeString(unsigned short commandCode) -{ - static char string[128] = {0}; - - switch(commandCode) - { - case JAUS_SET_COMPONENT_AUTHORITY: - return "JAUS_SET_COMPONENT_AUTHORITY"; - case JAUS_SHUTDOWN: - return "JAUS_SHUTDOWN"; - case JAUS_STANDBY: - return "JAUS_STANDBY"; - case JAUS_RESUME: - return "JAUS_RESUME"; - case JAUS_RESET: - return "JAUS_RESET"; - case JAUS_SET_EMERGENCY: - return "JAUS_SET_EMERGENCY"; - case JAUS_CLEAR_EMERGENCY: - return "JAUS_CLEAR_EMERGENCY"; - case JAUS_CREATE_SERVICE_CONNECTION: - return "JAUS_CREATE_SERVICE_CONNECTION"; - case JAUS_CONFIRM_SERVICE_CONNECTION: - return "JAUS_CONFIRM_SERVICE_CONNECTION"; - case JAUS_ACTIVATE_SERVICE_CONNECTION: - return "JAUS_ACTIVATE_SERVICE_CONNECTION"; - case JAUS_SUSPEND_SERVICE_CONNECTION: - return "JAUS_SUSPEND_SERVICE_CONNECTION"; - case JAUS_TERMINATE_SERVICE_CONNECTION: - return "JAUS_TERMINATE_SERVICE_CONNECTION"; - case JAUS_REQUEST_COMPONENT_CONTROL: - return "JAUS_REQUEST_COMPONENT_CONTROL"; - case JAUS_RELEASE_COMPONENT_CONTROL: - return "JAUS_RELEASE_COMPONENT_CONTROL"; - case JAUS_CONFIRM_COMPONENT_CONTROL: - return "JAUS_CONFIRM_COMPONENT_CONTROL"; - case JAUS_REJECT_COMPONENT_CONTROL: - return "JAUS_REJECT_COMPONENT_CONTROL"; - case JAUS_SET_TIME: - return "JAUS_SET_TIME"; - case JAUS_CREATE_EVENT: - return "JAUS_CREATE_EVENT"; - case JAUS_UPDATE_EVENT: - return "JAUS_UPDATE_EVENT"; - case JAUS_CANCEL_EVENT: - return "JAUS_CANCEL_EVENT"; - case JAUS_CONFIRM_EVENT_REQUEST: - return "JAUS_CONFIRM_EVENT_REQUEST"; - case JAUS_REJECT_EVENT_REQUEST: - return "JAUS_REJECT_EVENT_REQUEST"; - case JAUS_SET_DATA_LINK_STATUS: - return "JAUS_SET_DATA_LINK_STATUS"; - case JAUS_SET_DATA_LINK_SELECT: - return "JAUS_SET_DATA_LINK_SELECT"; - case JAUS_SET_WRENCH_EFFORT: - return "JAUS_SET_WRENCH_EFFORT"; - case JAUS_SET_DISCRETE_DEVICES: - return "JAUS_SET_DISCRETE_DEVICES"; - case JAUS_SET_GLOBAL_VECTOR: - return "JAUS_SET_GLOBAL_VECTOR"; - case JAUS_SET_LOCAL_VECTOR: - return "JAUS_SET_LOCAL_VECTOR"; - case JAUS_SET_TRAVEL_SPEED: - return "JAUS_SET_TRAVEL_SPEED"; - case JAUS_SET_GLOBAL_WAYPOINT: - return "JAUS_SET_GLOBAL_WAYPOINT"; - case JAUS_SET_LOCAL_WAYPOINT: - return "JAUS_SET_LOCAL_WAYPOINT"; - case JAUS_SET_GLOBAL_PATH_SEGMENT: - return "JAUS_SET_GLOBAL_PATH_SEGMENT"; - case JAUS_SET_LOCAL_PATH_SEGMENT: - return "JAUS_SET_LOCAL_PATH_SEGMENT"; - case JAUS_SET_JOINT_EFFORTS: - return "JAUS_SET_JOINT_EFFORTS"; - case JAUS_SET_JOINT_POSITIONS: - return "JAUS_SET_JOINT_POSITIONS"; - case JAUS_SET_JOINT_VELOCITIES: - return "JAUS_SET_JOINT_VELOCITIES"; - case JAUS_SET_TOOL_POINT: - return "JAUS_SET_TOOL_POINT"; - case JAUS_SET_END_EFFECTOR_POSE: - return "JAUS_SET_END_EFFECTOR_POSE"; - case JAUS_SET_END_EFFECTOR_VELOCITY_STATE: - return "JAUS_SET_END_EFFECTOR_VELOCITY_STATE"; - case JAUS_SET_JOINT_MOTION: - return "JAUS_SET_JOINT_MOTION"; - case JAUS_SET_END_EFFECTOR_PATH_MOTION: - return "JAUS_SET_END_EFFECTOR_PATH_MOTION"; - case JAUS_SET_CAMERA_POSE: - return "JAUS_SET_CAMERA_POSE"; - case JAUS_SELECT_CAMERA: - return "JAUS_SELECT_CAMERA"; - case JAUS_SET_CAMERA_CAPABILITIES: - return "JAUS_SET_CAMERA_CAPABILITIES"; - case JAUS_SET_CAMERA_FORMAT_OPTIONS: - return "JAUS_SET_CAMERA_FORMAT_OPTIONS"; - case JAUS_QUERY_COMPONENT_AUTHORITY: - return "JAUS_QUERY_COMPONENT_AUTHORITY"; - case JAUS_QUERY_COMPONENT_STATUS: - return "JAUS_QUERY_COMPONENT_STATUS"; - case JAUS_QUERY_TIME: - return "JAUS_QUERY_TIME"; - case JAUS_QUERY_EVENTS: - return "JAUS_QUERY_EVENTS"; - case JAUS_QUERY_DATA_LINK_STATUS: - return "JAUS_QUERY_DATA_LINK_STATUS"; - case JAUS_QUERY_SELECTED_DATA_LINK_STATUS: - return "JAUS_QUERY_SELECTED_DATA_LINK_STATUS"; - case JAUS_QUERY_HEARTBEAT_PULSE: - return "JAUS_QUERY_HEARTBEAT_PULSE"; - case JAUS_QUERY_PLATFORM_SPECIFICATIONS: - return "JAUS_QUERY_PLATFORM_SPECIFICATIONS"; - case JAUS_QUERY_PLATFORM_OPERATIONAL_DATA: - return "JAUS_QUERY_PLATFORM_OPERATIONAL_DATA"; - case JAUS_QUERY_GLOBAL_POSE: - return "JAUS_QUERY_GLOBAL_POSE"; - case JAUS_QUERY_LOCAL_POSE: - return "JAUS_QUERY_LOCAL_POSE"; - case JAUS_QUERY_VELOCITY_STATE: - return "JAUS_QUERY_VELOCITY_STATE"; - case JAUS_QUERY_WRENCH_EFFORT: - return "JAUS_QUERY_WRENCH_EFFORT"; - case JAUS_QUERY_DISCRETE_DEVICES: - return "JAUS_QUERY_DISCRETE_DEVICES"; - case JAUS_QUERY_GLOBAL_VECTOR: - return "JAUS_QUERY_GLOBAL_VECTOR"; - case JAUS_QUERY_LOCAL_VECTOR: - return "JAUS_QUERY_LOCAL_VECTOR"; - case JAUS_QUERY_TRAVEL_SPEED: - return "JAUS_QUERY_TRAVEL_SPEED"; - case JAUS_QUERY_WAYPOINT_COUNT: - return "JAUS_QUERY_WAYPOINT_COUNT"; - case JAUS_QUERY_GLOBAL_WAYPOINT: - return "JAUS_QUERY_GLOBAL_WAYPOINT"; - case JAUS_QUERY_LOCAL_WAYPOINT: - return "JAUS_QUERY_LOCAL_WAYPOINT"; - case JAUS_QUERY_PATH_SEGMENT_COUNT: - return "JAUS_QUERY_PATH_SEGMENT_COUNT"; - case JAUS_QUERY_GLOBAL_PATH_SEGMENT: - return "JAUS_QUERY_GLOBAL_PATH_SEGMENT"; - case JAUS_QUERY_LOCAL_PATH_SEGMENT: - return "JAUS_QUERY_LOCAL_PATH_SEGMENT"; - case JAUS_QUERY_MANIPULATOR_SPECIFICATIONS: - return "JAUS_QUERY_MANIPULATOR_SPECIFICATIONS"; - case JAUS_QUERY_JOINT_EFFORTS: - return "JAUS_QUERY_JOINT_EFFORTS"; - case JAUS_QUERY_JOINT_POSITIONS: - return "JAUS_QUERY_JOINT_POSITIONS"; - case JAUS_QUERY_JOINT_VELOCITIES: - return "JAUS_QUERY_JOINT_VELOCITIES"; - case JAUS_QUERY_TOOL_POINT: - return "JAUS_QUERY_TOOL_POINT"; - case JAUS_QUERY_JOINT_FORCE_TORQUES: - return "JAUS_QUERY_JOINT_FORCE_TORQUES"; - case JAUS_QUERY_CAMERA_POSE: - return "JAUS_QUERY_CAMERA_POSE"; - case JAUS_QUERY_CAMERA_COUNT: - return "JAUS_QUERY_CAMERA_COUNT"; - case JAUS_QUERY_RELATIVE_OBJECT_POSITION: - return "JAUS_QUERY_RELATIVE_OBJECT_POSITION"; - case JAUS_QUERY_SELECTED_CAMERA: - return "JAUS_QUERY_SELECTED_CAMERA"; - case JAUS_QUERY_CAMERA_CAPABILITIES: - return "JAUS_QUERY_CAMERA_CAPABILITIES"; - case JAUS_QUERY_CAMERA_FORMAT_OPTIONS: - return "JAUS_QUERY_CAMERA_FORMAT_OPTIONS"; - case JAUS_QUERY_IMAGE: - return "JAUS_QUERY_IMAGE"; - case JAUS_QUERY_COMPONENT_CONTROL: - return "JAUS_QUERY_COMPONENT_CONTROL"; - case JAUS_REPORT_COMPONENT_AUTHORITY: - return "JAUS_REPORT_COMPONENT_AUTHORITY"; - case JAUS_REPORT_COMPONENT_STATUS: - return "JAUS_REPORT_COMPONENT_STATUS"; - case JAUS_REPORT_TIME: - return "JAUS_REPORT_TIME"; - case JAUS_REPORT_EVENTS: - return "JAUS_REPORT_EVENTS"; - case JAUS_EVENT: - return "JAUS_EVENT"; - case JAUS_REPORT_DATA_LINK_STATUS: - return "JAUS_REPORT_DATA_LINK_STATUS"; - case JAUS_REPORT_SELECTED_DATA_LINK_STATUS: - return "JAUS_REPORT_SELECTED_DATA_LINK_STATUS"; - case JAUS_REPORT_HEARTBEAT_PULSE: - return "JAUS_REPORT_HEARTBEAT_PULSE"; - case JAUS_REPORT_PLATFORM_SPECIFICATIONS: - return "JAUS_REPORT_PLATFORM_SPECIFICATIONS"; - case JAUS_REPORT_PLATFORM_OPERATIONAL_DATA: - return "JAUS_REPORT_PLATFORM_OPERATIONAL_DATA"; - case JAUS_REPORT_GLOBAL_POSE: - return "JAUS_REPORT_GLOBAL_POSE"; - case JAUS_REPORT_LOCAL_POSE: - return "JAUS_REPORT_LOCAL_POSE"; - case JAUS_REPORT_VELOCITY_STATE: - return "JAUS_REPORT_VELOCITY_STATE"; - case JAUS_REPORT_WRENCH_EFFORT: - return "JAUS_REPORT_WRENCH_EFFORT"; - case JAUS_REPORT_DISCRETE_DEVICES: - return "JAUS_REPORT_DISCRETE_DEVICES"; - case JAUS_REPORT_GLOBAL_VECTOR: - return "JAUS_REPORT_GLOBAL_VECTOR"; - case JAUS_REPORT_LOCAL_VECTOR: - return "JAUS_REPORT_LOCAL_VECTOR"; - case JAUS_REPORT_TRAVEL_SPEED: - return "JAUS_REPORT_TRAVEL_SPEED"; - case JAUS_REPORT_WAYPOINT_COUNT: - return "JAUS_REPORT_WAYPOINT_COUNT"; - case JAUS_REPORT_GLOBAL_WAYPOINT: - return "JAUS_REPORT_GLOBAL_WAYPOINT"; - case JAUS_REPORT_LOCAL_WAYPOINT: - return "JAUS_REPORT_LOCAL_WAYPOINT"; - case JAUS_REPORT_PATH_SEGMENT_COUNT: - return "JAUS_REPORT_PATH_SEGMENT_COUNT"; - case JAUS_REPORT_GLOBAL_PATH_SEGMENT: - return "JAUS_REPORT_GLOBAL_PATH_SEGMENT"; - case JAUS_REPORT_LOCAL_PATH_SEGMENT: - return "JAUS_REPORT_LOCAL_PATH_SEGMENT"; - case JAUS_REPORT_MANIPULATOR_SPECIFICATIONS: - return "JAUS_REPORT_MANIPULATOR_SPECIFICATIONS"; - case JAUS_REPORT_JOINT_EFFORTS: - return "JAUS_REPORT_JOINT_EFFORTS"; - case JAUS_REPORT_JOINT_POSITIONS: - return "JAUS_REPORT_JOINT_POSITIONS"; - case JAUS_REPORT_JOINT_VELOCITIES: - return "JAUS_REPORT_JOINT_VELOCITIES"; - case JAUS_REPORT_TOOL_POINT: - return "JAUS_REPORT_TOOL_POINT"; - case JAUS_REPORT_JOINT_FORCE_TORQUES: - return "JAUS_REPORT_JOINT_FORCE_TORQUES"; - case JAUS_REPORT_CAMERA_POSE: - return "JAUS_REPORT_CAMERA_POSE"; - case JAUS_REPORT_CAMERA_COUNT: - return "JAUS_REPORT_CAMERA_COUNT"; - case JAUS_REPORT_RELATIVE_OBJECT_POSITION: - return "JAUS_REPORT_RELATIVE_OBJECT_POSITION"; - case JAUS_REPORT_SELECTED_CAMERA: - return "JAUS_REPORT_SELECTED_CAMERA"; - case JAUS_REPORT_CAMERA_CAPABILITIES: - return "JAUS_REPORT_CAMERA_CAPABILITIES"; - case JAUS_REPORT_CAMERA_FORMAT_OPTIONS: - return "JAUS_REPORT_CAMERA_FORMAT_OPTIONS"; - case JAUS_REPORT_IMAGE: - return "JAUS_REPORT_IMAGE"; - case JAUS_QUERY_IDENTIFICATION: - return "JAUS_QUERY_IDENTIFICATION"; - case JAUS_REPORT_IDENTIFICATION: - return "JAUS_REPORT_IDENTIFICATION"; - case JAUS_QUERY_CONFIGURATION: - return "JAUS_QUERY_CONFIGURATION"; - case JAUS_REPORT_CONFIGURATION: - return "JAUS_REPORT_CONFIGURATION"; - case JAUS_QUERY_PAYLOAD_DATA_ELEMENT: - return "JAUS_QUERY_PAYLOAD_DATA_ELEMENT"; - case JAUS_QUERY_PAYLOAD_INTERFACE: - return "JAUS_QUERY_PAYLOAD_INTERFACE"; - case JAUS_QUERY_SERVICES: - return "JAUS_QUERY_SERVICES"; - case JAUS_REPORT_PAYLOAD_DATA_ELEMENT: - return "JAUS_REPORT_PAYLOAD_DATA_ELEMENT"; - case JAUS_REPORT_PAYLOAD_INTERFACE: - return "JAUS_REPORT_PAYLOAD_INTERFACE"; - case JAUS_REPORT_SERVICES: - return "JAUS_REPORT_SERVICES"; - case JAUS_REPORT_COMPONENT_CONTROL: - return "JAUS_REPORT_COMPONENT_CONTROL"; - case JAUS_SET_PAYLOAD_DATA_ELEMENT: - return "JAUS_SET_PAYLOAD_DATA_ELEMENT"; - case JAUS_CREATE_VKS_OBJECTS: - return "JAUS_CREATE_VKS_OBJECTS"; - case JAUS_DELETE_VKS_OBJECTS: - return "JAUS_DELETE_VKS_OBJECTS"; - case JAUS_QUERY_VKS_BOUNDS: - return "JAUS_QUERY_VKS_BOUNDS"; - case JAUS_QUERY_VKS_FEATURE_CLASS_METADATA: - return "JAUS_QUERY_VKS_FEATURE_CLASS_METADATA"; - case JAUS_QUERY_VKS_OBJECTS: - return "JAUS_QUERY_VKS_OBJECTS"; - case JAUS_REPORT_VKS_BOUNDS: - return "JAUS_REPORT_VKS_BOUNDS"; - case JAUS_REPORT_VKS_FEATURE_CLASS_METADATA: - return "JAUS_REPORT_VKS_FEATURE_CLASS_METADATA"; - case JAUS_REPORT_VKS_OBJECTS_CREATION: - return "JAUS_REPORT_VKS_OBJECTS_CREATION"; - case JAUS_REPORT_VKS_OBJECTS: - return "JAUS_REPORT_VKS_OBJECTS"; - default: - sprintf(string, "UNDEFINED MESSAGE: 0x%04X", commandCode); - return string; - } -} - -unsigned short jausMessageGetComplimentaryCommandCode(unsigned short commandCode) -{ - switch(commandCode) - { - case JAUS_QUERY_COMPONENT_AUTHORITY: - return JAUS_REPORT_COMPONENT_AUTHORITY; - case JAUS_QUERY_COMPONENT_STATUS: - return JAUS_REPORT_COMPONENT_STATUS; - case JAUS_QUERY_TIME: - return JAUS_REPORT_TIME; - case JAUS_QUERY_EVENTS: - return JAUS_REPORT_EVENTS; - case JAUS_QUERY_DATA_LINK_STATUS: - return JAUS_REPORT_DATA_LINK_STATUS; - case JAUS_QUERY_SELECTED_DATA_LINK_STATUS: - return JAUS_REPORT_SELECTED_DATA_LINK_STATUS; - case JAUS_QUERY_HEARTBEAT_PULSE: - return JAUS_REPORT_HEARTBEAT_PULSE; - case JAUS_QUERY_PLATFORM_SPECIFICATIONS: - return JAUS_REPORT_PLATFORM_SPECIFICATIONS; - case JAUS_QUERY_PLATFORM_OPERATIONAL_DATA: - return JAUS_REPORT_PLATFORM_OPERATIONAL_DATA; - case JAUS_QUERY_GLOBAL_POSE: - return JAUS_REPORT_GLOBAL_POSE; - case JAUS_QUERY_LOCAL_POSE: - return JAUS_REPORT_LOCAL_POSE; - case JAUS_QUERY_VELOCITY_STATE: - return JAUS_REPORT_VELOCITY_STATE; - case JAUS_QUERY_WRENCH_EFFORT: - return JAUS_REPORT_WRENCH_EFFORT; - case JAUS_QUERY_DISCRETE_DEVICES: - return JAUS_REPORT_DISCRETE_DEVICES; - case JAUS_QUERY_GLOBAL_VECTOR: - return JAUS_REPORT_GLOBAL_VECTOR; - case JAUS_QUERY_LOCAL_VECTOR: - return JAUS_REPORT_LOCAL_VECTOR; - case JAUS_QUERY_TRAVEL_SPEED: - return JAUS_REPORT_TRAVEL_SPEED; - case JAUS_QUERY_WAYPOINT_COUNT: - return JAUS_REPORT_WAYPOINT_COUNT; - case JAUS_QUERY_GLOBAL_WAYPOINT: - return JAUS_REPORT_GLOBAL_WAYPOINT; - case JAUS_QUERY_LOCAL_WAYPOINT: - return JAUS_REPORT_LOCAL_WAYPOINT; - case JAUS_QUERY_PATH_SEGMENT_COUNT: - return JAUS_REPORT_PATH_SEGMENT_COUNT; - case JAUS_QUERY_GLOBAL_PATH_SEGMENT: - return JAUS_REPORT_GLOBAL_PATH_SEGMENT; - case JAUS_QUERY_LOCAL_PATH_SEGMENT: - return JAUS_REPORT_LOCAL_PATH_SEGMENT; - case JAUS_QUERY_MANIPULATOR_SPECIFICATIONS: - return JAUS_REPORT_MANIPULATOR_SPECIFICATIONS; - case JAUS_QUERY_JOINT_EFFORTS: - return JAUS_REPORT_JOINT_EFFORTS; - case JAUS_QUERY_JOINT_POSITIONS: - return JAUS_REPORT_JOINT_POSITIONS; - case JAUS_QUERY_JOINT_VELOCITIES: - return JAUS_REPORT_JOINT_VELOCITIES; - case JAUS_QUERY_TOOL_POINT: - return JAUS_REPORT_TOOL_POINT; - case JAUS_QUERY_JOINT_FORCE_TORQUES: - return JAUS_REPORT_JOINT_FORCE_TORQUES; - case JAUS_QUERY_CAMERA_POSE: - return JAUS_REPORT_CAMERA_POSE; - case JAUS_QUERY_CAMERA_COUNT: - return JAUS_REPORT_CAMERA_COUNT; - case JAUS_QUERY_RELATIVE_OBJECT_POSITION: - return JAUS_REPORT_RELATIVE_OBJECT_POSITION; - case JAUS_QUERY_SELECTED_CAMERA: - return JAUS_REPORT_SELECTED_CAMERA; - case JAUS_QUERY_CAMERA_CAPABILITIES: - return JAUS_REPORT_CAMERA_CAPABILITIES; - case JAUS_QUERY_CAMERA_FORMAT_OPTIONS: - return JAUS_REPORT_CAMERA_FORMAT_OPTIONS; - case JAUS_QUERY_IMAGE: - return JAUS_REPORT_IMAGE; - case JAUS_QUERY_PAYLOAD_DATA_ELEMENT: - return JAUS_REPORT_PAYLOAD_DATA_ELEMENT; - case JAUS_QUERY_PAYLOAD_INTERFACE: - return JAUS_REPORT_PAYLOAD_INTERFACE; - case JAUS_QUERY_SERVICES: - return JAUS_REPORT_SERVICES; - case JAUS_QUERY_IDENTIFICATION: - return JAUS_REPORT_IDENTIFICATION; - case JAUS_QUERY_CONFIGURATION: - return JAUS_REPORT_CONFIGURATION; - case JAUS_QUERY_VKS_BOUNDS: - return JAUS_REPORT_VKS_BOUNDS; - case JAUS_QUERY_VKS_FEATURE_CLASS_METADATA: - return JAUS_REPORT_VKS_FEATURE_CLASS_METADATA; - case JAUS_QUERY_VKS_OBJECTS: - return JAUS_REPORT_VKS_OBJECTS; - case JAUS_REPORT_COMPONENT_AUTHORITY: - return JAUS_QUERY_COMPONENT_AUTHORITY; - case JAUS_REPORT_COMPONENT_STATUS: - return JAUS_QUERY_COMPONENT_STATUS; - case JAUS_REPORT_TIME: - return JAUS_QUERY_TIME; - case JAUS_REPORT_EVENTS: - return JAUS_QUERY_EVENTS; - case JAUS_REPORT_DATA_LINK_STATUS: - return JAUS_QUERY_DATA_LINK_STATUS; - case JAUS_REPORT_SELECTED_DATA_LINK_STATUS: - return JAUS_QUERY_SELECTED_DATA_LINK_STATUS; - case JAUS_REPORT_HEARTBEAT_PULSE: - return JAUS_QUERY_HEARTBEAT_PULSE; - case JAUS_REPORT_PLATFORM_SPECIFICATIONS: - return JAUS_QUERY_PLATFORM_SPECIFICATIONS; - case JAUS_REPORT_PLATFORM_OPERATIONAL_DATA: - return JAUS_QUERY_PLATFORM_OPERATIONAL_DATA; - case JAUS_REPORT_GLOBAL_POSE: - return JAUS_QUERY_GLOBAL_POSE; - case JAUS_REPORT_LOCAL_POSE: - return JAUS_QUERY_LOCAL_POSE; - case JAUS_REPORT_VELOCITY_STATE: - return JAUS_QUERY_VELOCITY_STATE; - case JAUS_REPORT_WRENCH_EFFORT: - return JAUS_QUERY_WRENCH_EFFORT; - case JAUS_REPORT_DISCRETE_DEVICES: - return JAUS_QUERY_DISCRETE_DEVICES; - case JAUS_REPORT_GLOBAL_VECTOR: - return JAUS_QUERY_GLOBAL_VECTOR; - case JAUS_REPORT_LOCAL_VECTOR: - return JAUS_QUERY_LOCAL_VECTOR; - case JAUS_REPORT_TRAVEL_SPEED: - return JAUS_QUERY_TRAVEL_SPEED; - case JAUS_REPORT_WAYPOINT_COUNT: - return JAUS_QUERY_WAYPOINT_COUNT; - case JAUS_REPORT_GLOBAL_WAYPOINT: - return JAUS_QUERY_GLOBAL_WAYPOINT; - case JAUS_REPORT_LOCAL_WAYPOINT: - return JAUS_QUERY_LOCAL_WAYPOINT; - case JAUS_REPORT_PATH_SEGMENT_COUNT: - return JAUS_QUERY_PATH_SEGMENT_COUNT; - case JAUS_REPORT_GLOBAL_PATH_SEGMENT: - return JAUS_QUERY_GLOBAL_PATH_SEGMENT; - case JAUS_REPORT_LOCAL_PATH_SEGMENT: - return JAUS_QUERY_LOCAL_PATH_SEGMENT; - case JAUS_REPORT_MANIPULATOR_SPECIFICATIONS: - return JAUS_QUERY_MANIPULATOR_SPECIFICATIONS; - case JAUS_REPORT_JOINT_EFFORTS: - return JAUS_QUERY_JOINT_EFFORTS; - case JAUS_REPORT_JOINT_POSITIONS: - return JAUS_QUERY_JOINT_POSITIONS; - case JAUS_REPORT_JOINT_VELOCITIES: - return JAUS_QUERY_JOINT_VELOCITIES; - case JAUS_REPORT_TOOL_POINT: - return JAUS_QUERY_TOOL_POINT; - case JAUS_REPORT_JOINT_FORCE_TORQUES: - return JAUS_QUERY_JOINT_FORCE_TORQUES; - case JAUS_REPORT_CAMERA_POSE: - return JAUS_QUERY_CAMERA_POSE; - case JAUS_REPORT_CAMERA_COUNT: - return JAUS_QUERY_CAMERA_COUNT; - case JAUS_REPORT_RELATIVE_OBJECT_POSITION: - return JAUS_QUERY_RELATIVE_OBJECT_POSITION; - case JAUS_REPORT_SELECTED_CAMERA: - return JAUS_QUERY_SELECTED_CAMERA; - case JAUS_REPORT_CAMERA_CAPABILITIES: - return JAUS_QUERY_CAMERA_CAPABILITIES; - case JAUS_REPORT_CAMERA_FORMAT_OPTIONS: - return JAUS_QUERY_CAMERA_FORMAT_OPTIONS; - case JAUS_REPORT_IMAGE: - return JAUS_QUERY_IMAGE; - case JAUS_REPORT_IDENTIFICATION: - return JAUS_QUERY_IDENTIFICATION; - case JAUS_REPORT_CONFIGURATION: - return JAUS_QUERY_CONFIGURATION; - case JAUS_REPORT_PAYLOAD_DATA_ELEMENT: - return JAUS_QUERY_PAYLOAD_DATA_ELEMENT; - case JAUS_REPORT_PAYLOAD_INTERFACE: - return JAUS_QUERY_PAYLOAD_INTERFACE; - case JAUS_REPORT_SERVICES: - return JAUS_QUERY_SERVICES; - case JAUS_REPORT_VKS_BOUNDS: - return JAUS_QUERY_VKS_BOUNDS; - case JAUS_REPORT_VKS_FEATURE_CLASS_METADATA: - return JAUS_QUERY_VKS_FEATURE_CLASS_METADATA; - case JAUS_REPORT_VKS_OBJECTS: - return JAUS_QUERY_VKS_OBJECTS; - default: - // Unknown Command Code - return 0; - } -} - -JausMessage jausMessageClone(JausMessage inputMessage) -{ - JausMessage outputMessage; - - outputMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(outputMessage == NULL) - { - return NULL; - } - - outputMessage->properties = inputMessage->properties; - outputMessage->commandCode = inputMessage->commandCode; - - outputMessage->destination = jausAddressCreate(); - *outputMessage->destination = *inputMessage->destination; - - outputMessage->source = jausAddressCreate(); - *outputMessage->source = *inputMessage->source; - - outputMessage->dataSize = inputMessage->dataSize; - outputMessage->dataFlag = inputMessage->dataFlag; - outputMessage->sequenceNumber = inputMessage->sequenceNumber; - - outputMessage->data = NULL; - if(inputMessage->dataSize) - { - outputMessage->data = (unsigned char *)malloc(inputMessage->dataSize); - memcpy(outputMessage->data, inputMessage->data, inputMessage->dataSize); - } - - return outputMessage; -} - - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerToBuffer(JausMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerFromBuffer(JausMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] | ((buffer[13] & 0x0F) << 8); - message->dataFlag = (buffer[13] & 0xF0) >> 4; - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} diff --git a/lib/openjaus/libjaus/src/message/query/communications/queryDataLinkStatusMessage.c b/lib/openjaus/libjaus/src/message/query/communications/queryDataLinkStatusMessage.c deleted file mode 100644 index c83642d42a6966bc517cc72c3c417d910de53e8c..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/communications/queryDataLinkStatusMessage.c +++ /dev/null @@ -1,355 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryDataLinkStatusMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryDataLinkStatusMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_DATA_LINK_STATUS; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(QueryDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryDataLinkStatusMessage message); -static void dataDestroy(QueryDataLinkStatusMessage message); -static unsigned int dataSize(QueryDataLinkStatusMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryDataLinkStatusMessage message) -{ - - message->dataLinkId = newJausByte(0); // Data link on by default -} - -// Destructs the message-specific fields -static void dataDestroy(QueryDataLinkStatusMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - if(!jausByteFromBuffer(&message->dataLinkId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->dataLinkId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryDataLinkStatusMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryDataLinkStatusMessage queryDataLinkStatusMessageCreate(void) -{ - QueryDataLinkStatusMessage message; - - message = (QueryDataLinkStatusMessage)malloc( sizeof(QueryDataLinkStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryDataLinkStatusMessageDestroy(QueryDataLinkStatusMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryDataLinkStatusMessageFromBuffer(QueryDataLinkStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryDataLinkStatusMessageToBuffer(QueryDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryDataLinkStatusMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryDataLinkStatusBuffer failed - } - } -} - -QueryDataLinkStatusMessage queryDataLinkStatusMessageFromJausMessage(JausMessage jausMessage) -{ - QueryDataLinkStatusMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryDataLinkStatusMessage)malloc( sizeof(QueryDataLinkStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryDataLinkStatusMessageToJausMessage(QueryDataLinkStatusMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryDataLinkStatusMessageSize(QueryDataLinkStatusMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/communications/queryHeartbeatPulseMessage.c b/lib/openjaus/libjaus/src/message/query/communications/queryHeartbeatPulseMessage.c deleted file mode 100644 index eb386a633af309fb1db2c2e267d0be66d5d37607..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/communications/queryHeartbeatPulseMessage.c +++ /dev/null @@ -1,346 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryHeartbeatPulseMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryHeartbeatPulseMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_HEARTBEAT_PULSE; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryHeartbeatPulseMessage message); -static unsigned int dataSize(QueryHeartbeatPulseMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryHeartbeatPulseMessage message) -{ - // Set initial values of message fields - // No Message Fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -// int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Message Fields - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // No Message Fields - } - - return index; -} - -static unsigned int dataSize(QueryHeartbeatPulseMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryHeartbeatPulseMessage queryHeartbeatPulseMessageCreate(void) -{ - QueryHeartbeatPulseMessage message; - - message = (QueryHeartbeatPulseMessage)malloc( sizeof(QueryHeartbeatPulseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryHeartbeatPulseMessageDestroy(QueryHeartbeatPulseMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryHeartbeatPulseMessageFromBuffer(QueryHeartbeatPulseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryHeartbeatPulseMessageToBuffer(QueryHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryHeartbeatPulseMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryHeartbeatPulseBuffer failed - } - } -} - -QueryHeartbeatPulseMessage queryHeartbeatPulseMessageFromJausMessage(JausMessage jausMessage) -{ - QueryHeartbeatPulseMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryHeartbeatPulseMessage)malloc( sizeof(QueryHeartbeatPulseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryHeartbeatPulseMessageToJausMessage(QueryHeartbeatPulseMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryHeartbeatPulseMessageSize(QueryHeartbeatPulseMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryHeartbeatPulseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/communications/querySelectedDataLinkStatusMessage.c b/lib/openjaus/libjaus/src/message/query/communications/querySelectedDataLinkStatusMessage.c deleted file mode 100644 index d1aae8ab535313bd390c878579e862e83a6e033f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/communications/querySelectedDataLinkStatusMessage.c +++ /dev/null @@ -1,340 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: querySelectedDataLinkStatusMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QuerySelectedDataLinkStatusMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_SELECTED_DATA_LINK_STATUS; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QuerySelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QuerySelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QuerySelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QuerySelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QuerySelectedDataLinkStatusMessage message); -static void dataDestroy(QuerySelectedDataLinkStatusMessage message); -static unsigned int dataSize(QuerySelectedDataLinkStatusMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QuerySelectedDataLinkStatusMessage message) -{ -} - -// Destructs the message-specific fields -static void dataDestroy(QuerySelectedDataLinkStatusMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QuerySelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes == message->dataSize) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QuerySelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QuerySelectedDataLinkStatusMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QuerySelectedDataLinkStatusMessage querySelectedDataLinkStatusMessageCreate(void) -{ - QuerySelectedDataLinkStatusMessage message; - - message = (QuerySelectedDataLinkStatusMessage)malloc( sizeof(QuerySelectedDataLinkStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void querySelectedDataLinkStatusMessageDestroy(QuerySelectedDataLinkStatusMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean querySelectedDataLinkStatusMessageFromBuffer(QuerySelectedDataLinkStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean querySelectedDataLinkStatusMessageToBuffer(QuerySelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < querySelectedDataLinkStatusMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQuerySelectedDataLinkStatusBuffer failed - } - } -} - -QuerySelectedDataLinkStatusMessage querySelectedDataLinkStatusMessageFromJausMessage(JausMessage jausMessage) -{ - QuerySelectedDataLinkStatusMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QuerySelectedDataLinkStatusMessage)malloc( sizeof(QuerySelectedDataLinkStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage querySelectedDataLinkStatusMessageToJausMessage(QuerySelectedDataLinkStatusMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int querySelectedDataLinkStatusMessageSize(QuerySelectedDataLinkStatusMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QuerySelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QuerySelectedDataLinkStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/core/queryComponentAuthorityMessage.c b/lib/openjaus/libjaus/src/message/query/core/queryComponentAuthorityMessage.c deleted file mode 100644 index 3829321b1a1e2acf3ed048b96ec5fcc0b1e03c56..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/core/queryComponentAuthorityMessage.c +++ /dev/null @@ -1,346 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryComponentAuthorityMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryComponentAuthorityMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_COMPONENT_AUTHORITY; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryComponentAuthorityMessage message); -static unsigned int dataSize(QueryComponentAuthorityMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryComponentAuthorityMessage message) -{ - // Set initial values of message fields - // No Fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -// int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Fields - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // No Fields - } - - return index; -} - -static unsigned int dataSize(QueryComponentAuthorityMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryComponentAuthorityMessage queryComponentAuthorityMessageCreate(void) -{ - QueryComponentAuthorityMessage message; - - message = (QueryComponentAuthorityMessage)malloc( sizeof(QueryComponentAuthorityMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryComponentAuthorityMessageDestroy(QueryComponentAuthorityMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryComponentAuthorityMessageFromBuffer(QueryComponentAuthorityMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryComponentAuthorityMessageToBuffer(QueryComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryComponentAuthorityMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryComponentAuthorityBuffer failed - } - } -} - -QueryComponentAuthorityMessage queryComponentAuthorityMessageFromJausMessage(JausMessage jausMessage) -{ - QueryComponentAuthorityMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryComponentAuthorityMessage)malloc( sizeof(QueryComponentAuthorityMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryComponentAuthorityMessageToJausMessage(QueryComponentAuthorityMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryComponentAuthorityMessageSize(QueryComponentAuthorityMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryComponentAuthorityMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort *)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/core/queryComponentControlMessage.c b/lib/openjaus/libjaus/src/message/query/core/queryComponentControlMessage.c deleted file mode 100644 index 9752f54ccb0988290d00a38332c03cb2438b54ad..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/core/queryComponentControlMessage.c +++ /dev/null @@ -1,346 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryComponentControlMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryComponentControlMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_COMPONENT_CONTROL; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryComponentControlMessage message); -static unsigned int dataSize(QueryComponentControlMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryComponentControlMessage message) -{ - // Set initial values of message fields - // No Fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -// int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Fields - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // No Fields - } - - return index; -} - -static unsigned int dataSize(QueryComponentControlMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryComponentControlMessage queryComponentControlMessageCreate(void) -{ - QueryComponentControlMessage message; - - message = (QueryComponentControlMessage)malloc( sizeof(QueryComponentControlMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryComponentControlMessageDestroy(QueryComponentControlMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryComponentControlMessageFromBuffer(QueryComponentControlMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryComponentControlMessageToBuffer(QueryComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryComponentControlMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryComponentControlBuffer failed - } - } -} - -QueryComponentControlMessage queryComponentControlMessageFromJausMessage(JausMessage jausMessage) -{ - QueryComponentControlMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryComponentControlMessage)malloc( sizeof(QueryComponentControlMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryComponentControlMessageToJausMessage(QueryComponentControlMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryComponentControlMessageSize(QueryComponentControlMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryComponentControlMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort *)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/core/queryComponentStatusMessage.c b/lib/openjaus/libjaus/src/message/query/core/queryComponentStatusMessage.c deleted file mode 100644 index 3bda66a47b3ea8ce6e868dc4e8be9677587cdb4a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/core/queryComponentStatusMessage.c +++ /dev/null @@ -1,346 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryComponentStatusMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryComponentStatusMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_COMPONENT_STATUS; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryComponentStatusMessage message); -static unsigned int dataSize(QueryComponentStatusMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryComponentStatusMessage message) -{ - // Set initial values of message fields - // No Message Fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -// int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Message Fields - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // No Message Fields - } - - return index; -} - -static unsigned int dataSize(QueryComponentStatusMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryComponentStatusMessage queryComponentStatusMessageCreate(void) -{ - QueryComponentStatusMessage message; - - message = (QueryComponentStatusMessage)malloc( sizeof(QueryComponentStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryComponentStatusMessageDestroy(QueryComponentStatusMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryComponentStatusMessageFromBuffer(QueryComponentStatusMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryComponentStatusMessageToBuffer(QueryComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryComponentStatusMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryComponentStatusBuffer failed - } - } -} - -QueryComponentStatusMessage queryComponentStatusMessageFromJausMessage(JausMessage jausMessage) -{ - QueryComponentStatusMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryComponentStatusMessage)malloc( sizeof(QueryComponentStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryComponentStatusMessageToJausMessage(QueryComponentStatusMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryComponentStatusMessageSize(QueryComponentStatusMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryComponentStatusMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/core/queryTimeMessage.c b/lib/openjaus/libjaus/src/message/query/core/queryTimeMessage.c deleted file mode 100644 index 31586a213c217c450f0a366c67aac42182c296eb..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/core/queryTimeMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryTimeMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryTimeMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_TIME; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(QueryTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryTimeMessage message); -static unsigned int dataSize(QueryTimeMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryTimeMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryTimeMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryTimeMessage queryTimeMessageCreate(void) -{ - QueryTimeMessage message; - - message = (QueryTimeMessage)malloc( sizeof(QueryTimeMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryTimeMessageDestroy(QueryTimeMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryTimeMessageFromBuffer(QueryTimeMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryTimeMessageToBuffer(QueryTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryTimeMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryTimeBuffer failed - } - } -} - -QueryTimeMessage queryTimeMessageFromJausMessage(JausMessage jausMessage) -{ - QueryTimeMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryTimeMessage)malloc( sizeof(QueryTimeMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryTimeMessageToJausMessage(QueryTimeMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryTimeMessageSize(QueryTimeMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryTimeMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/dynamicConfiguration/queryConfigurationMessage.c b/lib/openjaus/libjaus/src/message/query/dynamicConfiguration/queryConfigurationMessage.c deleted file mode 100644 index 150fb17ee90b4736b4ee7ec5273234184ddfa586..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/dynamicConfiguration/queryConfigurationMessage.c +++ /dev/null @@ -1,350 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryConfigurationMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryConfigurationMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_CONFIGURATION; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(QueryConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryConfigurationMessage message); -static unsigned int dataSize(QueryConfigurationMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryConfigurationMessage message) -{ - // Set initial values of message fields - message->queryField = newJausByte(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->queryField, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->queryField, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - } - - return index; -} - -static unsigned int dataSize(QueryConfigurationMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryConfigurationMessage queryConfigurationMessageCreate(void) -{ - QueryConfigurationMessage message; - - message = (QueryConfigurationMessage)malloc( sizeof(QueryConfigurationMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryConfigurationMessageDestroy(QueryConfigurationMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryConfigurationMessageFromBuffer(QueryConfigurationMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryConfigurationMessageToBuffer(QueryConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryConfigurationMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryConfigurationBuffer failed - } - } -} - -QueryConfigurationMessage queryConfigurationMessageFromJausMessage(JausMessage jausMessage) -{ - QueryConfigurationMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryConfigurationMessage)malloc( sizeof(QueryConfigurationMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryConfigurationMessageToJausMessage(QueryConfigurationMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryConfigurationMessageSize(QueryConfigurationMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryConfigurationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/dynamicConfiguration/queryIdentificationMessage.c b/lib/openjaus/libjaus/src/message/query/dynamicConfiguration/queryIdentificationMessage.c deleted file mode 100644 index 17dfa00d2640aeeeb2230dc36b1098412f135c83..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/dynamicConfiguration/queryIdentificationMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryIdentificationMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryIdentificationMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_IDENTIFICATION; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(QueryIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryIdentificationMessage message); -static unsigned int dataSize(QueryIdentificationMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryIdentificationMessage message) -{ - // Set initial values of message fields - message->queryField = newJausByte(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->queryField, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->queryField, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryIdentificationMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryIdentificationMessage queryIdentificationMessageCreate(void) -{ - QueryIdentificationMessage message; - - message = (QueryIdentificationMessage)malloc( sizeof(QueryIdentificationMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryIdentificationMessageDestroy(QueryIdentificationMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryIdentificationMessageFromBuffer(QueryIdentificationMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryIdentificationMessageToBuffer(QueryIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryIdentificationMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryIdentificationBuffer failed - } - } -} - -QueryIdentificationMessage queryIdentificationMessageFromJausMessage(JausMessage jausMessage) -{ - QueryIdentificationMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryIdentificationMessage)malloc( sizeof(QueryIdentificationMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryIdentificationMessageToJausMessage(QueryIdentificationMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryIdentificationMessageSize(QueryIdentificationMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryIdentificationMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/dynamicConfiguration/queryServicesMessage.c b/lib/openjaus/libjaus/src/message/query/dynamicConfiguration/queryServicesMessage.c deleted file mode 100644 index 0cb256c617b609ff882dd651498eb925373463f4..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/dynamicConfiguration/queryServicesMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryServicesMessage.c -// -// Written By: Bob Toucthon, inspired by Danny Kent -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// This file defines the functionality of a QueryServicesMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_SERVICES; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryServicesMessage message); -static void dataDestroy(QueryServicesMessage message); -static unsigned int dataSize(QueryServicesMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryServicesMessage message) -{ - // Set initial values of message fields - // No Fields -} - -static void dataDestroy(QueryServicesMessage message) -{ - // Do Nothing -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Fields - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // No Fields - } - - return index; -} - -static unsigned int dataSize(QueryServicesMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryServicesMessage queryServicesMessageCreate(void) -{ - QueryServicesMessage message; - - message = (QueryServicesMessage)malloc( sizeof(QueryServicesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryServicesMessageDestroy(QueryServicesMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryServicesMessageFromBuffer(QueryServicesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryServicesMessageToBuffer(QueryServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryServicesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryServicesBuffer failed - } - } -} - -QueryServicesMessage queryServicesMessageFromJausMessage(JausMessage jausMessage) -{ - QueryServicesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryServicesMessage)malloc( sizeof(QueryServicesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryServicesMessageToJausMessage(QueryServicesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryServicesMessageSize(QueryServicesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryServicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/dynamicConfiguration/querySubsystemListMessage.c b/lib/openjaus/libjaus/src/message/query/dynamicConfiguration/querySubsystemListMessage.c deleted file mode 100644 index f13ad94bc38c046eb85d7d8546bb3a00bc9128f3..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/dynamicConfiguration/querySubsystemListMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: querySubsystemListMessage.c -// -// Written By: Bob Toucthon, inspired by Danny Kent -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// This file defines the functionality of a QuerySubsystemListMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_SUBSYSTEM_LIST; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QuerySubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QuerySubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QuerySubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QuerySubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QuerySubsystemListMessage message); -static void dataDestroy(QuerySubsystemListMessage message); -static unsigned int dataSize(QuerySubsystemListMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QuerySubsystemListMessage message) -{ - // Set initial values of message fields - // No Fields -} - -static void dataDestroy(QuerySubsystemListMessage message) -{ - // Do Nothing -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QuerySubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Fields - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QuerySubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // No Fields - } - - return index; -} - -static unsigned int dataSize(QuerySubsystemListMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QuerySubsystemListMessage querySubsystemListMessageCreate(void) -{ - QuerySubsystemListMessage message; - - message = (QuerySubsystemListMessage)malloc( sizeof(QuerySubsystemListMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void querySubsystemListMessageDestroy(QuerySubsystemListMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean querySubsystemListMessageFromBuffer(QuerySubsystemListMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean querySubsystemListMessageToBuffer(QuerySubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < querySubsystemListMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQuerySubsystemListBuffer failed - } - } -} - -QuerySubsystemListMessage querySubsystemListMessageFromJausMessage(JausMessage jausMessage) -{ - QuerySubsystemListMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QuerySubsystemListMessage)malloc( sizeof(QuerySubsystemListMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage querySubsystemListMessageToJausMessage(QuerySubsystemListMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int querySubsystemListMessageSize(QuerySubsystemListMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QuerySubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QuerySubsystemListMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/environment/queryCameraCapabilitiesMessage.c b/lib/openjaus/libjaus/src/message/query/environment/queryCameraCapabilitiesMessage.c deleted file mode 100644 index 5c3d1a460658e8db859ee321872c7b99903a54f6..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/environment/queryCameraCapabilitiesMessage.c +++ /dev/null @@ -1,363 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryCameraCapabilitiesMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryCameraCapabilitiesMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_CAMERA_CAPABILITIES; -static const int maxDataSizeBytes = 3; - -static JausBoolean headerFromBuffer(QueryCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryCameraCapabilitiesMessage message); -static void dataDestroy(QueryCameraCapabilitiesMessage message); -static unsigned int dataSize(QueryCameraCapabilitiesMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryCameraCapabilitiesMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); - message->cameraID = newJausByte(0); -} - -// Destructs the message-specific fields -static void dataDestroy(QueryCameraCapabilitiesMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteToBuffer(message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryCameraCapabilitiesMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryCameraCapabilitiesMessage queryCameraCapabilitiesMessageCreate(void) -{ - QueryCameraCapabilitiesMessage message; - - message = (QueryCameraCapabilitiesMessage)malloc( sizeof(QueryCameraCapabilitiesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryCameraCapabilitiesMessageDestroy(QueryCameraCapabilitiesMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryCameraCapabilitiesMessageFromBuffer(QueryCameraCapabilitiesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryCameraCapabilitiesMessageToBuffer(QueryCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryCameraCapabilitiesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryCameraCapabilitiesBuffer failed - } - } -} - -QueryCameraCapabilitiesMessage queryCameraCapabilitiesMessageFromJausMessage(JausMessage jausMessage) -{ - QueryCameraCapabilitiesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryCameraCapabilitiesMessage)malloc( sizeof(QueryCameraCapabilitiesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryCameraCapabilitiesMessageToJausMessage(QueryCameraCapabilitiesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryCameraCapabilitiesMessageSize(QueryCameraCapabilitiesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryCameraCapabilitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/environment/queryCameraCountMessage.c b/lib/openjaus/libjaus/src/message/query/environment/queryCameraCountMessage.c deleted file mode 100644 index dc4114d4bc31f5a35f9752e36ef2d58e9535a1e9..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/environment/queryCameraCountMessage.c +++ /dev/null @@ -1,348 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryCameraCountMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryCameraCountMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_CAMERA_COUNT; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryCameraCountMessage message); -static void dataDestroy(QueryCameraCountMessage message); -static unsigned int dataSize(QueryCameraCountMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryCameraCountMessage message) -{ - // Set initial values of message fields -} - -// Destructs the message-specific fields -static void dataDestroy(QueryCameraCountMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Data - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryCameraCountMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryCameraCountMessage queryCameraCountMessageCreate(void) -{ - QueryCameraCountMessage message; - - message = (QueryCameraCountMessage)malloc( sizeof(QueryCameraCountMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryCameraCountMessageDestroy(QueryCameraCountMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryCameraCountMessageFromBuffer(QueryCameraCountMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryCameraCountMessageToBuffer(QueryCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryCameraCountMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryCameraCountBuffer failed - } - } -} - -QueryCameraCountMessage queryCameraCountMessageFromJausMessage(JausMessage jausMessage) -{ - QueryCameraCountMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryCameraCountMessage)malloc( sizeof(QueryCameraCountMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryCameraCountMessageToJausMessage(QueryCameraCountMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryCameraCountMessageSize(QueryCameraCountMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryCameraCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/environment/queryCameraFormatOptionsMessage.c b/lib/openjaus/libjaus/src/message/query/environment/queryCameraFormatOptionsMessage.c deleted file mode 100644 index 9988cb907a7c31851b8eefff31571a0a91824b87..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/environment/queryCameraFormatOptionsMessage.c +++ /dev/null @@ -1,362 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryCameraFormatOptionsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryCameraFormatOptionsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_CAMERA_FORMAT_OPTIONS; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(QueryCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryCameraFormatOptionsMessage message); -static void dataDestroy(QueryCameraFormatOptionsMessage message); -static unsigned int dataSize(QueryCameraFormatOptionsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryCameraFormatOptionsMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->cameraID = newJausByte(0); -} - -// Destructs the message-specific fields -static void dataDestroy(QueryCameraFormatOptionsMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryCameraFormatOptionsMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryCameraFormatOptionsMessage queryCameraFormatOptionsMessageCreate(void) -{ - QueryCameraFormatOptionsMessage message; - - message = (QueryCameraFormatOptionsMessage)malloc( sizeof(QueryCameraFormatOptionsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryCameraFormatOptionsMessageDestroy(QueryCameraFormatOptionsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryCameraFormatOptionsMessageFromBuffer(QueryCameraFormatOptionsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryCameraFormatOptionsMessageToBuffer(QueryCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryCameraFormatOptionsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryCameraFormatOptionsBuffer failed - } - } -} - -QueryCameraFormatOptionsMessage queryCameraFormatOptionsMessageFromJausMessage(JausMessage jausMessage) -{ - QueryCameraFormatOptionsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryCameraFormatOptionsMessage)malloc( sizeof(QueryCameraFormatOptionsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryCameraFormatOptionsMessageToJausMessage(QueryCameraFormatOptionsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryCameraFormatOptionsMessageSize(QueryCameraFormatOptionsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryCameraFormatOptionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/environment/queryCameraPoseMessage.c b/lib/openjaus/libjaus/src/message/query/environment/queryCameraPoseMessage.c deleted file mode 100644 index b69962a430cf13b568119f7d65a3430d3389f6d9..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/environment/queryCameraPoseMessage.c +++ /dev/null @@ -1,362 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryCameraPoseMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryCameraPoseMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_CAMERA_POSE; -static const int maxDataSizeBytes = 3; - -static JausBoolean headerFromBuffer(QueryCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryCameraPoseMessage message); -static void dataDestroy(QueryCameraPoseMessage message); -static unsigned int dataSize(QueryCameraPoseMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryCameraPoseMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); - message->cameraID = newJausByte(0); -} - -// Destructs the message-specific fields -static void dataDestroy(QueryCameraPoseMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteToBuffer(message->cameraID, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryCameraPoseMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryCameraPoseMessage queryCameraPoseMessageCreate(void) -{ - QueryCameraPoseMessage message; - - message = (QueryCameraPoseMessage)malloc( sizeof(QueryCameraPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryCameraPoseMessageDestroy(QueryCameraPoseMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryCameraPoseMessageFromBuffer(QueryCameraPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryCameraPoseMessageToBuffer(QueryCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryCameraPoseMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryCameraPoseBuffer failed - } - } -} - -QueryCameraPoseMessage queryCameraPoseMessageFromJausMessage(JausMessage jausMessage) -{ - QueryCameraPoseMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryCameraPoseMessage)malloc( sizeof(QueryCameraPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryCameraPoseMessageToJausMessage(QueryCameraPoseMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryCameraPoseMessageSize(QueryCameraPoseMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryCameraPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/environment/queryImageMessage.c b/lib/openjaus/libjaus/src/message/query/environment/queryImageMessage.c deleted file mode 100644 index 43bb9c317a76ae686fc9f5ec8ee885618e5777d7..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/environment/queryImageMessage.c +++ /dev/null @@ -1,351 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryImageMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryImageMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_IMAGE; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryImageMessage message); -static void dataDestroy(QueryImageMessage message); -static unsigned int dataSize(QueryImageMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryImageMessage message) -{ - // Set initial values of message fields -} - -// Destructs the message-specific fields -static void dataDestroy(QueryImageMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - //int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - } - - return index; -} - -static unsigned int dataSize(QueryImageMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryImageMessage queryImageMessageCreate(void) -{ - QueryImageMessage message; - - message = (QueryImageMessage)malloc( sizeof(QueryImageMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryImageMessageDestroy(QueryImageMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryImageMessageFromBuffer(QueryImageMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryImageMessageToBuffer(QueryImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryImageMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryImageBuffer failed - } - } -} - -QueryImageMessage queryImageMessageFromJausMessage(JausMessage jausMessage) -{ - QueryImageMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryImageMessage)malloc( sizeof(QueryImageMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryImageMessageToJausMessage(QueryImageMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryImageMessageSize(QueryImageMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryImageMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/environment/queryRelativeObjectPositionMessage.c b/lib/openjaus/libjaus/src/message/query/environment/queryRelativeObjectPositionMessage.c deleted file mode 100644 index 7810eb3b3027b3a2f5195d4dc4ccda451bccd523..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/environment/queryRelativeObjectPositionMessage.c +++ /dev/null @@ -1,357 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryRelativeObjectPositionMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryRelativeObjectPositionMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_RELATIVE_OBJECT_POSITION; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(QueryRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryRelativeObjectPositionMessage message); -static void dataDestroy(QueryRelativeObjectPositionMessage message); -static unsigned int dataSize(QueryRelativeObjectPositionMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryRelativeObjectPositionMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); -} - -// Destructs the message-specific fields -static void dataDestroy(QueryRelativeObjectPositionMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryRelativeObjectPositionMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryRelativeObjectPositionMessage queryRelativeObjectPositionMessageCreate(void) -{ - QueryRelativeObjectPositionMessage message; - - message = (QueryRelativeObjectPositionMessage)malloc( sizeof(QueryRelativeObjectPositionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryRelativeObjectPositionMessageDestroy(QueryRelativeObjectPositionMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryRelativeObjectPositionMessageFromBuffer(QueryRelativeObjectPositionMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryRelativeObjectPositionMessageToBuffer(QueryRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryRelativeObjectPositionMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryRelativeObjectPositionBuffer failed - } - } -} - -QueryRelativeObjectPositionMessage queryRelativeObjectPositionMessageFromJausMessage(JausMessage jausMessage) -{ - QueryRelativeObjectPositionMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryRelativeObjectPositionMessage)malloc( sizeof(QueryRelativeObjectPositionMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryRelativeObjectPositionMessageToJausMessage(QueryRelativeObjectPositionMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryRelativeObjectPositionMessageSize(QueryRelativeObjectPositionMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryRelativeObjectPositionMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/environment/querySelectedCameraMessage.c b/lib/openjaus/libjaus/src/message/query/environment/querySelectedCameraMessage.c deleted file mode 100644 index a604f74cd5cbbed4d2d634ccac2d852399b7c771..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/environment/querySelectedCameraMessage.c +++ /dev/null @@ -1,348 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: querySelectedCameraMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QuerySelectedCameraMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_SELECTED_CAMERA; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QuerySelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QuerySelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QuerySelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QuerySelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QuerySelectedCameraMessage message); -static void dataDestroy(QuerySelectedCameraMessage message); -static unsigned int dataSize(QuerySelectedCameraMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QuerySelectedCameraMessage message) -{ - // Set initial values of message fields - // No Data -} - -// Destructs the message-specific fields -static void dataDestroy(QuerySelectedCameraMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QuerySelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes == message->dataSize) - { - // No Data - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QuerySelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // No Data - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QuerySelectedCameraMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QuerySelectedCameraMessage querySelectedCameraMessageCreate(void) -{ - QuerySelectedCameraMessage message; - - message = (QuerySelectedCameraMessage)malloc( sizeof(QuerySelectedCameraMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void querySelectedCameraMessageDestroy(QuerySelectedCameraMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean querySelectedCameraMessageFromBuffer(QuerySelectedCameraMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean querySelectedCameraMessageToBuffer(QuerySelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < querySelectedCameraMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQuerySelectedCameraBuffer failed - } - } -} - -QuerySelectedCameraMessage querySelectedCameraMessageFromJausMessage(JausMessage jausMessage) -{ - QuerySelectedCameraMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QuerySelectedCameraMessage)malloc( sizeof(QuerySelectedCameraMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage querySelectedCameraMessageToJausMessage(QuerySelectedCameraMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int querySelectedCameraMessageSize(QuerySelectedCameraMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QuerySelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QuerySelectedCameraMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/event/queryEventsMessage.c b/lib/openjaus/libjaus/src/message/query/event/queryEventsMessage.c deleted file mode 100644 index dfbf0f3cafb0e8aa7ba8679ae83c9f14ba14618e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/event/queryEventsMessage.c +++ /dev/null @@ -1,420 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryEventsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryEventsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_EVENTS; -static const int maxDataSizeBytes = 5; - -static JausBoolean headerFromBuffer(QueryEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryEventsMessage message); -static void dataDestroy(QueryEventsMessage message); -static unsigned int dataSize(QueryEventsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryEventsMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->messageCode = newJausUnsignedShort(0); - message->eventType = newJausByte(0); - message->eventId = newJausByte(0); -} - -// Destructs the message-specific fields -static void dataDestroy(QueryEventsMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, QUERY_EVENTS_PV_MESSAGE_CODE_BIT)) - { - // Message Code - if(!jausUnsignedShortFromBuffer(&message->messageCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, QUERY_EVENTS_PV_EVENT_TYPE_BIT)) - { - // Event Type - if(!jausByteFromBuffer(&message->eventType, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, QUERY_EVENTS_PV_EVENT_ID_BIT)) - { - // Event Id - if(!jausByteFromBuffer(&message->eventId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, QUERY_EVENTS_PV_MESSAGE_CODE_BIT)) - { - // Message Code - if(!jausUnsignedShortToBuffer(message->messageCode, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, QUERY_EVENTS_PV_EVENT_TYPE_BIT)) - { - // Event Type - if(!jausByteToBuffer(message->eventType, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, QUERY_EVENTS_PV_EVENT_ID_BIT)) - { - // Event Id - if(!jausByteToBuffer(message->eventId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - } - - return index; -} - -static unsigned int dataSize(QueryEventsMessage message) -{ - int size = 0; - - size += JAUS_BYTE_SIZE_BYTES; - - if(jausByteIsBitSet(message->presenceVector, QUERY_EVENTS_PV_MESSAGE_CODE_BIT)) - { - size += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, QUERY_EVENTS_PV_EVENT_TYPE_BIT)) - { - size += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, QUERY_EVENTS_PV_EVENT_ID_BIT)) - { - size += JAUS_BYTE_SIZE_BYTES; - } - - // Constant Size - return size; -} - - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryEventsMessage queryEventsMessageCreate(void) -{ - QueryEventsMessage message; - - message = (QueryEventsMessage)malloc( sizeof(QueryEventsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryEventsMessageDestroy(QueryEventsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryEventsMessageFromBuffer(QueryEventsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryEventsMessageToBuffer(QueryEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryEventsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryEventsBuffer failed - } - } -} - -QueryEventsMessage queryEventsMessageFromJausMessage(JausMessage jausMessage) -{ - QueryEventsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryEventsMessage)malloc( sizeof(QueryEventsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryEventsMessageToJausMessage(QueryEventsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryEventsMessageSize(QueryEventsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryEventsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/manipulator/queryJointEffortsMessage.c b/lib/openjaus/libjaus/src/message/query/manipulator/queryJointEffortsMessage.c deleted file mode 100644 index 1813e90294db8d5d33cfcfb297282dfc87866ac6..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/manipulator/queryJointEffortsMessage.c +++ /dev/null @@ -1,348 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryJointEffortsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryJointEffortsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_JOINT_EFFORTS; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryJointEffortsMessage message); -static void dataDestroy(QueryJointEffortsMessage message); -static unsigned int dataSize(QueryJointEffortsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryJointEffortsMessage message) -{ - -} - -// Destructs the message-specific fields -static void dataDestroy(QueryJointEffortsMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryJointEffortsMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryJointEffortsMessage queryJointEffortsMessageCreate(void) -{ - QueryJointEffortsMessage message; - - message = (QueryJointEffortsMessage)malloc( sizeof(QueryJointEffortsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryJointEffortsMessageDestroy(QueryJointEffortsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryJointEffortsMessageFromBuffer(QueryJointEffortsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryJointEffortsMessageToBuffer(QueryJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryJointEffortsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryJointEffortsBuffer failed - } - } -} - -QueryJointEffortsMessage queryJointEffortsMessageFromJausMessage(JausMessage jausMessage) -{ - QueryJointEffortsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryJointEffortsMessage)malloc( sizeof(QueryJointEffortsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryJointEffortsMessageToJausMessage(QueryJointEffortsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryJointEffortsMessageSize(QueryJointEffortsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryJointEffortsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/manipulator/queryJointForceTorquesMessage.c b/lib/openjaus/libjaus/src/message/query/manipulator/queryJointForceTorquesMessage.c deleted file mode 100644 index e190acf655b466290435d3dd00da9d459e82153f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/manipulator/queryJointForceTorquesMessage.c +++ /dev/null @@ -1,350 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryJointForceTorquesMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryJointForceTorquesMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_JOINT_FORCE_TORQUES; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryJointForceTorquesMessage message); -static void dataDestroy(QueryJointForceTorquesMessage message); -static unsigned int dataSize(QueryJointForceTorquesMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryJointForceTorquesMessage message) -{ - // Set initial values of message fields - -} - -// Destructs the message-specific fields -static void dataDestroy(QueryJointForceTorquesMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryJointForceTorquesMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryJointForceTorquesMessage queryJointForceTorquesMessageCreate(void) -{ - QueryJointForceTorquesMessage message; - - message = (QueryJointForceTorquesMessage)malloc( sizeof(QueryJointForceTorquesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryJointForceTorquesMessageDestroy(QueryJointForceTorquesMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryJointForceTorquesMessageFromBuffer(QueryJointForceTorquesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryJointForceTorquesMessageToBuffer(QueryJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryJointForceTorquesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryJointForceTorquesBuffer failed - } - } -} - -QueryJointForceTorquesMessage queryJointForceTorquesMessageFromJausMessage(JausMessage jausMessage) -{ - QueryJointForceTorquesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryJointForceTorquesMessage)malloc( sizeof(QueryJointForceTorquesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryJointForceTorquesMessageToJausMessage(QueryJointForceTorquesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryJointForceTorquesMessageSize(QueryJointForceTorquesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryJointForceTorquesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/manipulator/queryJointPositionsMessage.c b/lib/openjaus/libjaus/src/message/query/manipulator/queryJointPositionsMessage.c deleted file mode 100644 index 8f6c8ff32ebf35b94f5f48dd54e4d76698de0df3..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/manipulator/queryJointPositionsMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryJointPositionsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryJointPositionsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_JOINT_POSITIONS; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryJointPositionsMessage message); -static void dataDestroy(QueryJointPositionsMessage message); -static unsigned int dataSize(QueryJointPositionsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryJointPositionsMessage message) -{ - // Set initial values of message fields -} - -// Destructs the message-specific fields -static void dataDestroy(QueryJointPositionsMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryJointPositionsMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryJointPositionsMessage queryJointPositionsMessageCreate(void) -{ - QueryJointPositionsMessage message; - - message = (QueryJointPositionsMessage)malloc( sizeof(QueryJointPositionsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryJointPositionsMessageDestroy(QueryJointPositionsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryJointPositionsMessageFromBuffer(QueryJointPositionsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryJointPositionsMessageToBuffer(QueryJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryJointPositionsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryJointPositionsBuffer failed - } - } -} - -QueryJointPositionsMessage queryJointPositionsMessageFromJausMessage(JausMessage jausMessage) -{ - QueryJointPositionsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryJointPositionsMessage)malloc( sizeof(QueryJointPositionsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryJointPositionsMessageToJausMessage(QueryJointPositionsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryJointPositionsMessageSize(QueryJointPositionsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryJointPositionsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/manipulator/queryJointVelocitiesMessage.c b/lib/openjaus/libjaus/src/message/query/manipulator/queryJointVelocitiesMessage.c deleted file mode 100644 index b4540cddfb210b884c329aa94138e6d1ea4051f7..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/manipulator/queryJointVelocitiesMessage.c +++ /dev/null @@ -1,350 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryJointVelocitiesMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryJointVelocitiesMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_JOINT_VELOCITIES; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryJointVelocitiesMessage message); -static void dataDestroy(QueryJointVelocitiesMessage message); -static unsigned int dataSize(QueryJointVelocitiesMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryJointVelocitiesMessage message) -{ - // Set initial values of message fields - -} - -// Destructs the message-specific fields -static void dataDestroy(QueryJointVelocitiesMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryJointVelocitiesMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryJointVelocitiesMessage queryJointVelocitiesMessageCreate(void) -{ - QueryJointVelocitiesMessage message; - - message = (QueryJointVelocitiesMessage)malloc( sizeof(QueryJointVelocitiesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryJointVelocitiesMessageDestroy(QueryJointVelocitiesMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryJointVelocitiesMessageFromBuffer(QueryJointVelocitiesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryJointVelocitiesMessageToBuffer(QueryJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryJointVelocitiesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryJointVelocitiesBuffer failed - } - } -} - -QueryJointVelocitiesMessage queryJointVelocitiesMessageFromJausMessage(JausMessage jausMessage) -{ - QueryJointVelocitiesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryJointVelocitiesMessage)malloc( sizeof(QueryJointVelocitiesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryJointVelocitiesMessageToJausMessage(QueryJointVelocitiesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryJointVelocitiesMessageSize(QueryJointVelocitiesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryJointVelocitiesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/manipulator/queryManipulatorSpecificationsMessage.c b/lib/openjaus/libjaus/src/message/query/manipulator/queryManipulatorSpecificationsMessage.c deleted file mode 100644 index 3be049c93b8c0483f6d010db002cb94cd471fb4f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/manipulator/queryManipulatorSpecificationsMessage.c +++ /dev/null @@ -1,350 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryManipulatorSpecificationsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryManipulatorSpecificationsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_MANIPULATOR_SPECIFICATIONS; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryManipulatorSpecificationsMessage message); -static void dataDestroy(QueryManipulatorSpecificationsMessage message); -static unsigned int dataSize(QueryManipulatorSpecificationsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryManipulatorSpecificationsMessage message) -{ - // Set initial values of message fields - -} - -// Destructs the message-specific fields -static void dataDestroy(QueryManipulatorSpecificationsMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryManipulatorSpecificationsMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryManipulatorSpecificationsMessage queryManipulatorSpecificationsMessageCreate(void) -{ - QueryManipulatorSpecificationsMessage message; - - message = (QueryManipulatorSpecificationsMessage)malloc( sizeof(QueryManipulatorSpecificationsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryManipulatorSpecificationsMessageDestroy(QueryManipulatorSpecificationsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryManipulatorSpecificationsMessageFromBuffer(QueryManipulatorSpecificationsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryManipulatorSpecificationsMessageToBuffer(QueryManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryManipulatorSpecificationsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryManipulatorSpecificationsBuffer failed - } - } -} - -QueryManipulatorSpecificationsMessage queryManipulatorSpecificationsMessageFromJausMessage(JausMessage jausMessage) -{ - QueryManipulatorSpecificationsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryManipulatorSpecificationsMessage)malloc( sizeof(QueryManipulatorSpecificationsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryManipulatorSpecificationsMessageToJausMessage(QueryManipulatorSpecificationsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryManipulatorSpecificationsMessageSize(QueryManipulatorSpecificationsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryManipulatorSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/manipulator/queryToolPointMessage.c b/lib/openjaus/libjaus/src/message/query/manipulator/queryToolPointMessage.c deleted file mode 100644 index a5a2f38dc8ece77a5d4c4158ac3b81242e5356c1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/manipulator/queryToolPointMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryToolPointMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryToolPointMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_TOOL_POINT; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryToolPointMessage message); -static void dataDestroy(QueryToolPointMessage message); -static unsigned int dataSize(QueryToolPointMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryToolPointMessage message) -{ - // Set initial values of message fields -} - -// Destructs the message-specific fields -static void dataDestroy(QueryToolPointMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryToolPointMessage message) -{ - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryToolPointMessage queryToolPointMessageCreate(void) -{ - QueryToolPointMessage message; - - message = (QueryToolPointMessage)malloc( sizeof(QueryToolPointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryToolPointMessageDestroy(QueryToolPointMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryToolPointMessageFromBuffer(QueryToolPointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryToolPointMessageToBuffer(QueryToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryToolPointMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryToolPointBuffer failed - } - } -} - -QueryToolPointMessage queryToolPointMessageFromJausMessage(JausMessage jausMessage) -{ - QueryToolPointMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryToolPointMessage)malloc( sizeof(QueryToolPointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryToolPointMessageToJausMessage(QueryToolPointMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryToolPointMessageSize(QueryToolPointMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryToolPointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/payload/queryPayloadDataElementMessage.c b/lib/openjaus/libjaus/src/message/query/payload/queryPayloadDataElementMessage.c deleted file mode 100644 index d16364a321337931acca8aefe865c399ad0cdfa2..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/payload/queryPayloadDataElementMessage.c +++ /dev/null @@ -1,419 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryPayloadDataElementMessage.c -// -// Written By: Bob Toucthon -// -// Version: 3.3.0a -// -// Date: // Date: 3/27/06 -// -// This file defines the functionality of a queryPayloadDataElementMessage -// NOTE WELL: this message will also be used for general purpose information exchange - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_PAYLOAD_DATA_ELEMENT; -static const int maxDataSizeBytes = 512000; - -static JausBoolean headerFromBuffer(QueryPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryPayloadDataElementMessage message); -static void dataDestroy(QueryPayloadDataElementMessage message); -static unsigned int dataSize(QueryPayloadDataElementMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryPayloadDataElementMessage message) -{ - // Set initial values of message fields - message->jausPayloadInterface = NULL; - message->numberInterfaces = 0; - message->indexes = NULL; -} - -// Destructs the message-specific fields -static void dataDestroy(QueryPayloadDataElementMessage message) -{ - // Free message fields - if(!message->indexes) free(message->indexes); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0, i = 0; - JausByte payloadInformationDataElementCount = 0; - JausByte informationInterfaceNumber; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // # payload interfaces - if(!jausByteFromBuffer(&payloadInformationDataElementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - message->numberInterfaces = payloadInformationDataElementCount; - message->indexes = NULL; - - if(!payloadInformationDataElementCount) return JAUS_TRUE; // nothing to do - - message->indexes = (int *)malloc(payloadInformationDataElementCount * sizeof(int)); - - for(i = 0; i < payloadInformationDataElementCount; i++) - { - // unpack payloadDataElement Index number (indexing starts at 1) - if(!jausByteFromBuffer(&informationInterfaceNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - message->indexes[i] = informationInterfaceNumber; - } - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i = 0; - JausByte payloadInformationDataElementCount = 0; - int informationInterfaceNumber = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // # payload interfaces - payloadInformationDataElementCount = message->numberInterfaces; - - if(!jausByteToBuffer(payloadInformationDataElementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i = 0; i < payloadInformationDataElementCount; i++) - { - // get payloadDataElement identifier - // get/pack payloadDataElement index - - informationInterfaceNumber = message->indexes[i]; - if(message->jausPayloadInterface && (message->jausPayloadInterface->jausInformationInterfaces->elementCount >= informationInterfaceNumber) ) - { - if(!jausByteToBuffer(informationInterfaceNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - else return JAUS_FALSE; - } - } - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryPayloadDataElementMessage message) -{ - int index = 0; - int i = 0; - int informationInterfaceNumber = 0; - JausByte payloadInformationDataElementCount = 0; - - // # payload interfaces - payloadInformationDataElementCount = message->numberInterfaces; - - index += JAUS_BYTE_SIZE_BYTES; - - for(i = 0; i < payloadInformationDataElementCount; i++) - { - informationInterfaceNumber = message->indexes[i]; - if(message->jausPayloadInterface && (message->jausPayloadInterface->jausInformationInterfaces->elementCount >= informationInterfaceNumber) ) - { - index += JAUS_BYTE_SIZE_BYTES; - } - else - { - return 0; - } - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryPayloadDataElementMessage queryPayloadDataElementMessageCreate(void) -{ - QueryPayloadDataElementMessage message; - - message = (QueryPayloadDataElementMessage)malloc( sizeof(QueryPayloadDataElementMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryPayloadDataElementMessageDestroy(QueryPayloadDataElementMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryPayloadDataElementMessageFromBuffer(QueryPayloadDataElementMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryPayloadDataElementMessageToBuffer(QueryPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryPayloadDataElementMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryPayloadDataElementBuffer failed - } - } -} - -QueryPayloadDataElementMessage queryPayloadDataElementMessageFromJausMessage(JausMessage jausMessage) -{ - QueryPayloadDataElementMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryPayloadDataElementMessage)malloc( sizeof(QueryPayloadDataElementMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryPayloadDataElementMessageToJausMessage(QueryPayloadDataElementMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryPayloadDataElementMessageSize(QueryPayloadDataElementMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryPayloadDataElementMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - //JausUnsignedShort *propertiesPtr = (JausUnsignedShort *) &message->properties; - unsigned short *propertiesPtr = (unsigned short *) &message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/payload/queryPayloadInterfaceMessage.c b/lib/openjaus/libjaus/src/message/query/payload/queryPayloadInterfaceMessage.c deleted file mode 100644 index 74a43fd1797ef19df3caa42f4687300ae551d710..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/payload/queryPayloadInterfaceMessage.c +++ /dev/null @@ -1,342 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryPayloadInterfaceMessage.c -// -// Written By: Bob Toucthon, inspired by Danny Kent -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// This file defines the functionality of a QueryPayloadInterfaceMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_PAYLOAD_INTERFACE; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryPayloadInterfaceMessage message); -static unsigned int dataSize(QueryPayloadInterfaceMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryPayloadInterfaceMessage message) -{ - // Set initial values of message fields - // No Fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Fields - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // No Fields - } - - return index; -} - -static unsigned int dataSize(QueryPayloadInterfaceMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryPayloadInterfaceMessage queryPayloadInterfaceMessageCreate(void) -{ - QueryPayloadInterfaceMessage message; - - message = (QueryPayloadInterfaceMessage)malloc( sizeof(QueryPayloadInterfaceMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryPayloadInterfaceMessageDestroy(QueryPayloadInterfaceMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryPayloadInterfaceMessageFromBuffer(QueryPayloadInterfaceMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryPayloadInterfaceMessageToBuffer(QueryPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryPayloadInterfaceMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryPayloadInterfaceBuffer failed - } - } -} - -QueryPayloadInterfaceMessage queryPayloadInterfaceMessageFromJausMessage(JausMessage jausMessage) -{ - QueryPayloadInterfaceMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryPayloadInterfaceMessage)malloc( sizeof(QueryPayloadInterfaceMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryPayloadInterfaceMessageToJausMessage(QueryPayloadInterfaceMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryPayloadInterfaceMessageSize(QueryPayloadInterfaceMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryPayloadInterfaceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/planning/queryMissionStatusMessage.c b/lib/openjaus/libjaus/src/message/query/planning/queryMissionStatusMessage.c deleted file mode 100644 index 00509ea3be4a022b35f7fdb367f094bfcaeb0114..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/planning/queryMissionStatusMessage.c +++ /dev/null @@ -1,455 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryMissionStatusMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo -// AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryMissionStatusMessage -// -// Modified by: David M. Plasil (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS: 6/09/08 - - - -#include -#include -#include "jaus.h" - - -#ifndef MISSION_DEFAULT_TYPES -#define DEFAULT_TO_FIRST_MISSION 0 -#define DEFAULT_TO_FIRST_MESSAGE_IN_TASK 0 -#define DEFAULT_TO_MISSION_SPECIFIED 0 -#define DEFAULT_TO_ALL_MISSIONS 0 -#endif - -static const int commandCode = JAUS_QUERY_MISSION_STATUS; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static int dataToBuffer(QueryMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes); -static void dataInitialize(QueryMissionStatusMessage message); -static void dataDestroy(QueryMissionStatusMessage message); -static unsigned int dataSize(QueryMissionStatusMessage message); - -// ************************************************************************* // -// USER CONFIGURED FUNCTIONS -// ************************************************************************* // - - -// Initializes the message-specific fields -static void dataInitialize(QueryMissionStatusMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(DEFAULT_TO_ALL_MISSIONS); - message->type = newJausByte(DEFAULT_TO_ALL_MISSIONS); - message->missionId = newJausUnsignedShort(DEFAULT_TO_FIRST_MISSION); - message->taskId = newJausUnsignedShort(DEFAULT_TO_MISSION_SPECIFIED); - message->taskMsgId = newJausUnsignedShort(DEFAULT_TO_FIRST_MESSAGE_IN_TASK); -} - -// Destructs the message-specific fields -static void dataDestroy(QueryMissionStatusMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->presenceVector, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->type, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->missionId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->taskId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->taskMsgId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->presenceVector, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - - index += JAUS_BYTE_SIZE_BYTES; - if(!jausUnsignedShortToBuffer(message->type, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->missionId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->taskId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->taskMsgId, - buffer+index, - bufferSizeBytes-index)) return JAUS_FALSE; - - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QueryMissionStatusMessage message) -{ - int index = 0; - - index += JAUS_BYTE_SIZE_BYTES; //presenceVector - index += JAUS_BYTE_SIZE_BYTES; //type - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //missionId - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //taskId - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //taskMsgId - - return index; -} - -// ************************************************************************* // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************* // - -QueryMissionStatusMessage queryMissionStatusMessageCreate(void) -{ - QueryMissionStatusMessage message; - - message = (QueryMissionStatusMessage)malloc( sizeof(QueryMissionStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void queryMissionStatusMessageDestroy(QueryMissionStatusMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryMissionStatusMessageFromBuffer(QueryMissionStatusMessage message, - unsigned char* buffer, - unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryMissionStatusMessageToBuffer(QueryMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryMissionStatusMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, - buffer+JAUS_HEADER_SIZE_BYTES, - bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryMissionStatusBuffer failed - } - } -} - -QueryMissionStatusMessage queryMissionStatusMessageFromJausMessage(JausMessage jausMessage) -{ - QueryMissionStatusMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryMissionStatusMessage)malloc( sizeof(QueryMissionStatusMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryMissionStatusMessageToJausMessage(QueryMissionStatusMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, - jausMessage->data, - jausMessage->dataSize); - - return jausMessage; -} - -unsigned int queryMissionStatusMessageSize(QueryMissionStatusMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryMissionStatusMessage message, - unsigned char *buffer, - unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | - (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/planning/querySpoolingPreferenceMessage.c b/lib/openjaus/libjaus/src/message/query/planning/querySpoolingPreferenceMessage.c deleted file mode 100644 index 487e76424d4d823e10909131696478da6ba8b7a5..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/planning/querySpoolingPreferenceMessage.c +++ /dev/null @@ -1,362 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: querySpoolingPreferenceMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QuerySpoolingPreferenceMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_SPOOLING_PREFERENCE; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QuerySpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QuerySpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QuerySpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QuerySpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QuerySpoolingPreferenceMessage message); -static void dataDestroy(QuerySpoolingPreferenceMessage message); -static unsigned int dataSize(QuerySpoolingPreferenceMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QuerySpoolingPreferenceMessage message) -{ - // Set initial values of message fields - // No message fields for this message - -} - -// Destructs the message-specific fields -static void dataDestroy(QuerySpoolingPreferenceMessage message) -{ - // Free message fields - // No message fields for this message -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QuerySpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - // No Message Fields - - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QuerySpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - // No Message Fields - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(QuerySpoolingPreferenceMessage message) -{ - int index = 0; - - //No Message Fields - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QuerySpoolingPreferenceMessage querySpoolingPreferenceMessageCreate(void) -{ - QuerySpoolingPreferenceMessage message; - - message = (QuerySpoolingPreferenceMessage)malloc( sizeof(QuerySpoolingPreferenceMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void querySpoolingPreferenceMessageDestroy(QuerySpoolingPreferenceMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean querySpoolingPreferenceMessageFromBuffer(QuerySpoolingPreferenceMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean querySpoolingPreferenceMessageToBuffer(QuerySpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < querySpoolingPreferenceMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQuerySpoolingPreferenceBuffer failed - } - } -} - -QuerySpoolingPreferenceMessage querySpoolingPreferenceMessageFromJausMessage(JausMessage jausMessage) -{ - QuerySpoolingPreferenceMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QuerySpoolingPreferenceMessage)malloc( sizeof(QuerySpoolingPreferenceMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage querySpoolingPreferenceMessageToJausMessage(QuerySpoolingPreferenceMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int querySpoolingPreferenceMessageSize(QuerySpoolingPreferenceMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QuerySpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QuerySpoolingPreferenceMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryDiscreteDevicesMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryDiscreteDevicesMessage.c deleted file mode 100644 index 3f05a142142555da7fc4bb5ddf8a1b1f6ca83fca..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryDiscreteDevicesMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryDiscreteDevicesMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryDiscreteDevicesMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_DISCRETE_DEVICES; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(QueryDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryDiscreteDevicesMessage message); -static unsigned int dataSize(QueryDiscreteDevicesMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryDiscreteDevicesMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryDiscreteDevicesMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryDiscreteDevicesMessage queryDiscreteDevicesMessageCreate(void) -{ - QueryDiscreteDevicesMessage message; - - message = (QueryDiscreteDevicesMessage)malloc( sizeof(QueryDiscreteDevicesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryDiscreteDevicesMessageDestroy(QueryDiscreteDevicesMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryDiscreteDevicesMessageFromBuffer(QueryDiscreteDevicesMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryDiscreteDevicesMessageToBuffer(QueryDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryDiscreteDevicesMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryDiscreteDevicesBuffer failed - } - } -} - -QueryDiscreteDevicesMessage queryDiscreteDevicesMessageFromJausMessage(JausMessage jausMessage) -{ - QueryDiscreteDevicesMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryDiscreteDevicesMessage)malloc( sizeof(QueryDiscreteDevicesMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryDiscreteDevicesMessageToJausMessage(QueryDiscreteDevicesMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryDiscreteDevicesMessageSize(QueryDiscreteDevicesMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryDiscreteDevicesMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryGlobalPathSegmentMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryGlobalPathSegmentMessage.c deleted file mode 100644 index 6cbf12f90704f8ec62fa96cc9bf6697729f146fb..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryGlobalPathSegmentMessage.c +++ /dev/null @@ -1,356 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryGlobalPathSegmentMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryGlobalPathSegmentMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_GLOBAL_PATH_SEGMENT; -static const int maxDataSizeBytes = 3; - -static JausBoolean headerFromBuffer(QueryGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryGlobalPathSegmentMessage message); -static unsigned int dataSize(QueryGlobalPathSegmentMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryGlobalPathSegmentMessage message) -{ - // Set initial values of message fields - message->pathSegmentNumber = newJausUnsignedShort(0); - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->pathSegmentNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->pathSegmentNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryGlobalPathSegmentMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryGlobalPathSegmentMessage queryGlobalPathSegmentMessageCreate(void) -{ - QueryGlobalPathSegmentMessage message; - - message = (QueryGlobalPathSegmentMessage)malloc( sizeof(QueryGlobalPathSegmentMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryGlobalPathSegmentMessageDestroy(QueryGlobalPathSegmentMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryGlobalPathSegmentMessageFromBuffer(QueryGlobalPathSegmentMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryGlobalPathSegmentMessageToBuffer(QueryGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryGlobalPathSegmentMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryGlobalPathSegmentBuffer failed - } - } -} - -QueryGlobalPathSegmentMessage queryGlobalPathSegmentMessageFromJausMessage(JausMessage jausMessage) -{ - QueryGlobalPathSegmentMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryGlobalPathSegmentMessage)malloc( sizeof(QueryGlobalPathSegmentMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryGlobalPathSegmentMessageToJausMessage(QueryGlobalPathSegmentMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryGlobalPathSegmentMessageSize(QueryGlobalPathSegmentMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryGlobalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryGlobalPoseMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryGlobalPoseMessage.c deleted file mode 100644 index ba1eb99e47e3a901c20e1f3a9786f6ce73a93a4b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryGlobalPoseMessage.c +++ /dev/null @@ -1,347 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryGlobalPoseMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryGlobalPoseMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_GLOBAL_POSE; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(QueryGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryGlobalPoseMessage message); -static unsigned int dataSize(QueryGlobalPoseMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryGlobalPoseMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryGlobalPoseMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryGlobalPoseMessage queryGlobalPoseMessageCreate(void) -{ - QueryGlobalPoseMessage message; - - message = (QueryGlobalPoseMessage)malloc( sizeof(QueryGlobalPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryGlobalPoseMessageDestroy(QueryGlobalPoseMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryGlobalPoseMessageFromBuffer(QueryGlobalPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryGlobalPoseMessageToBuffer(QueryGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryGlobalPoseMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryGlobalPoseBuffer failed - } - } -} - -QueryGlobalPoseMessage queryGlobalPoseMessageFromJausMessage(JausMessage jausMessage) -{ - QueryGlobalPoseMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryGlobalPoseMessage)malloc( sizeof(QueryGlobalPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryGlobalPoseMessageToJausMessage(QueryGlobalPoseMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryGlobalPoseMessageSize(QueryGlobalPoseMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryGlobalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryGlobalVectorMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryGlobalVectorMessage.c deleted file mode 100644 index 69e31b2b0bcd0fdf0abb62d5339cf72ea03f279b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryGlobalVectorMessage.c +++ /dev/null @@ -1,348 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryGlobalVectorMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryGlobalVectorMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_GLOBAL_VECTOR; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(QueryGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryGlobalVectorMessage message); -static unsigned int dataSize(QueryGlobalVectorMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryGlobalVectorMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryGlobalVectorMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryGlobalVectorMessage queryGlobalVectorMessageCreate(void) -{ - QueryGlobalVectorMessage message; - - message = (QueryGlobalVectorMessage)malloc( sizeof(QueryGlobalVectorMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryGlobalVectorMessageDestroy(QueryGlobalVectorMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryGlobalVectorMessageFromBuffer(QueryGlobalVectorMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryGlobalVectorMessageToBuffer(QueryGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryGlobalVectorMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryGlobalVectorBuffer failed - } - } -} - -QueryGlobalVectorMessage queryGlobalVectorMessageFromJausMessage(JausMessage jausMessage) -{ - QueryGlobalVectorMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryGlobalVectorMessage)malloc( sizeof(QueryGlobalVectorMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryGlobalVectorMessageToJausMessage(QueryGlobalVectorMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryGlobalVectorMessageSize(QueryGlobalVectorMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryGlobalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryGlobalWaypointMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryGlobalWaypointMessage.c deleted file mode 100644 index 6ca22f32f038c4bc23913a56308b4579634847bd..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryGlobalWaypointMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryGlobalWaypointMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryGlobalWaypointMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_GLOBAL_WAYPOINT; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(QueryGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryGlobalWaypointMessage message); -static unsigned int dataSize(QueryGlobalWaypointMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryGlobalWaypointMessage message) -{ - // Set initial values of message fields - message->waypointNumber = newJausUnsignedShort(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->waypointNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->waypointNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryGlobalWaypointMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryGlobalWaypointMessage queryGlobalWaypointMessageCreate(void) -{ - QueryGlobalWaypointMessage message; - - message = (QueryGlobalWaypointMessage)malloc( sizeof(QueryGlobalWaypointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryGlobalWaypointMessageDestroy(QueryGlobalWaypointMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryGlobalWaypointMessageFromBuffer(QueryGlobalWaypointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryGlobalWaypointMessageToBuffer(QueryGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryGlobalWaypointMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryGlobalWaypointBuffer failed - } - } -} - -QueryGlobalWaypointMessage queryGlobalWaypointMessageFromJausMessage(JausMessage jausMessage) -{ - QueryGlobalWaypointMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryGlobalWaypointMessage)malloc( sizeof(QueryGlobalWaypointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryGlobalWaypointMessageToJausMessage(QueryGlobalWaypointMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryGlobalWaypointMessageSize(QueryGlobalWaypointMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryGlobalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryLocalPathSegmentMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryLocalPathSegmentMessage.c deleted file mode 100644 index 0ce937dcc86d838a9a1520661303dd36e45c6256..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryLocalPathSegmentMessage.c +++ /dev/null @@ -1,356 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryLocalPathSegmentMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryLocalPathSegmentMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_LOCAL_PATH_SEGMENT; -static const int maxDataSizeBytes = 3; - -static JausBoolean headerFromBuffer(QueryLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryLocalPathSegmentMessage message); -static unsigned int dataSize(QueryLocalPathSegmentMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryLocalPathSegmentMessage message) -{ - // Set initial values of message fields - message->pathSegmentNumber = newJausUnsignedShort(0); - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->pathSegmentNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->pathSegmentNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryLocalPathSegmentMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryLocalPathSegmentMessage queryLocalPathSegmentMessageCreate(void) -{ - QueryLocalPathSegmentMessage message; - - message = (QueryLocalPathSegmentMessage)malloc( sizeof(QueryLocalPathSegmentMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryLocalPathSegmentMessageDestroy(QueryLocalPathSegmentMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryLocalPathSegmentMessageFromBuffer(QueryLocalPathSegmentMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryLocalPathSegmentMessageToBuffer(QueryLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryLocalPathSegmentMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryLocalPathSegmentBuffer failed - } - } -} - -QueryLocalPathSegmentMessage queryLocalPathSegmentMessageFromJausMessage(JausMessage jausMessage) -{ - QueryLocalPathSegmentMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryLocalPathSegmentMessage)malloc( sizeof(QueryLocalPathSegmentMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryLocalPathSegmentMessageToJausMessage(QueryLocalPathSegmentMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryLocalPathSegmentMessageSize(QueryLocalPathSegmentMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryLocalPathSegmentMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryLocalPoseMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryLocalPoseMessage.c deleted file mode 100644 index b842bfa050b5ffe18d06d516732bdc9df51d5400..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryLocalPoseMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryLocalPoseMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryLocalPoseMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_LOCAL_POSE; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(QueryLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryLocalPoseMessage message); -static unsigned int dataSize(QueryLocalPoseMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryLocalPoseMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryLocalPoseMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryLocalPoseMessage queryLocalPoseMessageCreate(void) -{ - QueryLocalPoseMessage message; - - message = (QueryLocalPoseMessage)malloc( sizeof(QueryLocalPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryLocalPoseMessageDestroy(QueryLocalPoseMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryLocalPoseMessageFromBuffer(QueryLocalPoseMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryLocalPoseMessageToBuffer(QueryLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryLocalPoseMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryLocalPoseBuffer failed - } - } -} - -QueryLocalPoseMessage queryLocalPoseMessageFromJausMessage(JausMessage jausMessage) -{ - QueryLocalPoseMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryLocalPoseMessage)malloc( sizeof(QueryLocalPoseMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryLocalPoseMessageToJausMessage(QueryLocalPoseMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryLocalPoseMessageSize(QueryLocalPoseMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryLocalPoseMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryLocalVectorMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryLocalVectorMessage.c deleted file mode 100644 index e1a0227ac14d47c8222ec026377d13f4ee914f5b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryLocalVectorMessage.c +++ /dev/null @@ -1,334 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryLocalVectorMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryLocalVectorMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_LOCAL_VECTOR; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryLocalVectorMessage message); -static unsigned int dataSize(QueryLocalVectorMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryLocalVectorMessage message) -{ - // Set initial values of message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes == message->dataSize) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - return index; -} - -static unsigned int dataSize(QueryLocalVectorMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryLocalVectorMessage queryLocalVectorMessageCreate(void) -{ - QueryLocalVectorMessage message; - - message = (QueryLocalVectorMessage)malloc( sizeof(QueryLocalVectorMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryLocalVectorMessageDestroy(QueryLocalVectorMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryLocalVectorMessageFromBuffer(QueryLocalVectorMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryLocalVectorMessageToBuffer(QueryLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryLocalVectorMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryLocalVectorBuffer failed - } - } -} - -QueryLocalVectorMessage queryLocalVectorMessageFromJausMessage(JausMessage jausMessage) -{ - QueryLocalVectorMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryLocalVectorMessage)malloc( sizeof(QueryLocalVectorMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryLocalVectorMessageToJausMessage(QueryLocalVectorMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryLocalVectorMessageSize(QueryLocalVectorMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryLocalVectorMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryLocalWaypointMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryLocalWaypointMessage.c deleted file mode 100644 index 421654089712ee7af95ecd6c93562068703cc7fe..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryLocalWaypointMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryLocalWaypointMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryLocalWaypointMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_LOCAL_WAYPOINT; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(QueryLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryLocalWaypointMessage message); -static unsigned int dataSize(QueryLocalWaypointMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryLocalWaypointMessage message) -{ - // Set initial values of message fields - message->waypointNumber = newJausUnsignedShort(0); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->waypointNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->waypointNumber, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryLocalWaypointMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryLocalWaypointMessage queryLocalWaypointMessageCreate(void) -{ - QueryLocalWaypointMessage message; - - message = (QueryLocalWaypointMessage)malloc( sizeof(QueryLocalWaypointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryLocalWaypointMessageDestroy(QueryLocalWaypointMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryLocalWaypointMessageFromBuffer(QueryLocalWaypointMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryLocalWaypointMessageToBuffer(QueryLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryLocalWaypointMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryLocalWaypointBuffer failed - } - } -} - -QueryLocalWaypointMessage queryLocalWaypointMessageFromJausMessage(JausMessage jausMessage) -{ - QueryLocalWaypointMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryLocalWaypointMessage)malloc( sizeof(QueryLocalWaypointMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryLocalWaypointMessageToJausMessage(QueryLocalWaypointMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryLocalWaypointMessageSize(QueryLocalWaypointMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryLocalWaypointMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryPathSegmentCountMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryPathSegmentCountMessage.c deleted file mode 100644 index de7d9f1fa7b6ecbd80b3b92ed65bbd71106f8c60..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryPathSegmentCountMessage.c +++ /dev/null @@ -1,346 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryPathSegmentCountMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryPathSegmentCountMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_PATH_SEGMENT_COUNT; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryPathSegmentCountMessage message); -static unsigned int dataSize(QueryPathSegmentCountMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryPathSegmentCountMessage message) -{ - // Set initial values of message fields - // No Message Fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -// int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Message Fields - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // No Message Fields - } - - return index; -} - -static unsigned int dataSize(QueryPathSegmentCountMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryPathSegmentCountMessage queryPathSegmentCountMessageCreate(void) -{ - QueryPathSegmentCountMessage message; - - message = (QueryPathSegmentCountMessage)malloc( sizeof(QueryPathSegmentCountMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryPathSegmentCountMessageDestroy(QueryPathSegmentCountMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryPathSegmentCountMessageFromBuffer(QueryPathSegmentCountMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryPathSegmentCountMessageToBuffer(QueryPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryPathSegmentCountMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryPathSegmentCountBuffer failed - } - } -} - -QueryPathSegmentCountMessage queryPathSegmentCountMessageFromJausMessage(JausMessage jausMessage) -{ - QueryPathSegmentCountMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryPathSegmentCountMessage)malloc( sizeof(QueryPathSegmentCountMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryPathSegmentCountMessageToJausMessage(QueryPathSegmentCountMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryPathSegmentCountMessageSize(QueryPathSegmentCountMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryPathSegmentCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryPlatformOperationalDataMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryPlatformOperationalDataMessage.c deleted file mode 100644 index 22421205a6fd6d96cb7626974399262e11da9455..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryPlatformOperationalDataMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryPlatformOperationalDataMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryPlatformOperationalDataMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_PLATFORM_OPERATIONAL_DATA; -static const int maxDataSizeBytes = 1; - -static JausBoolean headerFromBuffer(QueryPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryPlatformOperationalDataMessage message); -static unsigned int dataSize(QueryPlatformOperationalDataMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryPlatformOperationalDataMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryPlatformOperationalDataMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryPlatformOperationalDataMessage queryPlatformOperationalDataMessageCreate(void) -{ - QueryPlatformOperationalDataMessage message; - - message = (QueryPlatformOperationalDataMessage)malloc( sizeof(QueryPlatformOperationalDataMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryPlatformOperationalDataMessageDestroy(QueryPlatformOperationalDataMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryPlatformOperationalDataMessageFromBuffer(QueryPlatformOperationalDataMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryPlatformOperationalDataMessageToBuffer(QueryPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryPlatformOperationalDataMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryPlatformOperationalDataBuffer failed - } - } -} - -QueryPlatformOperationalDataMessage queryPlatformOperationalDataMessageFromJausMessage(JausMessage jausMessage) -{ - QueryPlatformOperationalDataMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryPlatformOperationalDataMessage)malloc( sizeof(QueryPlatformOperationalDataMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryPlatformOperationalDataMessageToJausMessage(QueryPlatformOperationalDataMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryPlatformOperationalDataMessageSize(QueryPlatformOperationalDataMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryPlatformOperationalDataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryPlatformSpecificationsMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryPlatformSpecificationsMessage.c deleted file mode 100644 index c5fbb9f7788835fae59edbf3b31d7109113e9c46..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryPlatformSpecificationsMessage.c +++ /dev/null @@ -1,350 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryPlatformSpecificationsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryPlatformSpecificationsMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_PLATFORM_SPECIFICATIONS; -static const int maxDataSizeBytes = 4; - -static JausBoolean headerFromBuffer(QueryPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryPlatformSpecificationsMessage message); -static unsigned int dataSize(QueryPlatformSpecificationsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryPlatformSpecificationsMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedInteger(JAUS_INTEGER_PRESENCE_VECTOR_ALL_ON); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedIntegerFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedIntegerToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - return index; -} - - -static unsigned int dataSize(QueryPlatformSpecificationsMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryPlatformSpecificationsMessage queryPlatformSpecificationsMessageCreate(void) -{ - QueryPlatformSpecificationsMessage message; - - message = (QueryPlatformSpecificationsMessage)malloc( sizeof(QueryPlatformSpecificationsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryPlatformSpecificationsMessageDestroy(QueryPlatformSpecificationsMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryPlatformSpecificationsMessageFromBuffer(QueryPlatformSpecificationsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryPlatformSpecificationsMessageToBuffer(QueryPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryPlatformSpecificationsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryPlatformSpecificationsBuffer failed - } - } -} - -QueryPlatformSpecificationsMessage queryPlatformSpecificationsMessageFromJausMessage(JausMessage jausMessage) -{ - QueryPlatformSpecificationsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryPlatformSpecificationsMessage)malloc( sizeof(QueryPlatformSpecificationsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryPlatformSpecificationsMessageToJausMessage(QueryPlatformSpecificationsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryPlatformSpecificationsMessageSize(QueryPlatformSpecificationsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryPlatformSpecificationsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryTravelSpeedMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryTravelSpeedMessage.c deleted file mode 100644 index cc966eabd8c00cf5a2e2510d29936c04c31c2a3e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryTravelSpeedMessage.c +++ /dev/null @@ -1,346 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryTravelSpeedMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryTravelSpeedMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_TRAVEL_SPEED; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryTravelSpeedMessage message); -static unsigned int dataSize(QueryTravelSpeedMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryTravelSpeedMessage message) -{ - // Set initial values of message fields - // No Message Fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -// int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Message Fields - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // No Message Fields - } - - return index; -} - -static unsigned int dataSize(QueryTravelSpeedMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryTravelSpeedMessage queryTravelSpeedMessageCreate(void) -{ - QueryTravelSpeedMessage message; - - message = (QueryTravelSpeedMessage)malloc( sizeof(QueryTravelSpeedMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryTravelSpeedMessageDestroy(QueryTravelSpeedMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryTravelSpeedMessageFromBuffer(QueryTravelSpeedMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryTravelSpeedMessageToBuffer(QueryTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryTravelSpeedMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryTravelSpeedBuffer failed - } - } -} - -QueryTravelSpeedMessage queryTravelSpeedMessageFromJausMessage(JausMessage jausMessage) -{ - QueryTravelSpeedMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryTravelSpeedMessage)malloc( sizeof(QueryTravelSpeedMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryTravelSpeedMessageToJausMessage(QueryTravelSpeedMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryTravelSpeedMessageSize(QueryTravelSpeedMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryTravelSpeedMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryVelocityStateMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryVelocityStateMessage.c deleted file mode 100644 index b7ef023d110bb18c1a2f72b17c169e022c4b8a25..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryVelocityStateMessage.c +++ /dev/null @@ -1,348 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryVelocityStateMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryVelocityStateMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_VELOCITY_STATE; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(QueryVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryVelocityStateMessage message); -static unsigned int dataSize(QueryVelocityStateMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryVelocityStateMessage message) -{ - // Set initial values of message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryVelocityStateMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryVelocityStateMessage queryVelocityStateMessageCreate(void) -{ - QueryVelocityStateMessage message; - - message = (QueryVelocityStateMessage)malloc( sizeof(QueryVelocityStateMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryVelocityStateMessageDestroy(QueryVelocityStateMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryVelocityStateMessageFromBuffer(QueryVelocityStateMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryVelocityStateMessageToBuffer(QueryVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryVelocityStateMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryVelocityStateBuffer failed - } - } -} - -QueryVelocityStateMessage queryVelocityStateMessageFromJausMessage(JausMessage jausMessage) -{ - QueryVelocityStateMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryVelocityStateMessage)malloc( sizeof(QueryVelocityStateMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryVelocityStateMessageToJausMessage(QueryVelocityStateMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryVelocityStateMessageSize(QueryVelocityStateMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryVelocityStateMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryWaypointCountMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryWaypointCountMessage.c deleted file mode 100644 index 4cd039e277095ab733f5d0f321feb1c888551cbf..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryWaypointCountMessage.c +++ /dev/null @@ -1,346 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryWaypointCountMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryWaypointCountMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_WAYPOINT_COUNT; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(QueryWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryWaypointCountMessage message); -static unsigned int dataSize(QueryWaypointCountMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryWaypointCountMessage message) -{ - // Set initial values of message fields - // No Message Fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ -// int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // No Message Fields - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - // No Message Fields - } - - return index; -} - -static unsigned int dataSize(QueryWaypointCountMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryWaypointCountMessage queryWaypointCountMessageCreate(void) -{ - QueryWaypointCountMessage message; - - message = (QueryWaypointCountMessage)malloc( sizeof(QueryWaypointCountMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryWaypointCountMessageDestroy(QueryWaypointCountMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryWaypointCountMessageFromBuffer(QueryWaypointCountMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryWaypointCountMessageToBuffer(QueryWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryWaypointCountMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryWaypointCountBuffer failed - } - } -} - -QueryWaypointCountMessage queryWaypointCountMessageFromJausMessage(JausMessage jausMessage) -{ - QueryWaypointCountMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryWaypointCountMessage)malloc( sizeof(QueryWaypointCountMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryWaypointCountMessageToJausMessage(QueryWaypointCountMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryWaypointCountMessageSize(QueryWaypointCountMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryWaypointCountMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/platform/queryWrenchEffortMessage.c b/lib/openjaus/libjaus/src/message/query/platform/queryWrenchEffortMessage.c deleted file mode 100644 index 2cc9e37988200734d46f9e712dc76e206fa7e5b7..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/platform/queryWrenchEffortMessage.c +++ /dev/null @@ -1,349 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryWrenchEffortMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryWrenchEffortMessage - - - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_WRENCH_EFFORT; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(QueryWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryWrenchEffortMessage message); -static unsigned int dataSize(QueryWrenchEffortMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryWrenchEffortMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryWrenchEffortMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryWrenchEffortMessage queryWrenchEffortMessageCreate(void) -{ - QueryWrenchEffortMessage message; - - message = (QueryWrenchEffortMessage)malloc( sizeof(QueryWrenchEffortMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryWrenchEffortMessageDestroy(QueryWrenchEffortMessage message) -{ - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryWrenchEffortMessageFromBuffer(QueryWrenchEffortMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryWrenchEffortMessageToBuffer(QueryWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryWrenchEffortMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryWrenchEffortBuffer failed - } - } -} - -QueryWrenchEffortMessage queryWrenchEffortMessageFromJausMessage(JausMessage jausMessage) -{ - QueryWrenchEffortMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryWrenchEffortMessage)malloc( sizeof(QueryWrenchEffortMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryWrenchEffortMessageToJausMessage(QueryWrenchEffortMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryWrenchEffortMessageSize(QueryWrenchEffortMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryWrenchEffortMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/worldModel/queryVksBoundsMessage.c b/lib/openjaus/libjaus/src/message/query/worldModel/queryVksBoundsMessage.c deleted file mode 100644 index b9a2c0445bcdd13389150de6e11019bf8c1da281..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/worldModel/queryVksBoundsMessage.c +++ /dev/null @@ -1,363 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryVksBoundsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryVksBoundsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_VKS_BOUNDS; -static const int maxDataSizeBytes = 3; - -static JausBoolean headerFromBuffer(QueryVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryVksBoundsMessage message); -static void dataDestroy(QueryVksBoundsMessage message); -static unsigned int dataSize(QueryVksBoundsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryVksBoundsMessage message) -{ - // Set initial values of message fields - message->requestId = newJausByte(0); - message->featureClassId = newJausUnsignedShort(0); - -} - -// Destructs the message-specific fields -static void dataDestroy(QueryVksBoundsMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausByteFromBuffer(&message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortFromBuffer(&message->featureClassId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausByteToBuffer(message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausUnsignedShortToBuffer(message->featureClassId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryVksBoundsMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryVksBoundsMessage queryVksBoundsMessageCreate(void) -{ - QueryVksBoundsMessage message; - - message = (QueryVksBoundsMessage)malloc( sizeof(QueryVksBoundsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryVksBoundsMessageDestroy(QueryVksBoundsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryVksBoundsMessageFromBuffer(QueryVksBoundsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryVksBoundsMessageToBuffer(QueryVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryVksBoundsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryVksBoundsBuffer failed - } - } -} - -QueryVksBoundsMessage queryVksBoundsMessageFromJausMessage(JausMessage jausMessage) -{ - QueryVksBoundsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryVksBoundsMessage)malloc( sizeof(QueryVksBoundsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryVksBoundsMessageToJausMessage(QueryVksBoundsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryVksBoundsMessageSize(QueryVksBoundsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryVksBoundsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/worldModel/queryVksFeatureClassMetadataMessage.c b/lib/openjaus/libjaus/src/message/query/worldModel/queryVksFeatureClassMetadataMessage.c deleted file mode 100644 index 25e01a15074dced3a79916e8224b8a9c9250d291..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/worldModel/queryVksFeatureClassMetadataMessage.c +++ /dev/null @@ -1,355 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryVksFeatureClassMetadataMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryVksFeatureClassMetadataMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_VKS_FEATURE_CLASS_METADATA; -static const int maxDataSizeBytes = 2; - -static JausBoolean headerFromBuffer(QueryVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryVksFeatureClassMetadataMessage message); -static void dataDestroy(QueryVksFeatureClassMetadataMessage message); -static unsigned int dataSize(QueryVksFeatureClassMetadataMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryVksFeatureClassMetadataMessage message) -{ - // Set initial values of message fields - message->featureClassId = newJausUnsignedShort(0); -} - -// Destructs the message-specific fields -static void dataDestroy(QueryVksFeatureClassMetadataMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - if(!jausUnsignedShortFromBuffer(&message->featureClassId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - if(!jausUnsignedShortToBuffer(message->featureClassId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - return index; -} - -static unsigned int dataSize(QueryVksFeatureClassMetadataMessage message) -{ - // Constant Size - return maxDataSizeBytes; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryVksFeatureClassMetadataMessage queryVksFeatureClassMetadataMessageCreate(void) -{ - QueryVksFeatureClassMetadataMessage message; - - message = (QueryVksFeatureClassMetadataMessage)malloc( sizeof(QueryVksFeatureClassMetadataMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryVksFeatureClassMetadataMessageDestroy(QueryVksFeatureClassMetadataMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryVksFeatureClassMetadataMessageFromBuffer(QueryVksFeatureClassMetadataMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryVksFeatureClassMetadataMessageToBuffer(QueryVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryVksFeatureClassMetadataMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryVksFeatureClassMetadataBuffer failed - } - } -} - -QueryVksFeatureClassMetadataMessage queryVksFeatureClassMetadataMessageFromJausMessage(JausMessage jausMessage) -{ - QueryVksFeatureClassMetadataMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryVksFeatureClassMetadataMessage)malloc( sizeof(QueryVksFeatureClassMetadataMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryVksFeatureClassMetadataMessageToJausMessage(QueryVksFeatureClassMetadataMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryVksFeatureClassMetadataMessageSize(QueryVksFeatureClassMetadataMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryVksFeatureClassMetadataMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/query/worldModel/queryVksObjectsMessage.c b/lib/openjaus/libjaus/src/message/query/worldModel/queryVksObjectsMessage.c deleted file mode 100644 index 6c7deb578f535ba61db764bc08b76e1498747c9f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/query/worldModel/queryVksObjectsMessage.c +++ /dev/null @@ -1,735 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queryVksObjectsMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a QueryVksObjectsMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_QUERY_VKS_OBJECTS; -static const int maxDataSizeBytes = 512000; // Max Message size: 500K - -static JausBoolean headerFromBuffer(QueryVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(QueryVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(QueryVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(QueryVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(QueryVksObjectsMessage message); -static void dataDestroy(QueryVksObjectsMessage message); -static unsigned int dataSize(QueryVksObjectsMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(QueryVksObjectsMessage message) -{ - // Set initial values of message fields - message->presenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->responsePresenceVector = newJausByte(JAUS_BYTE_PRESENCE_VECTOR_ALL_ON); - message->requestId = newJausByte(0); - message->objectCount = newJausUnsignedShort(0); - message->objectIds = NULL; - message->queryRegion = vectorObjectCreate(); -} - -// Destructs the message-specific fields -static void dataDestroy(QueryVksObjectsMessage message) -{ - // Free message fields - if(message->objectIds) - free(message->objectIds); - - vectorObjectDestroy(message->queryRegion); -} - -// Return boolean of success -static JausBoolean dataFromBuffer(QueryVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - int i = 0; - JausByte featureClassCount; - JausUnsignedShort dataPointCount; - JausInteger tempInt; - JausWorldModelFeatureClass fcClass = NULL; - JausGeometryPointLLA point = NULL; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - // Presence Vector - if(!jausByteFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Response Presence Vector - if(!jausByteFromBuffer(&message->responsePresenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request Id - if(!jausByteFromBuffer(&message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Test if objectCount is specified - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_ID_BIT)) - { - // Request Id - if(!jausUnsignedShortFromBuffer(&message->objectCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Allocate memory for objectIds - message->objectIds = (JausUnsignedInteger *)malloc(message->objectCount * JAUS_UNSIGNED_INTEGER_SIZE_BYTES); - - // Unpack Object Ids - for(i = 0; i < message->objectCount; i++) - { - if(!jausUnsignedIntegerFromBuffer(&message->objectIds[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - else - { - message->objectIds = NULL; - } - - // Create the QueryRegion object - message->queryRegion = vectorObjectCreate(); - if(!message->queryRegion) return JAUS_FALSE; - - // Test if a queryRegion is specified - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_REGION_BIT)) - { - // Unpack Region Type - if(!jausByteFromBuffer(&message->queryRegion->type, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Buffer is optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_REGION_BIT)) - { - // Unpack Buffer - if(!jausFloatFromBuffer(&message->queryRegion->bufferMeters, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_FLOAT_SIZE_BYTES; - } - } - - // Test if Feature Class provided - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_FC_COUNT_BIT)) - { - // FC Count - if(!jausByteFromBuffer(&featureClassCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i = 0; i < featureClassCount; i++) - { - // Create JausWorldModelFeatureClass Object - fcClass = featureClassCreate(); - if(!fcClass) return JAUS_FALSE; - - // This should ALWAYS be true, because VKS_PV_QUERY_OBJECTS_FC_COUNT_BIT is set - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_FEATURE_CLASS_BIT)) - { - // Unpack FC Id - if(!jausUnsignedShortFromBuffer(&fcClass->id, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_ATTRIBUTE_BIT)) - { - //Destroy the Attribute created by featureClassCreate - featureClassAttributeDestroy(fcClass->attribute); - - // Unpack Attribute Data Type & Value - fcClass->attribute = featureClassAttributeFromBuffer(buffer+index, bufferSizeBytes-index); - if(!fcClass->attribute) return JAUS_FALSE; - index += featureClassAttributeSizeBytes(fcClass->attribute); - } - - // Add FC to array - jausArrayAdd(message->queryRegion->featureClasses, fcClass); - } - } - - // Test if region points specified - // This should be true if the VKS_PV_QUERY_OBJECTS_REGION_BIT is set - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_POINT_COUNT_BIT)) - { - // Unpack Point Count - if(!jausUnsignedShortFromBuffer(&dataPointCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - for(i = 0; i < dataPointCount; i++) - { - point = jausGeometryPointLLACreate(); - if(!point) return JAUS_FALSE; - - // unpack Latitude - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-90, 90) - point->latitudeRadians = jausIntegerToDouble(tempInt, -90, 90) * JAUS_RAD_PER_DEG; - - // unpack Latitude - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-180, 180) - point->longitudeRadians = jausIntegerToDouble(tempInt, -180, 180) * JAUS_RAD_PER_DEG; - - jausArrayAdd(message->queryRegion->dataPoints, point); - } - } - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(QueryVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - unsigned int index = 0; - int i = 0; - JausWorldModelFeatureClass fcClass = NULL; - JausGeometryPointLLA point = NULL; - JausInteger tempInt; - - if(bufferSizeBytes >= dataSize(message)) - { - // Ensure the PV rules are met - // If the VKS_PV_QUERY_OBJECTS_REGION_BIT is set, then the VKS_PV_QUERY_OBJECTS_POINT_COUNT_BIT is required - // The VKS_PV_QUERY_OBJECTS_BUFFER_BIT cannot be set without the VKS_PV_QUERY_OBJECTS_REGION_BIT - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_REGION_BIT)) - { - jausByteSetBit(&message->presenceVector, VKS_PV_QUERY_OBJECTS_POINT_COUNT_BIT); - } - else - { - jausByteClearBit(&message->presenceVector, VKS_PV_QUERY_OBJECTS_POINT_COUNT_BIT); - jausByteClearBit(&message->presenceVector, VKS_PV_QUERY_OBJECTS_BUFFER_BIT); - } - - // If the VKS_PV_QUERY_OBJECTS_FEATURE_CLASS_BIT is set or the VKS_PV_QUERY_OBJECTS_ATTRIBUTE_BIT is set, - // then the VKS_PV_QUERY_OBJECTS_FC_COUNT_BIT is required - if( jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_ATTRIBUTE_BIT) || - jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_FEATURE_CLASS_BIT)) - { - jausByteSetBit(&message->presenceVector, VKS_PV_QUERY_OBJECTS_FC_COUNT_BIT); - } - else - { - jausByteClearBit(&message->presenceVector, VKS_PV_QUERY_OBJECTS_FC_COUNT_BIT); - } - - // Pack Message Fields to Buffer - // Presence Vector - if(!jausByteToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Response Presence Vector - if(!jausByteToBuffer(message->responsePresenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Request Id - if(!jausByteToBuffer(message->requestId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // objectCount is optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_ID_BIT)) - { - // Object Count - if(!jausUnsignedShortToBuffer(message->objectCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Pack Object Ids - for(i = 0; i < message->objectCount; i++) - { - if(!jausUnsignedIntegerToBuffer(message->objectIds[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - // Region is Optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_REGION_BIT)) - { - // Region Type - if(!jausByteToBuffer(message->queryRegion->type, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Buffer is Optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_REGION_BIT)) - { - // Buffer - if(!jausFloatToBuffer(message->queryRegion->bufferMeters, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_FLOAT_SIZE_BYTES; - } - } - - // Feature Class Information is optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_FC_COUNT_BIT)) - { - // Feature Class Count - if(!jausByteToBuffer((JausByte)message->queryRegion->featureClasses->elementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_FEATURE_CLASS_BIT)) - { - for(i = 0; i < message->queryRegion->featureClasses->elementCount; i++) - { - fcClass = (JausWorldModelFeatureClass) message->queryRegion->featureClasses->elementData[i]; - - // Feature Class Id - if(!jausUnsignedShortToBuffer(fcClass->id, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Attribute is Optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_ATTRIBUTE_BIT)) - { - if(!featureClassAttributeToBuffer(fcClass->attribute, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += featureClassAttributeSizeBytes(fcClass->attribute); - } - } - } - else if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_ATTRIBUTE_BIT)) - { - for(i = 0; i < message->queryRegion->featureClasses->elementCount; i++) - { - fcClass = (JausWorldModelFeatureClass) message->queryRegion->featureClasses->elementData[i]; - - if(!featureClassAttributeToBuffer(fcClass->attribute, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += featureClassAttributeSizeBytes(fcClass->attribute); - } - } - - // Region is optional, if VKS_PV_QUERY_OBJECTS_REGION_BIT set, points required - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_POINT_COUNT_BIT)) - { - // Point Count - if(!jausUnsignedShortToBuffer((JausUnsignedShort)message->queryRegion->dataPoints->elementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - for(i = 0; i < message->queryRegion->dataPoints->elementCount; i++) - { - point = (JausGeometryPointLLA) message->queryRegion->dataPoints->elementData[i]; - - // Scaled Int (-90, 90) - tempInt = jausIntegerFromDouble((point->latitudeRadians * JAUS_DEG_PER_RAD), -90, 90); - - //pack Latitude - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-180, 180) - tempInt = jausIntegerFromDouble((point->longitudeRadians * JAUS_DEG_PER_RAD), -180, 180); - - //pack Longitude - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - } - } - - return index; -} - -static unsigned int dataSize(QueryVksObjectsMessage message) -{ - unsigned int index = 0; - int i = 0; - JausWorldModelFeatureClass fcClass = NULL; - - // Ensure the PV rules are met - // If the VKS_PV_QUERY_OBJECTS_REGION_BIT is set, then the VKS_PV_QUERY_OBJECTS_POINT_COUNT_BIT is required - // The VKS_PV_QUERY_OBJECTS_BUFFER_BIT cannot be set without the VKS_PV_QUERY_OBJECTS_REGION_BIT - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_REGION_BIT)) - { - jausByteSetBit(&message->presenceVector, VKS_PV_QUERY_OBJECTS_POINT_COUNT_BIT); - } - else - { - jausByteClearBit(&message->presenceVector, VKS_PV_QUERY_OBJECTS_POINT_COUNT_BIT); - jausByteClearBit(&message->presenceVector, VKS_PV_QUERY_OBJECTS_BUFFER_BIT); - } - - // If the VKS_PV_QUERY_OBJECTS_FEATURE_CLASS_BIT is set or the VKS_PV_QUERY_OBJECTS_ATTRIBUTE_BIT is set, - // then the VKS_PV_QUERY_OBJECTS_FC_COUNT_BIT is required - if( jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_ATTRIBUTE_BIT) || - jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_FEATURE_CLASS_BIT)) - { - jausByteSetBit(&message->presenceVector, VKS_PV_QUERY_OBJECTS_FC_COUNT_BIT); - } - else - { - jausByteClearBit(&message->presenceVector, VKS_PV_QUERY_OBJECTS_FC_COUNT_BIT); - } - - // Pack Message Fields to Buffer - // Presence Vector - index += JAUS_BYTE_SIZE_BYTES; - - // Response Presence Vector - index += JAUS_BYTE_SIZE_BYTES; - - // Request Id - index += JAUS_BYTE_SIZE_BYTES; - - // objectCount is optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_ID_BIT)) - { - // Object Count - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Pack Object Ids - for(i = 0; i < message->objectCount; i++) - { - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - } - - // Region is Optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_REGION_BIT)) - { - // Region Type - index += JAUS_BYTE_SIZE_BYTES; - - // Buffer is Optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_REGION_BIT)) - { - // Buffer - index += JAUS_FLOAT_SIZE_BYTES; - } - } - - // Feature Class Information is optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_FC_COUNT_BIT)) - { - // Feature Class Count - index += JAUS_BYTE_SIZE_BYTES; - } - - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_FEATURE_CLASS_BIT)) - { - for(i = 0; i < message->queryRegion->featureClasses->elementCount; i++) - { - fcClass = (JausWorldModelFeatureClass) message->queryRegion->featureClasses->elementData[i]; - - // Feature Class Id - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Attribute is Optional - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_ATTRIBUTE_BIT)) - { - index += featureClassAttributeSizeBytes(fcClass->attribute); - } - } - } - else if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_ATTRIBUTE_BIT)) - { - for(i = 0; i < message->queryRegion->featureClasses->elementCount; i++) - { - fcClass = (JausWorldModelFeatureClass) message->queryRegion->featureClasses->elementData[i]; - index += featureClassAttributeSizeBytes(fcClass->attribute); - } - } - - // Region is optional, if VKS_PV_QUERY_OBJECTS_REGION_BIT set, points required - if(jausByteIsBitSet(message->presenceVector, VKS_PV_QUERY_OBJECTS_POINT_COUNT_BIT)) - { - // Point Count - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - for(i = 0; i < message->queryRegion->dataPoints->elementCount; i++) - { - //pack Latitude - index += JAUS_INTEGER_SIZE_BYTES; - - //pack Longitude - index += JAUS_INTEGER_SIZE_BYTES; - } - } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -QueryVksObjectsMessage queryVksObjectsMessageCreate(void) -{ - QueryVksObjectsMessage message; - - message = (QueryVksObjectsMessage)malloc( sizeof(QueryVksObjectsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - - return message; -} - -void queryVksObjectsMessageDestroy(QueryVksObjectsMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean queryVksObjectsMessageFromBuffer(QueryVksObjectsMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean queryVksObjectsMessageToBuffer(QueryVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < queryVksObjectsMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToQueryVksObjectsBuffer failed - } - } -} - -QueryVksObjectsMessage queryVksObjectsMessageFromJausMessage(JausMessage jausMessage) -{ - QueryVksObjectsMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (QueryVksObjectsMessage)malloc( sizeof(QueryVksObjectsMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage queryVksObjectsMessageToJausMessage(QueryVksObjectsMessage message) -{ - JausMessage jausMessage; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - - -unsigned int queryVksObjectsMessageSize(QueryVksObjectsMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(QueryVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(QueryVksObjectsMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/message/skeletonMessage.c.tmpl b/lib/openjaus/libjaus/src/message/skeletonMessage.c.tmpl deleted file mode 100644 index 1384f9ed42a2e82b609c04821b96fb35df42bbe0..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/message/skeletonMessage.c.tmpl +++ /dev/null @@ -1,408 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: xXXXMessage.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a XxXxMessage - -#include -#include -#include "jaus.h" - -static const int commandCode = JAUS_XXXX; -static const int maxDataSizeBytes = 0; - -static JausBoolean headerFromBuffer(XxXxMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static JausBoolean headerToBuffer(XxXxMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); - -static JausBoolean dataFromBuffer(XxXxMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static int dataToBuffer(XxXxMessage message, unsigned char *buffer, unsigned int bufferSizeBytes); -static void dataInitialize(XxXxMessage message); -static void dataDestroy(XxXxMessage message); -static unsigned int dataSize(XxXxMessage message); - -// ************************************************************************************************************** // -// USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -// Initializes the message-specific fields -static void dataInitialize(XxXxMessage message) -{ - // Set initial values of message fields - // Example from ReportGlobalPoseMessage.c - // - // message->presenceVector = newJausUnsignedShort(JAUS_SHORT_PRESENCE_VECTOR_ALL_ON); - // message->latitudeDegrees = newJausDouble(0); // Scaled Int (-90, 90) - // message->longitudeDegrees = newJausDouble(0); // Scaled Int (-180, 180) - // message->elevationMeters = newJausDouble(0); // Scaled Int (-10000, 35000) - // message->positionRmsMeters = newJausDouble(0); // Scaled UInt (0, 100) - // message->rollRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - // message->pitchRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - // message->yawRadians = newJausDouble(0); // Scaled Short (-JAUS_PI, JAUS_PI) - // message->attitudeRmsRadians = newJausDouble(0); // Scaled Short (0, JAUS_PI) - // message->timeStamp = newJausUnsignedInteger(0); - -} - -// Destructs the message-specific fields -static void dataDestroy(XxXxMessage message) -{ - // Free message fields -} - -// Return boolean of success -static JausBoolean dataFromBuffer(XxXxMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes == message->dataSize) - { - // Unpack Message Fields from Buffer - - // Couple Examples from ReportGlobalPoseMessage - // - // if(!jausUnsignedShortFromBuffer(&message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - // index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - // - // if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_LATITUDE_BIT)) - // { - // //unpack - // if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - // index += JAUS_INTEGER_SIZE_BYTES; - // // Scaled Int (-90, 90) - // message->latitudeDegrees = jausIntegerToDouble(tempInt, -90, 90); - // } - - - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Returns number of bytes put into the buffer -static int dataToBuffer(XxXxMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(bufferSizeBytes >= dataSize(message)) - { - // Pack Message Fields to Buffer - - // Couple Examples from ReportGlobalPoseMessage - // - // if(!jausUnsignedShortToBuffer(message->presenceVector, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - // index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - // - // if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_LATITUDE_BIT)) - // { - // // Scaled Int (-90, 90) - // tempInt = jausIntegerFromDouble(message->latitudeDegrees, -90, 90); - // - // //pack - // if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - // index += JAUS_INTEGER_SIZE_BYTES; - // } - - } - - return index; -} - -// Returns number of bytes put into the buffer -static unsigned int dataSize(XxXxMessage message) -{ - int index = 0; - - // Couple Examples from ReportGlobalPoseMessage - // - // // PresenceVector - // index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - // - // if(jausUnsignedShortIsBitSet(message->presenceVector, JAUS_POSE_PV_LATITUDE_BIT)) - // { - // // Latitude - // index += JAUS_INTEGER_SIZE_BYTES; - // } - - return index; -} - -// ************************************************************************************************************** // -// NON-USER CONFIGURED FUNCTIONS -// ************************************************************************************************************** // - -XxXxMessage xXXXMessageCreate(void) -{ - XxXxMessage message; - - message = (XxXxMessage)malloc( sizeof(XxXxMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - // Initialize Values - message->properties.priority = JAUS_DEFAULT_PRIORITY; - message->properties.ackNak = JAUS_ACK_NAK_NOT_REQUIRED; - message->properties.scFlag = JAUS_NOT_SERVICE_CONNECTION_MESSAGE; - message->properties.expFlag = JAUS_NOT_EXPERIMENTAL_MESSAGE; - message->properties.version = JAUS_VERSION_3_3; - message->properties.reserved = 0; - message->commandCode = commandCode; - message->destination = jausAddressCreate(); - message->source = jausAddressCreate(); - message->dataFlag = JAUS_SINGLE_DATA_PACKET; - message->dataSize = maxDataSizeBytes; - message->sequenceNumber = 0; - - dataInitialize(message); - message->dataSize = dataSize(message); - - return message; -} - -void xXXXMessageDestroy(XxXxMessage message) -{ - dataDestroy(message); - jausAddressDestroy(message->source); - jausAddressDestroy(message->destination); - free(message); -} - -JausBoolean xXXXMessageFromBuffer(XxXxMessage message, unsigned char* buffer, unsigned int bufferSizeBytes) -{ - int index = 0; - - if(headerFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - index += JAUS_HEADER_SIZE_BYTES; - if(dataFromBuffer(message, buffer+index, bufferSizeBytes-index)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } - } - else - { - return JAUS_FALSE; - } -} - -JausBoolean xXXXMessageToBuffer(XxXxMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < xXXXMessageSize(message)) - { - return JAUS_FALSE; //improper size - } - else - { - message->dataSize = dataToBuffer(message, buffer+JAUS_HEADER_SIZE_BYTES, bufferSizeBytes - JAUS_HEADER_SIZE_BYTES); - if(headerToBuffer(message, buffer, bufferSizeBytes)) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; // headerToXxXxBuffer failed - } - } -} - -XxXxMessage xXXXMessageFromJausMessage(JausMessage jausMessage) -{ - XxXxMessage message; - - if(jausMessage->commandCode != commandCode) - { - return NULL; // Wrong message type - } - else - { - message = (XxXxMessage)malloc( sizeof(XxXxMessageStruct) ); - if(message == NULL) - { - return NULL; - } - - message->properties.priority = jausMessage->properties.priority; - message->properties.ackNak = jausMessage->properties.ackNak; - message->properties.scFlag = jausMessage->properties.scFlag; - message->properties.expFlag = jausMessage->properties.expFlag; - message->properties.version = jausMessage->properties.version; - message->properties.reserved = jausMessage->properties.reserved; - message->commandCode = jausMessage->commandCode; - message->destination = jausAddressCreate(); - *message->destination = *jausMessage->destination; - message->source = jausAddressCreate(); - *message->source = *jausMessage->source; - message->dataSize = jausMessage->dataSize; - message->dataFlag = jausMessage->dataFlag; - message->sequenceNumber = jausMessage->sequenceNumber; - - // Unpack jausMessage->data - if(dataFromBuffer(message, jausMessage->data, jausMessage->dataSize)) - { - return message; - } - else - { - return NULL; - } - } -} - -JausMessage xXXXMessageToJausMessage(XxXxMessage message) -{ - JausMessage jausMessage; - int size; - - jausMessage = (JausMessage)malloc( sizeof(struct JausMessageStruct) ); - if(jausMessage == NULL) - { - return NULL; - } - - jausMessage->properties.priority = message->properties.priority; - jausMessage->properties.ackNak = message->properties.ackNak; - jausMessage->properties.scFlag = message->properties.scFlag; - jausMessage->properties.expFlag = message->properties.expFlag; - jausMessage->properties.version = message->properties.version; - jausMessage->properties.reserved = message->properties.reserved; - jausMessage->commandCode = message->commandCode; - jausMessage->destination = jausAddressCreate(); - *jausMessage->destination = *message->destination; - jausMessage->source = jausAddressCreate(); - *jausMessage->source = *message->source; - jausMessage->dataSize = dataSize(message); - jausMessage->dataFlag = message->dataFlag; - jausMessage->sequenceNumber = message->sequenceNumber; - - jausMessage->data = (unsigned char *)malloc(jausMessage->dataSize); - jausMessage->dataSize = dataToBuffer(message, jausMessage->data, jausMessage->dataSize); - - return jausMessage; -} - -unsigned int xXXXMessageSize(XxXxMessage message) -{ - return (unsigned int)(dataSize(message) + JAUS_HEADER_SIZE_BYTES); -} - -//********************* PRIVATE HEADER FUNCTIONS **********************// - -static JausBoolean headerFromBuffer(XxXxMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - // unpack header - message->properties.priority = (buffer[0] & 0x0F); - message->properties.ackNak = ((buffer[0] >> 4) & 0x03); - message->properties.scFlag = ((buffer[0] >> 6) & 0x01); - message->properties.expFlag = ((buffer[0] >> 7) & 0x01); - message->properties.version = (buffer[1] & 0x3F); - message->properties.reserved = ((buffer[1] >> 6) & 0x03); - - message->commandCode = buffer[2] + (buffer[3] << 8); - - message->destination->instance = buffer[4]; - message->destination->component = buffer[5]; - message->destination->node = buffer[6]; - message->destination->subsystem = buffer[7]; - - message->source->instance = buffer[8]; - message->source->component = buffer[9]; - message->source->node = buffer[10]; - message->source->subsystem = buffer[11]; - - message->dataSize = buffer[12] + ((buffer[13] & 0x0F) << 8); - - message->dataFlag = ((buffer[13] >> 4) & 0x0F); - - message->sequenceNumber = buffer[14] + (buffer[15] << 8); - - return JAUS_TRUE; - } -} - -static JausBoolean headerToBuffer(XxXxMessage message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausUnsignedShort *propertiesPtr = (JausUnsignedShort*)&message->properties; - - if(bufferSizeBytes < JAUS_HEADER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { - buffer[0] = (unsigned char)(*propertiesPtr & 0xFF); - buffer[1] = (unsigned char)((*propertiesPtr & 0xFF00) >> 8); - - buffer[2] = (unsigned char)(message->commandCode & 0xFF); - buffer[3] = (unsigned char)((message->commandCode & 0xFF00) >> 8); - - buffer[4] = (unsigned char)(message->destination->instance & 0xFF); - buffer[5] = (unsigned char)(message->destination->component & 0xFF); - buffer[6] = (unsigned char)(message->destination->node & 0xFF); - buffer[7] = (unsigned char)(message->destination->subsystem & 0xFF); - - buffer[8] = (unsigned char)(message->source->instance & 0xFF); - buffer[9] = (unsigned char)(message->source->component & 0xFF); - buffer[10] = (unsigned char)(message->source->node & 0xFF); - buffer[11] = (unsigned char)(message->source->subsystem & 0xFF); - - buffer[12] = (unsigned char)(message->dataSize & 0xFF); - buffer[13] = (unsigned char)((message->dataFlag & 0xFF) << 4) | (unsigned char)((message->dataSize & 0x0F00) >> 8); - - buffer[14] = (unsigned char)(message->sequenceNumber & 0xFF); - buffer[15] = (unsigned char)((message->sequenceNumber & 0xFF00) >> 8); - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/type/jausByte.c b/lib/openjaus/libjaus/src/type/jausByte.c deleted file mode 100644 index ca924522844fda2e494dafd4e66b5117906d4b3f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausByte.c +++ /dev/null @@ -1,132 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausByte.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausByte funtionality, this should be primarily used through the -// JausType file and its methods - -#include -#include "jaus.h" - -JausByte newJausByte(unsigned char value) -{ - return value; -} - -JausBoolean jausByteFromBuffer(JausByte *jByte, unsigned char *buf, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_BYTE_SIZE_BYTES) - { - return JAUS_FALSE; // not enough data in buffer - } - else - { - *jByte = newJausByte((unsigned char)buf[0]); - return JAUS_TRUE; - } -} - -JausBoolean jausByteToBuffer(JausByte input, unsigned char *buf, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JAUS_BYTE_SIZE_BYTES) - { - return JAUS_FALSE; // not enough room - } - else - { - buf[0] = input; - return JAUS_TRUE; - } -} - -double jausByteToDouble(JausByte input, double min, double max) -{ - // BUG: What to do when max < min - double scaleFactor = (max-min)/JAUS_BYTE_RANGE; - double bias = min; - - return input*scaleFactor + bias; -} - -JausByte jausByteFromDouble(double value, double min, double max) -{ - // BUG: What to do when max < min - double scaleFactor = (max-min)/JAUS_BYTE_RANGE; - double bias = min; - - // limit real number between min and max - if(value < min) value = min; - if(value > max) value = max; - - // return rounded integer value - return newJausByte((unsigned char)((value - bias)/scaleFactor + 0.5)); -} - -JausBoolean jausByteIsBitSet(JausByte input, int bit ) -{ - return (input & (0x01 << bit)) > 0 ? JAUS_TRUE : JAUS_FALSE; -} - -JausBoolean jausByteSetBit(JausByte *input, int bit) -{ - if(JAUS_BYTE_SIZE_BYTES*8 < bit) // 8 bits per byte - { - return JAUS_FALSE; - } - else - { - *input |= 0x01 << bit; - return JAUS_TRUE; - } -} - -JausBoolean jausByteClearBit(JausByte *input, int bit) -{ - if(JAUS_BYTE_SIZE_BYTES*8 < bit) // 8 bits per byte - { - return JAUS_FALSE; - } - else - { - *input &= ~(0x01 << bit); - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/type/jausDouble.c b/lib/openjaus/libjaus/src/type/jausDouble.c deleted file mode 100644 index d9cacc1f8845819e766314811abf85a5402b371c..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausDouble.c +++ /dev/null @@ -1,109 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausDouble.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausDouble funtionality, this should be primarily used through the JausType file and its methods - -#include -#include -#include "jaus.h" - -JausDouble newJausDouble(double val) -{ - return val; -} - -JausBoolean jausDoubleFromBuffer(JausDouble *jDouble, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; - unsigned long tempLong = 0; -#endif - double tempDouble = 0.0; - - if(bufferSizeBytes < JAUS_DOUBLE_SIZE_BYTES) - { - return JAUS_FALSE; // insufficient data in buffer - } - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for(i = 0; i < JAUS_DOUBLE_SIZE_BYTES; i++) - { - tempLong += (buf[i] << (JAUS_DOUBLE_SIZE_BYTES-i-1)*8); - } - memcpy(&(tempDouble), &(tempLong), JAUS_DOUBLE_SIZE_BYTES); -#else - memcpy(&tempDouble, buf, JAUS_DOUBLE_SIZE_BYTES); -#endif - *jDouble = newJausDouble(tempDouble); - return JAUS_TRUE; - } -} - -JausBoolean jausDoubleToBuffer(JausDouble input, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; - unsigned long tempLong = 0; -#endif - - if(bufferSizeBytes < JAUS_DOUBLE_SIZE_BYTES) - { - return JAUS_FALSE; // insufficient room in buffer - } - else - { -#ifdef JAUS_BIG_ENDIAN - memcpy(&(tempLong), &(input), JAUS_DOUBLE_SIZE_BYTES); - // swap bytes - for (i = 0; i < JAUS_DOUBLE_SIZE_BYTES; i++) - { - buf[i] = (unsigned char)((tempLong >> (JAUS_DOUBLE_SIZE_BYTES-i-1)*8) & 0xFF); // 8 bits per byte - } -#else - memcpy(buf, &(input), JAUS_DOUBLE_SIZE_BYTES); -#endif - - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/type/jausEventLimit.c b/lib/openjaus/libjaus/src/type/jausEventLimit.c deleted file mode 100644 index f67a14cff9288d4579f7296fddc5995485fbda9a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausEventLimit.c +++ /dev/null @@ -1,338 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausEventLimit.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#include -#include -#include "jaus.h" - -// JausEventLimit Constructor -JausEventLimit jausEventLimitCreate() -{ - JausEventLimit limit; - limit = (JausEventLimit) malloc(sizeof(JausEventLimitStruct)); - if(limit) - { - memset(limit, 0, sizeof(JausEventLimitStruct)); - limit->dataType = EVENT_LIMIT_UNDEFINED_TYPE; - return limit; - } - else - { - return NULL; - } -} - -// JausEventLimit Destructor -void jausEventLimitDestroy(JausEventLimit limit) -{ - if(limit) - { - free(limit); - limit = NULL; - } -} - -// JausEventLimit Constructor (from Buffer) -JausBoolean jausEventLimitFromBuffer(JausEventLimit *limitPointer, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - JausEventLimit limit; - JausByte tempByte; - int index = 0; - - limit = (JausEventLimit) malloc(sizeof(JausEventLimitStruct)); - *limitPointer = limit; - - if(limit) - { - memset(limit, 0, sizeof(JausEventLimitStruct)); - - if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) - { - *limitPointer = NULL; - return JAUS_FALSE; - } - limit->dataType = tempByte; - index += JAUS_BYTE_SIZE_BYTES; - - switch(limit->dataType) - { - case EVENT_LIMIT_BYTE_TYPE: - if(!jausByteFromBuffer(&limit->value.byteValue, buffer+index, bufferSizeBytes-index)) - { - *limitPointer = NULL; - } - break; - - case EVENT_LIMIT_SHORT_TYPE: - if(!jausShortFromBuffer(&limit->value.shortValue, buffer+index, bufferSizeBytes-index)) - { - *limitPointer = NULL; - } - break; - - case EVENT_LIMIT_INTEGER_TYPE: - if(!jausIntegerFromBuffer(&limit->value.integerValue, buffer+index, bufferSizeBytes-index)) - { - *limitPointer = NULL; - } - break; - - case EVENT_LIMIT_LONG_TYPE: - if(!jausLongFromBuffer(&limit->value.longValue, buffer+index, bufferSizeBytes-index)) - { - *limitPointer = NULL; - } - break; - - case EVENT_LIMIT_UNSIGNED_SHORT_TYPE: - if(!jausUnsignedShortFromBuffer(&limit->value.unsignedShortValue, buffer+index, bufferSizeBytes-index)) - { - *limitPointer = NULL; - } - break; - - case EVENT_LIMIT_UNSIGNED_INTEGER_TYPE: - if(!jausUnsignedIntegerFromBuffer(&limit->value.unsignedIntegerValue, buffer+index, bufferSizeBytes-index)) - { - *limitPointer = NULL; - } - break; - - case EVENT_LIMIT_UNSIGNED_LONG_TYPE: - if(!jausUnsignedLongFromBuffer(&limit->value.unsignedLongValue, buffer+index, bufferSizeBytes-index)) - { - *limitPointer = NULL; - } - break; - - case EVENT_LIMIT_FLOAT_TYPE: - if(!jausFloatFromBuffer(&limit->value.floatValue, buffer+index, bufferSizeBytes-index)) - { - *limitPointer = NULL; - } - break; - - case EVENT_LIMIT_DOUBLE_TYPE: - if(!jausDoubleFromBuffer(&limit->value.doubleValue, buffer+index, bufferSizeBytes-index)) - { - *limitPointer = NULL; - } - break; - - case EVENT_LIMIT_RGB_TYPE: - if(!jausByteFromBuffer(&limit->value.rgb.redValue, buffer+index, bufferSizeBytes-index)) - { - *limitPointer = NULL; - } - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&limit->value.rgb.greenValue, buffer+index, bufferSizeBytes-index)) - { - *limitPointer = NULL; - } - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&limit->value.rgb.blueValue, buffer+index, bufferSizeBytes-index)) - { - *limitPointer = NULL; - } - index += JAUS_BYTE_SIZE_BYTES; - break; - - default: - *limitPointer = NULL; - break; - } - } - - if(*limitPointer) - { - return JAUS_TRUE; - } - - return JAUS_FALSE; -} - -// JausEventLimit To Buffer -JausBoolean jausEventLimitToBuffer(JausEventLimit limit, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - unsigned int index = 0; - if(limit) - { - if(limit->dataType < EVENT_LIMIT_BYTE_TYPE) return JAUS_FALSE; - - if(!jausByteToBuffer(limit->dataType, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Value - switch(limit->dataType) - { - case EVENT_LIMIT_BYTE_TYPE: - if(!jausByteToBuffer(limit->value.byteValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case EVENT_LIMIT_SHORT_TYPE: - if(!jausShortToBuffer(limit->value.shortValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case EVENT_LIMIT_INTEGER_TYPE: - if(!jausIntegerToBuffer(limit->value.integerValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case EVENT_LIMIT_LONG_TYPE: - if(!jausLongToBuffer(limit->value.longValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case EVENT_LIMIT_UNSIGNED_SHORT_TYPE: - if(!jausUnsignedShortToBuffer(limit->value.unsignedShortValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case EVENT_LIMIT_UNSIGNED_INTEGER_TYPE: - if(!jausUnsignedIntegerToBuffer(limit->value.unsignedIntegerValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case EVENT_LIMIT_UNSIGNED_LONG_TYPE: - if(!jausUnsignedLongToBuffer(limit->value.unsignedLongValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case EVENT_LIMIT_FLOAT_TYPE: - if(!jausFloatToBuffer(limit->value.floatValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case EVENT_LIMIT_DOUBLE_TYPE: - if(!jausDoubleToBuffer(limit->value.doubleValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case EVENT_LIMIT_RGB_TYPE: - if(!jausByteToBuffer(limit->value.rgb.redValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(limit->value.rgb.greenValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(limit->value.rgb.blueValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - default: - return JAUS_FALSE; - } - } - return JAUS_FALSE; -} - -unsigned int jausEventLimitSize(JausEventLimit limit) -{ - unsigned int size = 0; - - size += JAUS_BYTE_SIZE_BYTES; - - switch(limit->dataType) - { - case EVENT_LIMIT_BYTE_TYPE: - size += JAUS_BYTE_SIZE_BYTES; - break; - - case EVENT_LIMIT_SHORT_TYPE: - size += JAUS_SHORT_SIZE_BYTES; - break; - - case EVENT_LIMIT_INTEGER_TYPE: - size += JAUS_INTEGER_SIZE_BYTES; - break; - - case EVENT_LIMIT_LONG_TYPE: - size += JAUS_LONG_SIZE_BYTES; - break; - - case EVENT_LIMIT_UNSIGNED_SHORT_TYPE: - size += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - break; - - case EVENT_LIMIT_UNSIGNED_INTEGER_TYPE: - size += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - break; - - case EVENT_LIMIT_UNSIGNED_LONG_TYPE: - size += JAUS_UNSIGNED_LONG_SIZE_BYTES; - break; - - case EVENT_LIMIT_FLOAT_TYPE: - size += JAUS_FLOAT_SIZE_BYTES; - break; - - case EVENT_LIMIT_DOUBLE_TYPE: - size += JAUS_DOUBLE_SIZE_BYTES; - break; - - case EVENT_LIMIT_RGB_TYPE: - size += JAUS_BYTE_SIZE_BYTES; // Red - size += JAUS_BYTE_SIZE_BYTES; // Green - size += JAUS_BYTE_SIZE_BYTES; // Blue - break; - - default: - return 0; - } - return size; -} - -JausEvent jausEventCreate() -{ - JausEvent event; - event = (JausEvent) malloc(sizeof(JausEventStruct)); - - event->eventMessage = NULL; - event->eventId = 0; - event->previousLimitValue = jausEventLimitCreate(); - - return event; -} - -void jausEventDestroy(JausEvent event) -{ - // Note event->eventMessage needs to be freed - /*if(event->eventMessage)*/ createEventMessageDestroy(event->eventMessage); - - jausEventLimitDestroy(event->previousLimitValue); - free(event); -} diff --git a/lib/openjaus/libjaus/src/type/jausFloat.c b/lib/openjaus/libjaus/src/type/jausFloat.c deleted file mode 100644 index 8270ec51758dff09ca9a0f26d2734a42812e5e59..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausFloat.c +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausFloat.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausFloat funtionality, this should be primarily used through the JausType file and its methods - -#include -#include -#include "jaus.h" - -JausFloat newJausFloat(float val) -{ - return val; -} - -// Returns success or failed -JausBoolean jausFloatFromBuffer(JausFloat *jFloat, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; - unsigned int tempInt = 0; -#endif - float tempFloat = 0.0; - - if(bufferSizeBytes < JAUS_FLOAT_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for(i = 0; i < JAUS_FLOAT_SIZE_BYTES; i++) - { - tempInt += (buf[i] << (JAUS_FLOAT_SIZE_BYTES-i-1)*8); - } - memcpy(&(tempFloat), &(tempInt), JAUS_FLOAT_SIZE_BYTES); -#else - memcpy(&(tempFloat), buf, JAUS_FLOAT_SIZE_BYTES); -#endif - - *jFloat = newJausFloat(tempFloat); - return JAUS_TRUE; - } -} - -JausBoolean jausFloatToBuffer(JausFloat input, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; - unsigned int tempInt = 0; -#endif - - if(bufferSizeBytes < JAUS_FLOAT_SIZE_BYTES) - return JAUS_FALSE; - else - { -#ifdef JAUS_BIG_ENDIAN - memcpy(&(tempInt), &(input), JAUS_FLOAT_SIZE_BYTES); - - // swap bytes - for (i = 0; i < JAUS_FLOAT_SIZE_BYTES; i++) - buf[i] = ((tempInt >> (JAUS_FLOAT_SIZE_BYTES-i-1)*8) & 0xFF); // 8 bits per byte -#else - memcpy(buf, &(input), JAUS_FLOAT_SIZE_BYTES); -#endif - return JAUS_TRUE; - } -} diff --git a/lib/openjaus/libjaus/src/type/jausGeometryPointLLA.c b/lib/openjaus/libjaus/src/type/jausGeometryPointLLA.c deleted file mode 100644 index e432d12c9c36b4dff0e3d9c3147b2188da4d06f4..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausGeometryPointLLA.c +++ /dev/null @@ -1,68 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausGeometryPointLLA.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functions of a JausGeometryPointLLA Object - -#include -#include "jaus.h" - -JausGeometryPointLLA jausGeometryPointLLACreate(void) -{ - JausGeometryPointLLA jausGeometryPointLLA; - - jausGeometryPointLLA = (JausGeometryPointLLA)malloc(sizeof(JausGeometryPointLLAStruct)); - - if(jausGeometryPointLLA) - { - jausGeometryPointLLA->latitudeRadians = 0.0; - jausGeometryPointLLA->longitudeRadians = 0.0; - jausGeometryPointLLA->altitudeMeters = 0.0; - - return jausGeometryPointLLA; - } - else - return NULL; -} - -void jausGeometryPointLLADestroy(JausGeometryPointLLA jausGeometryPointLLA) -{ - free(jausGeometryPointLLA); -} diff --git a/lib/openjaus/libjaus/src/type/jausGeometryPointXYZ.c b/lib/openjaus/libjaus/src/type/jausGeometryPointXYZ.c deleted file mode 100644 index a55901a54fbd5c6b534b478e5a35d39356c42623..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausGeometryPointXYZ.c +++ /dev/null @@ -1,68 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausGeometryPointXYZ.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functions of a JausGeometryPointXYZ Object - -#include -#include "jaus.h" - -JausGeometryPointXYZ jausGeometryPointXYZCreate(void) -{ - JausGeometryPointXYZ jausGeometryPointXYZ; - - jausGeometryPointXYZ = (JausGeometryPointXYZ)malloc(sizeof(JausGeometryPointXYZStruct)); - - if(jausGeometryPointXYZ) - { - jausGeometryPointXYZ->x = 0.0; - jausGeometryPointXYZ->y = 0.0; - jausGeometryPointXYZ->z = 0.0; - - return jausGeometryPointXYZ; - } - else - return NULL; -} - -void jausGeometryPointXYZDestroy(JausGeometryPointXYZ jausGeometryPointXYZ) -{ - free(jausGeometryPointXYZ); -} diff --git a/lib/openjaus/libjaus/src/type/jausInteger.c b/lib/openjaus/libjaus/src/type/jausInteger.c deleted file mode 100644 index b3b653765f72d7fb57aec0482d6ff33eb07268e1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausInteger.c +++ /dev/null @@ -1,127 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausInteger.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausFloat funtionality, this should be primarily used through the JausType file and its methods - -#include -#include -#include "jaus.h" - -JausInteger newJausInteger(int val) -{ - return val; -} - -JausBoolean jausIntegerFromBuffer(JausInteger *jInteger, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; -#endif - int tempInt = 0; - - if(bufferSizeBytes < JAUS_INTEGER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for(i = 0; i < JAUS_INTEGER_SIZE_BYTES; i++) - { - tempInt += (buf[i] << (JAUS_INTEGER_SIZE_BYTES-i-1)*8); - } -#else - memcpy(&(tempInt), buf, JAUS_INTEGER_SIZE_BYTES); -#endif - - *jInteger = newJausInteger(tempInt); - return JAUS_TRUE; - } -} - -JausBoolean jausIntegerToBuffer(JausInteger input, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; -#endif - - if(bufferSizeBytes < JAUS_INTEGER_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for (i = 0; i < JAUS_INTEGER_SIZE_BYTES; i++) - { - buf[i] = ((input >> (JAUS_INTEGER_SIZE_BYTES-i-1)*8) & 0xFF); // 8 bits per byte - } -#else - memcpy(buf, &(input), JAUS_INTEGER_SIZE_BYTES); -#endif - return JAUS_TRUE; - } -} - -double jausIntegerToDouble(JausInteger input, double min, double max) -{ - // BUG: What to do when max < min - double scaleFactor = (max-min)/JAUS_INTEGER_RANGE; - double bias = (max+min)/2.0; - - return input*scaleFactor + bias; -} - -JausInteger jausIntegerFromDouble(double value, double min, double max) -{ - //limit value between min and max Int values - double scaleFactor = (max-min)/JAUS_INTEGER_RANGE; - double bias = (max+min)/2.0; - - // limit real number between min and max - if(value < min) value = min; - if(value > max) value = max; - - // return rounded integer value - return newJausInteger((int)((value - bias)/scaleFactor + 0.5)); -} diff --git a/lib/openjaus/libjaus/src/type/jausLong.c b/lib/openjaus/libjaus/src/type/jausLong.c deleted file mode 100644 index 96c4a0e78957db88ac410edf113a73ab66f06266..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausLong.c +++ /dev/null @@ -1,127 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausLong.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausLong funtionality, this should be primarily used through the JausType file and its methods - -#include -#include -#include "jaus.h" - -JausLong newJausLong(long long val) -{ - return val; -} - -JausBoolean jausLongFromBuffer(JausLong *jLong, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; -#endif - long tempLong = 0; - - if(bufferSizeBytes < JAUS_LONG_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for(i = 0; i < JAUS_LONG_SIZE_BYTES; i++) - { - tempLong += (buf[i] << (JAUS_LONG_SIZE_BYTES-i-1)*8); - } -#else - memcpy(&(tempLong), buf, JAUS_LONG_SIZE_BYTES); -#endif - *jLong = newJausLong(tempLong); - return JAUS_TRUE; - } -} - -JausBoolean jausLongToBuffer(JausLong input, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; -#endif - - if(bufferSizeBytes < JAUS_LONG_SIZE_BYTES) - { - return JAUS_FALSE; - } - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for (i = 0; i < JAUS_LONG_SIZE_BYTES; i++) - { - buf[i] = (unsigned char)((input >> (JAUS_LONG_SIZE_BYTES-i-1)*8) & 0xFF); // 8 bits per byte - } -#else - memcpy(buf, &input, JAUS_LONG_SIZE_BYTES); -#endif - return JAUS_TRUE; - } -} - -double jausLongToDouble(JausLong input, double min, double max) -{ - // BUG: What to do when max < min - double scaleFactor = (max-min)/JAUS_LONG_RANGE; - double bias = (max+min)/2.0; - - return input*scaleFactor + bias; -} - -JausLong jausLongFromDouble(double value, double min, double max) -{ - // BUG: What to do when max < min - //limit value between min and max Long values - double scaleFactor = (max-min)/JAUS_LONG_RANGE; - double bias = (max+min)/2.0; - - // limit real number between min and max - if(value < min) value = min; - if(value > max) value = max; - - // return rounded integer value - return newJausLong((long)((value - bias)/scaleFactor + 0.5)); -} diff --git a/lib/openjaus/libjaus/src/type/jausMissionCommand.c b/lib/openjaus/libjaus/src/type/jausMissionCommand.c deleted file mode 100644 index 1c19ffe0ec2e57589ad4eea8f0f32f94288ccc57..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausMissionCommand.c +++ /dev/null @@ -1,172 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausMissionCommand.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: Stores a single jaus message in a task in a mission with the -// additional data fields associated with that message -// Modified by: Luke Roseberry (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS. - -#include -#include "jaus.h" - -// JausMissionCommand Constructor -JausMissionCommand missionCommandCreate(void) -{ - JausMissionCommand object; - - object = (JausMissionCommand) malloc(sizeof(JausMissionCommandStruct)); - if(object) - { - object->uid = newJausUnsignedShort(0); //Message unique ID - object->message = NULL; //The Jaus Message - object->blocking = newJausByte(0); //Indicates whether the message is blocking - //object->next = NULL; // The next JausMissionCommand for linked lists - return object; - } - else - { - return NULL; - } -} - -// JausMissionCommand Constructor (from Buffer) -JausBoolean missionCommandFromBuffer(JausMissionCommand *messagePointer, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - unsigned int index = 0; - JausMissionCommand message; - message = (JausMissionCommand) malloc(sizeof(JausMissionCommandStruct)); - *messagePointer = NULL; - if(message) - { - - // Read Unigue Id - if(!jausUnsignedShortFromBuffer(&message->uid, buffer+index, bufferSizeBytes-index)) - { - free(message); - return JAUS_FALSE; - } - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Read Jaus Message - message->message = jausMessageCreate(); - if(!jausMessageFromBuffer(message->message, buffer+index, bufferSizeBytes-index)) - { - free(message); - return JAUS_FALSE; - } - index += jausMessageSize(message->message); - - // Read blocking status - if(!jausByteFromBuffer(&message->blocking, buffer+index, bufferSizeBytes-index)) - { - free(message); - return JAUS_FALSE; - } - index += JAUS_BYTE_SIZE_BYTES; - - //message->next = NULL; - - *messagePointer = message; - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// JausMissionCommand To Buffer -JausBoolean missionCommandToBuffer(JausMissionCommand message, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - unsigned int index = 0; - - - if(message) - { - - // uid - if(!jausUnsignedShortToBuffer(message->uid, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Jaus Message - if(!jausMessageToBuffer(message->message, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += jausMessageSize(message->message); - - // Blocking status - if(!jausByteToBuffer(message->blocking, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - return JAUS_TRUE; - } - - return JAUS_FALSE; -} - -// JausMissionCommand Destructor -void missionCommandDestroy(JausMissionCommand object) -{ - if(object) - { - if(!object->message) - jausMessageDestroy(object->message); - - - free(object); - object = NULL; - } -} - -// JausMissionCommand Buffer Size -unsigned int missionCommandSize(JausMissionCommand object) -{ - unsigned int size = 0; - - if(object) - { - size += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //uid - - size += jausMessageSize(object->message); //Jaus Message - - size += JAUS_BYTE_SIZE_BYTES; // Blocking status - } - return size; -} - diff --git a/lib/openjaus/libjaus/src/type/jausMissionTask.c b/lib/openjaus/libjaus/src/type/jausMissionTask.c deleted file mode 100644 index 30b2add04960d6b190cf90cdbe6c18ce5634d222..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausMissionTask.c +++ /dev/null @@ -1,294 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausMissionTask.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: Stores a jaus task in a mission with the -// additional data fields associated with that task -// Modified by: Luke Roseberry (MountainTop Technology, Inc) to add Planner -// messages to OpenJAUS. - -#include -#include -#include -#include "jaus.h" -#include "type/jausMissionTask.h" - -// JausMissionTask Constructor -JausMissionTask missionTaskCreate(void) -{ - JausMissionTask object; - - object = (JausMissionTask) malloc(sizeof(JausMissionTaskStruct)); - if(object) - { - object->taskId = newJausUnsignedShort(0); //Message unique ID - object->commands = jausArrayCreate(); //List of JausMissionCommand structures for messages - object->children = jausArrayCreate(); //List of JausMissionTask structures signifying the children tasks of this task - object->bufferOffset = newJausInteger(0); //Internal variable used for ToBuffer processing - return object; - } - else - { - return NULL; - } -} - -// JausMissionTask Constructor (from Buffer) -JausBoolean missionTaskFromBuffer(JausMissionTask *taskPointer, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - unsigned int index = 0; - JausUnsignedShort numChildren = 0; - JausUnsignedShort numMessages = 0; - JausUnsignedInteger *childIndex = NULL; - JausMissionTask task; - JausMissionTask tempTask; - JausMissionCommand tempCmd = NULL; - int i = 0; - - task = missionTaskCreate();//(JausMissionTask) malloc(sizeof(JausMissionTaskStruct)); - *taskPointer = NULL; - if(task) - { - // Read task Unique Id - if(!jausUnsignedShortFromBuffer(&task->taskId, buffer+index, bufferSizeBytes-index)) - { - free(task); - return JAUS_FALSE; - } - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Read the number of child tasks - if(!jausUnsignedShortFromBuffer(&numChildren, buffer+index, bufferSizeBytes-index)) - { - free(task); - return JAUS_FALSE; - } - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - childIndex = (JausUnsignedInteger*) malloc(JAUS_UNSIGNED_INTEGER_SIZE_BYTES * numChildren); - - for( i = 0; icommands, tempCmd); - - tempCmd = NULL; - } - - // Read the child tasks - for( i = 0; ichildren, tempTask); - - tempTask = NULL; - } - - *taskPointer = task; - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// JausMissionTask To Buffer -JausBoolean missionTaskToBuffer(JausMissionTask task, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - int i = 0; - unsigned int index = 0; - JausUnsignedShort tempCount = 0; - JausUnsignedInteger childIndex; - - if(task) - { - // Write task Unique Id - if(!jausUnsignedShortToBuffer(task->taskId, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - if(task->children->elementCount > JAUS_UNSIGNED_SHORT_MAX_VALUE) - { - return JAUS_FALSE; - } - else - { - tempCount = task->children->elementCount; - } - // Write the number of child tasks - if(!jausUnsignedShortToBuffer(tempCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - childIndex = task->bufferOffset; //Offset into message where this task started - childIndex += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //task Id - childIndex += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //Number of children - childIndex += JAUS_UNSIGNED_INTEGER_SIZE_BYTES * task->children->elementCount; //Children Indexes - childIndex += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //Number of messages - //Size of all messages - for( i = 0; icommands->elementCount; i++) - { - childIndex += missionCommandSize(task->commands->elementData[i]); - } - - // Write all the child indexes - for( i = 0; ichildren->elementCount; i++) - { - // Write a child index - if(!jausUnsignedIntegerToBuffer(childIndex, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - if(i < task->children->elementCount-1) - { - childIndex += missionTaskSize(task->children->elementData[i]); - } - index += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - } - - if( task->commands->elementCount > JAUS_UNSIGNED_SHORT_MAX_VALUE) - { - return JAUS_FALSE; - } - else - { - tempCount = task->commands->elementCount; - } - // Write the number of messages - if(!jausUnsignedShortToBuffer(tempCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // Write the messages - for( i = 0; icommands->elementCount; i++) - { - // Write a command structure - if(!missionCommandToBuffer(task->commands->elementData[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += missionCommandSize(task->commands->elementData[i]); - - } - - // Write the child tasks - for( i = 0; ichildren->elementCount; i++) - { - // Write a task structure - ((JausMissionTask)task->children->elementData[i])->bufferOffset = index; - if(!missionTaskToBuffer(task->children->elementData[i], buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += missionTaskSize(task->children->elementData[i]); - } - return JAUS_TRUE; - } - - return JAUS_FALSE; -} - -// JausMissionTask Destructor -void missionTaskDestroy(JausMissionTask object) -{ - if(object) - { - jausArrayDestroy(object->commands, (void*)missionCommandDestroy); - jausArrayDestroy(object->children, (void*)missionTaskDestroy); - - free(object); - object = NULL; - } -} - -// JausMissionTask Buffer Size -unsigned int missionTaskSize(JausMissionTask object) -{ - unsigned int size = 0; - int i = 0; - if(object) - { - size += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //task Id - size += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //Number of children - size += JAUS_UNSIGNED_INTEGER_SIZE_BYTES * object->children->elementCount; //Children Indexes - size += JAUS_UNSIGNED_SHORT_SIZE_BYTES; //Number of messages - //Size of all messages - for( i = 0; icommands->elementCount; i++) - { - size += missionCommandSize(object->commands->elementData[i]); - } - //Size of all the child tasks - for( i = 0; ichildren->elementCount; i++) - { - size += missionTaskSize(object->children->elementData[i]); - } - } - return size; -} - diff --git a/lib/openjaus/libjaus/src/type/jausShort.c b/lib/openjaus/libjaus/src/type/jausShort.c deleted file mode 100644 index 7cf813a4b1187a0b6e29bbc9d2730cbd8550ea85..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausShort.c +++ /dev/null @@ -1,118 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausShort.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausShort funtionality, this should be primarily used through the JausType file and its methods - -#include -#include -#include "jaus.h" - -JausShort newJausShort(short val) -{ - return val; -} - -JausBoolean jausShortFromBuffer(JausShort *jShort, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; -#endif - short tempShort = 0; - - if(bufferSizeBytes < JAUS_SHORT_SIZE_BYTES) - return JAUS_FALSE; - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for(i = 0; i < JAUS_SHORT_SIZE_BYTES; i++) - tempShort += (buf[i] << (JAUS_SHORT_SIZE_BYTES-i-1)*8); -#else - memcpy(&(tempShort), buf, JAUS_SHORT_SIZE_BYTES); -#endif - *jShort = newJausShort(tempShort); - return JAUS_TRUE; - } -} - -JausBoolean jausShortToBuffer(JausShort input, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; -#endif - - if(bufferSizeBytes < JAUS_SHORT_SIZE_BYTES) - return JAUS_FALSE; - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for (i = 0; i < JAUS_SHORT_SIZE_BYTES; i++) - buf[i] = ((input >> (JAUS_SHORT_SIZE_BYTES-i-1)*8) & 0xFF); // 8 bits per byte -#else - memcpy(buf, &input, JAUS_SHORT_SIZE_BYTES); -#endif - return JAUS_TRUE; - } -} - -double jausShortToDouble(JausShort input, double min, double max) -{ - // BUG: What to do when max < min - double scaleFactor = (max-min)/JAUS_SHORT_RANGE; - double bias = (max+min)/2.0; - - return input*scaleFactor + bias; -} - -JausShort jausShortFromDouble(double value, double min, double max) -{ - //limit value between min and max Short values - double scaleFactor = (max-min)/JAUS_SHORT_RANGE; - double bias = (max+min)/2.0; - - // limit real number between min and max - if(value < min) value = min; - if(value > max) value = max; - - // calculate rounded integer value - return newJausShort((short)((value - bias)/scaleFactor + 0.5)); -} diff --git a/lib/openjaus/libjaus/src/type/jausTime.c b/lib/openjaus/libjaus/src/type/jausTime.c deleted file mode 100644 index a74fc3a87b7d8f6df0375c1f25e6b583dad03677..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausTime.c +++ /dev/null @@ -1,246 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausTime.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the functionality of a JausTime object - -#include -#include -#include -#include "jaus.h" - -// Private Function Prototypes -JausBoolean calculateTimeStamp(JausTime time); -JausBoolean calculateDateStamp(JausTime time); - -JausTime jausTimeCreate(void) -{ - JausTime time = (JausTime)malloc(sizeof(JausTimeStruct)); - - time->timeStamp = newJausUnsignedInteger(0); - time->dateStamp = newJausUnsignedShort(0); - - time->millisec = newJausUnsignedShort(0); - time->second = newJausUnsignedShort(0); - time->minute = newJausUnsignedShort(0); - time->hour = newJausUnsignedShort(0); - time->day = newJausUnsignedShort(0); - time->month = newJausUnsignedShort(0); - time->year = newJausUnsignedShort(0); - - return time; -} - -void jausTimeDestroy(JausTime time) -{ - free(time); -} - -JausTime jausTimeClone(JausTime time) -{ - JausTime newTime = (JausTime)malloc(sizeof(JausTimeStruct)); - - if (newTime) - { - newTime->timeStamp = time->timeStamp; - newTime->dateStamp = time->dateStamp; - - newTime->millisec = time->millisec; - newTime->second = time->second; - newTime->minute = time->minute; - newTime->hour = time->hour; - newTime->day = time->day; - newTime->month = time->month; - newTime->year = time->year; - } - - return newTime; -} - - -JausBoolean jausTimeCopy(JausTime dstTime, JausTime srcTime) -{ - if (!dstTime || !srcTime) - { - return JAUS_FALSE; - } - - dstTime->timeStamp = srcTime->timeStamp; - dstTime->dateStamp = srcTime->dateStamp; - - dstTime->millisec = srcTime->millisec; - dstTime->second = srcTime->second; - dstTime->minute = srcTime->minute; - dstTime->hour = srcTime->hour; - dstTime->day = srcTime->day; - dstTime->month = srcTime->month; - dstTime->year = srcTime->year; - - return JAUS_TRUE; -} - - -JausBoolean jausTimeSetCurrentTime(JausTime jausTime) -{ - struct tm *gmTime; - time_t timeVal; - - // Get SystemTime - time(&timeVal); - - gmTime = gmtime(&timeVal); - - // Populate members - jausTime->millisec = (unsigned short) 0; - jausTime->second = (unsigned short) gmTime->tm_sec; - jausTime->minute = (unsigned short) gmTime->tm_min; - jausTime->hour = (unsigned short) gmTime->tm_hour; - jausTime->day = (unsigned short) gmTime->tm_mday; - jausTime->month = (unsigned short) gmTime->tm_mon; - jausTime->year = (unsigned short) gmTime->tm_year + 1900; - - // Calculate TimeStamp & DataStamp - calculateTimeStamp(jausTime); - calculateDateStamp(jausTime); - - return JAUS_TRUE; -} - -JausBoolean jausTimeToString(JausTime time, char *buffer, size_t buffSize) -{ - const char *months[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; - - if(time) - { - sprintf(buffer, "%s %02d, %04d %02d:%02d:%02d.%d\n", months[time->month], time->day, time->year, time->hour, time->minute, time->second, time->millisec); - return JAUS_TRUE; - } - else - return JAUS_FALSE; -} - -JausBoolean jausTimeStampFromBuffer(JausTime input, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - // Unpack TimeStamp - if(!jausUnsignedIntegerFromBuffer(&input->timeStamp, buffer, bufferSizeBytes)) return JAUS_FALSE; - - // Calculate Members from TimeStamp - input->millisec = (input->timeStamp >> JAUS_TIME_STAMP_MILLISEC_SHIFT) & JAUS_TIME_STAMP_MILLISEC_MASK; - input->second = (input->timeStamp >> JAUS_TIME_STAMP_SECOND_SHIFT) & JAUS_TIME_STAMP_SECOND_MASK; - input->minute = (input->timeStamp >> JAUS_TIME_STAMP_MINUTE_SHIFT) & JAUS_TIME_STAMP_MINUTE_MASK; - input->hour = (input->timeStamp >> JAUS_TIME_STAMP_HOUR_SHIFT) & JAUS_TIME_STAMP_HOUR_MASK; - input->day = (input->timeStamp >> JAUS_TIME_STAMP_DAY_SHIFT) & JAUS_TIME_STAMP_DAY_MASK; - - return JAUS_TRUE; -} - -JausBoolean jausDateStampFromBuffer(JausTime input, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - // Unpack DateStamp - if(!jausUnsignedShortFromBuffer(&input->dateStamp, buffer, bufferSizeBytes)) return JAUS_FALSE; - - // Calculate Members from DateStamp - input->day = (input->dateStamp >> JAUS_DATE_STAMP_DAY_SHIFT) & JAUS_DATE_STAMP_DAY_MASK; - input->month = (input->dateStamp >> JAUS_DATE_STAMP_MONTH_SHIFT) & JAUS_DATE_STAMP_MONTH_MASK; - input->year = (input->dateStamp >> JAUS_DATE_STAMP_YEAR_SHIFT) & JAUS_DATE_STAMP_YEAR_MASK; - - return JAUS_TRUE; -} - -JausBoolean jausTimeStampToBuffer(JausTime input, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - // Calculate TimeStamp - calculateTimeStamp(input); - - // Pack TimeStamp - if(!jausUnsignedIntegerToBuffer(input->timeStamp, buffer, bufferSizeBytes)) return JAUS_FALSE; - - return JAUS_TRUE; -} - -JausBoolean jausDateStampToBuffer(JausTime input, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - // Calculate DateStamp - calculateDateStamp(input); - - // Pack TimeStamp - if(!jausUnsignedShortToBuffer(input->dateStamp, buffer, bufferSizeBytes)) return JAUS_FALSE; - - return JAUS_TRUE; -} - -JausUnsignedInteger jausTimeGetTimeStamp(JausTime time) -{ - // Calculate TimeStamp - calculateTimeStamp(time); - - return time->timeStamp; -} - -JausUnsignedShort jausTimeGetDateStamp(JausTime time) -{ - // Calculate DateStamp - calculateDateStamp(time); - - return time->dateStamp; -} - -// Private Functions -JausBoolean calculateTimeStamp(JausTime time) -{ - time->timeStamp = 0; - time->timeStamp |= (time->millisec & JAUS_TIME_STAMP_MILLISEC_MASK) << JAUS_TIME_STAMP_MILLISEC_SHIFT; - time->timeStamp |= (time->second & JAUS_TIME_STAMP_SECOND_MASK) << JAUS_TIME_STAMP_SECOND_SHIFT; - time->timeStamp |= (time->minute & JAUS_TIME_STAMP_MINUTE_MASK) << JAUS_TIME_STAMP_MINUTE_SHIFT; - time->timeStamp |= (time->hour & JAUS_TIME_STAMP_HOUR_MASK) << JAUS_TIME_STAMP_HOUR_SHIFT; - time->timeStamp |= (time->day & JAUS_TIME_STAMP_DAY_MASK) << JAUS_TIME_STAMP_DAY_SHIFT; - - return JAUS_TRUE; -} - -JausBoolean calculateDateStamp(JausTime time) -{ - time->dateStamp = 0; - time->dateStamp |= (time->day & JAUS_DATE_STAMP_DAY_MASK) << JAUS_DATE_STAMP_DAY_SHIFT; - time->dateStamp |= (time->month & JAUS_DATE_STAMP_MONTH_MASK) << JAUS_DATE_STAMP_MONTH_SHIFT; - time->dateStamp |= (time->year & JAUS_DATE_STAMP_YEAR_MASK) << JAUS_DATE_STAMP_YEAR_SHIFT; - - return JAUS_TRUE; -} diff --git a/lib/openjaus/libjaus/src/type/jausUnsignedInteger.c b/lib/openjaus/libjaus/src/type/jausUnsignedInteger.c deleted file mode 100644 index b3b5eb03ea00e8b9eee1b8d45942a4d621e73533..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausUnsignedInteger.c +++ /dev/null @@ -1,150 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausUnsignedInteger.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausUnsignedInteger funtionality, this should be primarily used through the JausType file and its methods - -#include -#include -#include "jaus.h" - -JausUnsignedInteger newJausUnsignedInteger(unsigned int val) -{ - return val; -} - -JausBoolean jausUnsignedIntegerFromBuffer(JausUnsignedInteger *jUint, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; -#endif - unsigned int tempUInt = 0; - - if(bufferSizeBytes < JAUS_UNSIGNED_INTEGER_SIZE_BYTES) - return JAUS_FALSE; - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for(i = 0; i < JAUS_UNSIGNED_INTEGER_SIZE_BYTES; i++) - tempUInt += (buf[i] << (JAUS_UNSIGNED_INTEGER_SIZE_BYTES-i-1)*8); -#else - memcpy(&(tempUInt), buf, JAUS_UNSIGNED_INTEGER_SIZE_BYTES); -#endif - *jUint = newJausUnsignedInteger(tempUInt); - return JAUS_TRUE; - } -} - -JausBoolean jausUnsignedIntegerToBuffer(JausUnsignedInteger input, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; -#endif - - if(bufferSizeBytes < JAUS_UNSIGNED_INTEGER_SIZE_BYTES) - return JAUS_FALSE; - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for (i = 0; i < JAUS_UNSIGNED_INTEGER_SIZE_BYTES; i++) - buf[i] = ((input >> (JAUS_UNSIGNED_INTEGER_SIZE_BYTES-i-1)*8) & 0xFF); // 8 bits per byte -#else - memcpy(buf, &input, JAUS_UNSIGNED_INTEGER_SIZE_BYTES); -#endif - return JAUS_TRUE; - } -} - -double jausUnsignedIntegerToDouble(JausUnsignedInteger input, double min, double max) -{ - // BUG: What to do when max < min - double scaleFactor = (max-min)/JAUS_UNSIGNED_INTEGER_RANGE; - double bias = min; - - return input*scaleFactor + bias; -} - -JausUnsignedInteger jausUnsignedIntegerFromDouble(double value, double min, double max) -{ - //limit value between min and max UnsignedInteger values - double scaleFactor = (max-min)/JAUS_UNSIGNED_INTEGER_RANGE; - double bias = min; - - // limit real number between min and max - if(value < min) value = min; - if(value > max) value = max; - - // calculate rounded integer value - return newJausUnsignedInteger((unsigned int)((value - bias)/scaleFactor + 0.5)); -} - -JausBoolean jausUnsignedIntegerIsBitSet(JausUnsignedInteger input, int bit) -{ - return (input & (0x01 << bit)) > 0 ? JAUS_TRUE : JAUS_FALSE; -} - -JausBoolean jausUnsignedIntegerSetBit(JausUnsignedInteger *input, int bit) -{ - if(JAUS_UNSIGNED_INTEGER_SIZE_BYTES*8 < bit) // 8 bits per byte - { - return JAUS_FALSE; - } - else - { - *input |= 0x01 << bit; - return JAUS_TRUE; - } -} - -JausBoolean jausUnsignedIntegerClearBit(JausUnsignedInteger *input, int bit) -{ - if(JAUS_UNSIGNED_INTEGER_SIZE_BYTES*8 < bit) - { - return JAUS_FALSE; - } - else - { - *input &= ~(0x01 << bit); - return JAUS_TRUE; - } -} - diff --git a/lib/openjaus/libjaus/src/type/jausUnsignedLong.c b/lib/openjaus/libjaus/src/type/jausUnsignedLong.c deleted file mode 100644 index ab33fa8a23dd49abe21e44f5b1b8af1581fb60df..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausUnsignedLong.c +++ /dev/null @@ -1,118 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausUnsignedLong.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausUnsignedLong funtionality, this should be primarily used through the JausType file and its methods - -#include -#include -#include "jaus.h" - -JausUnsignedLong newJausUnsignedLong(unsigned long long val) -{ - return val; -} - -JausBoolean jausUnsignedLongFromBuffer(JausUnsignedLong *jULong, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; -#endif - unsigned long tempULong = 0; - - if(bufferSizeBytes < JAUS_UNSIGNED_LONG_SIZE_BYTES) - return JAUS_FALSE; - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for(i = 0; i < JAUS_UNSIGNED_LONG_SIZE_BYTES; i++) - tempULong += (buf[i] << (JAUS_UNSIGNED_LONG_SIZE_BYTES-i-1)*8); -#else - memcpy(&(tempULong), buf, JAUS_UNSIGNED_LONG_SIZE_BYTES); -#endif - *jULong = newJausUnsignedLong(tempULong); - return JAUS_TRUE; - } -} - -JausBoolean jausUnsignedLongToBuffer(JausUnsignedLong input, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; -#endif - if(bufferSizeBytes < JAUS_UNSIGNED_LONG_SIZE_BYTES) - return JAUS_FALSE; - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for (i = 0; i < JAUS_UNSIGNED_LONG_SIZE_BYTES; i++) - buf[i] = (unsigned int)((input >> (JAUS_UNSIGNED_LONG_SIZE_BYTES-i-1)*8) & 0xFF); // 8 bits per byte -#else - memcpy(buf, &input, JAUS_UNSIGNED_LONG_SIZE_BYTES); -#endif - return JAUS_TRUE; - } -} - -double jausUnsignedLongToDouble(JausUnsignedLong input, double min, double max) -{ - // BUG: What to do when max < min - double scaleFactor = (max-min)/JAUS_UNSIGNED_LONG_RANGE; - double bias = min; - - return input*scaleFactor + bias; -} - -JausUnsignedLong jausUnsignedLongFromDouble(double value, double min, double max) -{ - //limit value between min and max UnsignedLong values - double scaleFactor = (max-min)/JAUS_UNSIGNED_LONG_RANGE; - double bias = min; - - // limit real number between min and max - if(value < min) value = min; - if(value > max) value = max; - - // calculate rounded integer value - return newJausUnsignedLong((unsigned long)((value - bias)/scaleFactor + 0.5)); -} - diff --git a/lib/openjaus/libjaus/src/type/jausUnsignedShort.c b/lib/openjaus/libjaus/src/type/jausUnsignedShort.c deleted file mode 100644 index a740e1228ed26ba0dad56316a460ce3dec0d6c01..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausUnsignedShort.c +++ /dev/null @@ -1,153 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausUnsignedShort.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines all the basic JausUnsignedShort funtionality, this should be primarily used through the JausType file and its methods - -#include -#include -#include "jaus.h" - -JausUnsignedShort newJausUnsignedShort(unsigned short val) -{ - return val; -} - -JausBoolean jausUnsignedShortFromBuffer(JausUnsignedShort *jUShort, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; -#endif - unsigned short tempUShort = 0; - - if(bufferSizeBytes < JAUS_UNSIGNED_SHORT_SIZE_BYTES) - return JAUS_FALSE; - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for(i = 0; i < JAUS_UNSIGNED_SHORT_SIZE_BYTES; i++) - { - tempUShort += (buf[i] << (JAUS_UNSIGNED_SHORT_SIZE_BYTES-i-1)*8); - } -#else - memcpy(&(tempUShort), buf, JAUS_UNSIGNED_SHORT_SIZE_BYTES); -#endif - *jUShort = newJausUnsignedShort(tempUShort); - return JAUS_TRUE; - } -} - -JausBoolean jausUnsignedShortToBuffer(JausUnsignedShort input, unsigned char *buf, unsigned int bufferSizeBytes) -{ -#ifdef JAUS_BIG_ENDIAN - int i = 0; -#endif - - if(bufferSizeBytes < JAUS_UNSIGNED_SHORT_SIZE_BYTES) - return JAUS_FALSE; - else - { -#ifdef JAUS_BIG_ENDIAN - // swap bytes - for (i = 0; i < JAUS_UNSIGNED_SHORT_SIZE_BYTES; i++) - { - buf[i] = ((input >> (JAUS_UNSIGNED_SHORT_SIZE_BYTES-i-1)*8) & 0xFF); // 8 bits per byte - } -#else - memcpy(buf, &input, JAUS_UNSIGNED_SHORT_SIZE_BYTES); -#endif - return JAUS_TRUE; - } -} - -double jausUnsignedShortToDouble(JausUnsignedShort input, double min, double max) -{ - // BUG: What to do when max < min - double scaleFactor = (max-min)/JAUS_UNSIGNED_SHORT_RANGE; - double bias = min; - - return input*scaleFactor + bias; -} - -JausUnsignedShort jausUnsignedShortFromDouble(double value, double min, double max) -{ - //limit value between min and max UnsignedShort values - double scaleFactor = (max-min)/JAUS_UNSIGNED_SHORT_RANGE; - double bias = min; - - // limit real number between min and max - if(value < min) value = min; - if(value > max) value = max; - - // calculate rounded integer value - return newJausUnsignedShort((unsigned short)((value - bias)/scaleFactor + 0.5)); -} - -JausBoolean jausUnsignedShortIsBitSet(JausUnsignedShort input, int bit) -{ - return (input & (0x01 << bit)) > 0 ? JAUS_TRUE : JAUS_FALSE; -} - -JausBoolean jausUnsignedShortSetBit(JausUnsignedShort *input, int bit) -{ - if(JAUS_UNSIGNED_SHORT_SIZE_BYTES*8 < bit) // 8 bits per byte - { - return JAUS_FALSE; - } - else - { - *input |= 0x01 << bit; - return JAUS_TRUE; - } -} - -JausBoolean jausUnsignedShortClearBit(JausUnsignedShort *input, int bit) -{ - if(JAUS_UNSIGNED_SHORT_SIZE_BYTES*8 < bit) // 8 bits per byte - { - return JAUS_FALSE; - } - else - { - *input &= ~(0x01 << bit); - return JAUS_TRUE; - } -} diff --git a/lib/openjaus/libjaus/src/type/jausWorldModelFeatureClass.c b/lib/openjaus/libjaus/src/type/jausWorldModelFeatureClass.c deleted file mode 100644 index f265894fdd7f72be1b7cbc5e4c25d4b0a846ff3b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausWorldModelFeatureClass.c +++ /dev/null @@ -1,565 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausWorldModelFeatureClass.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#include -#include -#include -#include "jaus.h" - -// JausWorldModelFeatureClass Constructor -JausWorldModelFeatureClass featureClassCreate(void) -{ - JausWorldModelFeatureClass fcClass; - fcClass = (JausWorldModelFeatureClass) malloc(sizeof(JausWorldModelFeatureClassStruct)); - if(fcClass) - { - fcClass->id = newJausUnsignedShort(0); // Enumeration, defined by system - memset(fcClass->metaData, 0, JAUS_WM_FC_METADATA_STRING_LENGTH); // String of Metadata information defined for this Feature Class - fcClass->attribute = featureClassAttributeCreate(); // Feature Class Attribute data type and value - return fcClass; - } - else - { - return NULL; - } -} - -// JausWorldModelFeatureClass Constructor (from Buffer) -JausWorldModelFeatureClass featureClassFromBuffer(unsigned char *buffer, unsigned int bufferSizeBytes) -{ - unsigned int index = 0; - JausWorldModelFeatureClass fcClass; - - fcClass = (JausWorldModelFeatureClass) malloc(sizeof(JausWorldModelFeatureClassStruct)); - if(fcClass) - { - if(!jausUnsignedShortFromBuffer(&fcClass->id, buffer+index, bufferSizeBytes-index)) - { - free(fcClass); - return NULL; - } - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - fcClass->attribute = featureClassAttributeFromBuffer(buffer+index, bufferSizeBytes-index); - if(!fcClass->attribute) - { - free(fcClass); - return NULL; - } - - return fcClass; - } - else - { - return NULL; - } -} - -// JausWorldModelFeatureClass To Buffer -JausBoolean featureClassToBuffer(JausWorldModelFeatureClass fcClass, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - unsigned int index = 0; - - if(fcClass) - { - // FC Id - if(!jausUnsignedShortToBuffer(fcClass->id, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - // FC Attribute Data Type & Value - if(!featureClassAttributeToBuffer(fcClass->attribute, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - } - return JAUS_FALSE; -} - -// JausWorldModelFeatureClass Destructor -void featureClassDestroy(JausWorldModelFeatureClass fcClass) -{ - if(fcClass) - { - featureClassAttributeDestroy(fcClass->attribute); - free(fcClass); - fcClass = NULL; - } -} - -// JausWorldModelFeatureClass Buffer Size -unsigned int featureClassSizeBytes(JausWorldModelFeatureClass fcClass) -{ - unsigned int size = 0; - - if(fcClass) - { - size += JAUS_UNSIGNED_SHORT_SIZE_BYTES; // Class Id - size += featureClassAttributeSizeBytes(fcClass->attribute); // Size of attribute & data type - } - return size; -} - -// JausWorldModelFeatureClass Copy -JausWorldModelFeatureClass featureClassCopy(JausWorldModelFeatureClass fcClass) -{ - JausWorldModelFeatureClass classCopy; - - classCopy = (JausWorldModelFeatureClass) malloc(sizeof(JausWorldModelFeatureClassStruct)); - if(classCopy) - { - memcpy(classCopy, fcClass, sizeof(JausWorldModelFeatureClassStruct)); - classCopy->attribute = featureClassAttributeCopy(fcClass->attribute); - if(!classCopy->attribute) - { - free(classCopy); - return NULL; - } - return classCopy; - } - else - { - return NULL; - } -} - -// JausWorldModelFeatureClassAttribute Constructor -JausWorldModelFeatureClassAttribute featureClassAttributeCreate(void) -{ - JausWorldModelFeatureClassAttribute attribute; - attribute = (JausWorldModelFeatureClassAttribute) malloc(sizeof(JausWorldModelFeatureClassAttributeStruct)); - if(attribute) - { - memset(attribute, 0, sizeof(JausWorldModelFeatureClassAttributeStruct)); - attribute->dataType = newJausByte(JAUS_WM_OBJECT_DEFAULT_DATA); - return attribute; - } - else - { - return NULL; - } -} - -// JausWorldModelFeatureClassAttribute Destructor -void featureClassAttributeDestroy(JausWorldModelFeatureClassAttribute attribute) -{ - if(attribute) - { - free(attribute); - attribute = NULL; - } -} - -// JausWorldModelFeatureClassAttribute Constructor (from Buffer) -JausWorldModelFeatureClassAttribute featureClassAttributeFromBuffer(unsigned char *buffer, unsigned int bufferSizeBytes) -{ - unsigned int index = 0; - JausWorldModelFeatureClassAttribute attribute; - - attribute = (JausWorldModelFeatureClassAttribute) malloc(sizeof(JausWorldModelFeatureClassAttributeStruct)); - if(attribute) - { - // Data Type - if(!jausByteFromBuffer(&attribute->dataType, buffer+index, bufferSizeBytes-index)) - { - free(attribute); - return NULL; - } - index += JAUS_BYTE_SIZE_BYTES; - - switch(attribute->dataType) - { - case JAUS_WM_OBJECT_BYTE_DATA: - if(!jausByteFromBuffer(&attribute->data.byteValue, buffer+index, bufferSizeBytes-index)) - { - free(attribute); - return NULL; - } - return attribute; - - case JAUS_WM_OBJECT_SHORT_DATA: - if(!jausShortFromBuffer(&attribute->data.shortValue, buffer+index, bufferSizeBytes-index)) - { - free(attribute); - return NULL; - } - return attribute; - - case JAUS_WM_OBJECT_INTEGER_DATA: - if(!jausIntegerFromBuffer(&attribute->data.integerValue, buffer+index, bufferSizeBytes-index)) - { - free(attribute); - return NULL; - } - return attribute; - - case JAUS_WM_OBJECT_LONG_DATA: - if(!jausLongFromBuffer(&attribute->data.longValue, buffer+index, bufferSizeBytes-index)) - { - free(attribute); - return NULL; - } - return attribute; - - case JAUS_WM_OBJECT_UNSIGNED_SHORT_DATA: - if(!jausUnsignedShortFromBuffer(&attribute->data.unsignedShortValue, buffer+index, bufferSizeBytes-index)) - { - free(attribute); - return NULL; - } - return attribute; - - case JAUS_WM_OBJECT_UNSIGNED_INTEGER_DATA: - if(!jausUnsignedIntegerFromBuffer(&attribute->data.unsignedIntegerValue, buffer+index, bufferSizeBytes-index)) - { - free(attribute); - return NULL; - } - return attribute; - - case JAUS_WM_OBJECT_UNSIGNED_LONG_DATA: - if(!jausUnsignedLongFromBuffer(&attribute->data.unsignedLongValue, buffer+index, bufferSizeBytes-index)) - { - free(attribute); - return NULL; - } - return attribute; - - case JAUS_WM_OBJECT_FLOAT_DATA: - if(!jausFloatFromBuffer(&attribute->data.floatValue, buffer+index, bufferSizeBytes-index)) - { - free(attribute); - return NULL; - } - return attribute; - - case JAUS_WM_OBJECT_DOUBLE_DATA: - if(!jausDoubleFromBuffer(&attribute->data.doubleValue, buffer+index, bufferSizeBytes-index)) - { - free(attribute); - return NULL; - } - return attribute; - - break; - - case JAUS_WM_OBJECT_RGB_DATA: - if(!jausByteFromBuffer(&attribute->data.rgb.redValue, buffer+index, bufferSizeBytes-index)) - { - free(attribute); - return NULL; - } - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&attribute->data.rgb.greenValue, buffer+index, bufferSizeBytes-index)) - { - free(attribute); - return NULL; - } - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteFromBuffer(&attribute->data.rgb.blueValue, buffer+index, bufferSizeBytes-index)) - { - free(attribute); - return NULL; - } - index += JAUS_BYTE_SIZE_BYTES; - - return attribute; - - default: - free(attribute); - return NULL; - } - } - else - { - return NULL; - } -} - -// JausWorldModelFeatureClassAttribute To Buffer -JausBoolean featureClassAttributeToBuffer(JausWorldModelFeatureClassAttribute attribute, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - unsigned int index = 0; - if(attribute) - { - // Data Type - if(!jausByteToBuffer(attribute->dataType, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Value - switch(attribute->dataType) - { - case JAUS_WM_OBJECT_BYTE_DATA: - if(!jausByteToBuffer(attribute->data.byteValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case JAUS_WM_OBJECT_SHORT_DATA: - if(!jausShortToBuffer(attribute->data.shortValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case JAUS_WM_OBJECT_INTEGER_DATA: - if(!jausIntegerToBuffer(attribute->data.integerValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case JAUS_WM_OBJECT_LONG_DATA: - if(!jausLongToBuffer(attribute->data.longValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case JAUS_WM_OBJECT_UNSIGNED_SHORT_DATA: - if(!jausUnsignedShortToBuffer(attribute->data.unsignedShortValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case JAUS_WM_OBJECT_UNSIGNED_INTEGER_DATA: - if(!jausUnsignedIntegerToBuffer(attribute->data.unsignedIntegerValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case JAUS_WM_OBJECT_UNSIGNED_LONG_DATA: - if(!jausUnsignedLongToBuffer(attribute->data.unsignedLongValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case JAUS_WM_OBJECT_FLOAT_DATA: - if(!jausFloatToBuffer(attribute->data.floatValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case JAUS_WM_OBJECT_DOUBLE_DATA: - if(!jausDoubleToBuffer(attribute->data.doubleValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - case JAUS_WM_OBJECT_RGB_DATA: - if(!jausByteToBuffer(attribute->data.rgb.redValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(attribute->data.rgb.greenValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - if(!jausByteToBuffer(attribute->data.rgb.blueValue, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - return JAUS_TRUE; - - default: - return JAUS_TRUE; - } - } - return JAUS_FALSE; -} - -// JausWorldModelFeatureClassAttribute Buffer Size -unsigned int featureClassAttributeSizeBytes(JausWorldModelFeatureClassAttribute attribute) -{ - unsigned int size = 0; - - if(attribute) - { - size += JAUS_BYTE_SIZE_BYTES; - switch(attribute->dataType) - { - case JAUS_WM_OBJECT_BYTE_DATA: - size += JAUS_BYTE_SIZE_BYTES; - return size; - break; - - case JAUS_WM_OBJECT_SHORT_DATA: - size += JAUS_SHORT_SIZE_BYTES; - return size; - break; - - case JAUS_WM_OBJECT_INTEGER_DATA: - size += JAUS_INTEGER_SIZE_BYTES; - return size; - break; - - case JAUS_WM_OBJECT_LONG_DATA: - size += JAUS_LONG_SIZE_BYTES; - return size; - break; - - case JAUS_WM_OBJECT_UNSIGNED_SHORT_DATA: - size += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - return size; - break; - - case JAUS_WM_OBJECT_UNSIGNED_INTEGER_DATA: - size += JAUS_UNSIGNED_INTEGER_SIZE_BYTES; - return size; - break; - - case JAUS_WM_OBJECT_UNSIGNED_LONG_DATA: - size += JAUS_UNSIGNED_LONG_SIZE_BYTES; - return size; - break; - - case JAUS_WM_OBJECT_FLOAT_DATA: - size += JAUS_FLOAT_SIZE_BYTES; - return size; - break; - - case JAUS_WM_OBJECT_DOUBLE_DATA: - size += JAUS_DOUBLE_SIZE_BYTES; - return size; - break; - - case JAUS_WM_OBJECT_RGB_DATA: - size += JAUS_BYTE_SIZE_BYTES; // Red - size += JAUS_BYTE_SIZE_BYTES; // Green - size += JAUS_BYTE_SIZE_BYTES; // Blue - return size; - break; - - default: - return 0; - } - } - return size; -} - -// JausWorldModelFeatureClassAttribute Copy -JausWorldModelFeatureClassAttribute featureClassAttributeCopy(JausWorldModelFeatureClassAttribute attribute) -{ - JausWorldModelFeatureClassAttribute copy; - - copy = (JausWorldModelFeatureClassAttribute) malloc(sizeof(JausWorldModelFeatureClassAttributeStruct)); - if(copy) - { - memcpy(copy, attribute, sizeof(JausWorldModelFeatureClassAttributeStruct)); - return copy; - } - else - { - return NULL; - } -} - -// JausWorldModelFeatureClassAttribute ToString -int featureClassAttributeToString(JausWorldModelFeatureClassAttribute attribute, char *string, size_t stringLength) -{ - int retVal = 0; - - switch(attribute->dataType) - { - case JAUS_WM_OBJECT_BYTE_DATA: - retVal = sprintf(string, "Byte Attribute (%d)", attribute->data.byteValue); - return retVal; - - case JAUS_WM_OBJECT_SHORT_DATA: - retVal = sprintf(string, "Short Attribute (%d)", attribute->data.shortValue); - return retVal; - - case JAUS_WM_OBJECT_INTEGER_DATA: - retVal = sprintf(string, "Integer Attribute (%d)", attribute->data.integerValue); - return retVal; - - case JAUS_WM_OBJECT_LONG_DATA: - retVal = sprintf(string, "Long Attribute (%lld)", attribute->data.longValue); - return retVal; - - case JAUS_WM_OBJECT_UNSIGNED_SHORT_DATA: - retVal = sprintf(string, "Unsigned Short Attribute (%d)", attribute->data.unsignedShortValue); - return retVal; - - case JAUS_WM_OBJECT_UNSIGNED_INTEGER_DATA: - retVal = sprintf(string, "Unsigned Integer Attribute (%d)", attribute->data.unsignedIntegerValue); - return retVal; - - case JAUS_WM_OBJECT_UNSIGNED_LONG_DATA: - retVal = sprintf(string, "Unsigned Long Attribute (%lld)", attribute->data.unsignedLongValue); - return retVal; - - case JAUS_WM_OBJECT_FLOAT_DATA: - retVal = sprintf(string, "Float Attribute (%f)", attribute->data.floatValue); - return retVal; - - case JAUS_WM_OBJECT_DOUBLE_DATA: - retVal = sprintf(string, "Double Attribute (%lf)", attribute->data.doubleValue); - return retVal; - - case JAUS_WM_OBJECT_RGB_DATA: - retVal = sprintf(string, "RGB Attribute Red(%d) Green(%d) Blue(%d)", attribute->data.rgb.redValue, attribute->data.rgb.greenValue, attribute->data.rgb.blueValue); - return retVal; - - default: - return 0; - } -} - -// JausWorldModelFeatureClassAttribute GetValue -JausUnsignedLong featureClassAttributeGetValue(JausWorldModelFeatureClassAttribute attribute) -{ - JausUnsignedLong tempULong = 0; - - switch(attribute->dataType) - { - case JAUS_WM_OBJECT_BYTE_DATA: - return (JausUnsignedLong)attribute->data.byteValue; - - case JAUS_WM_OBJECT_SHORT_DATA: - return (JausUnsignedLong)attribute->data.shortValue; - - case JAUS_WM_OBJECT_INTEGER_DATA: - return (JausUnsignedLong)attribute->data.integerValue; - - case JAUS_WM_OBJECT_LONG_DATA: - return (JausUnsignedLong)attribute->data.longValue; - - case JAUS_WM_OBJECT_UNSIGNED_SHORT_DATA: - return (JausUnsignedLong)attribute->data.shortValue; - - case JAUS_WM_OBJECT_UNSIGNED_INTEGER_DATA: - return (JausUnsignedLong)attribute->data.integerValue; - - case JAUS_WM_OBJECT_UNSIGNED_LONG_DATA: - return (JausUnsignedLong)attribute->data.unsignedLongValue; - - case JAUS_WM_OBJECT_FLOAT_DATA: - return (JausUnsignedLong)attribute->data.floatValue; - - case JAUS_WM_OBJECT_DOUBLE_DATA: - return (JausUnsignedLong)attribute->data.doubleValue; - - case JAUS_WM_OBJECT_RGB_DATA: - tempULong = attribute->data.rgb.redValue << 16; - tempULong += attribute->data.rgb.greenValue << 8; - tempULong += attribute->data.rgb.blueValue; - return tempULong; - - default: - return 0; - } -} diff --git a/lib/openjaus/libjaus/src/type/jausWorldModelVectorObject.c b/lib/openjaus/libjaus/src/type/jausWorldModelVectorObject.c deleted file mode 100644 index cc19491a872f0f378c86867e73534ab7a0610d5a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libjaus/src/type/jausWorldModelVectorObject.c +++ /dev/null @@ -1,410 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: jausWorldModelVectorObject.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com), Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#include -#include -#include -#include "jaus.h" - -// JausWorldModelVectorObject Constructor -JausWorldModelVectorObject vectorObjectCreate(void) -{ - JausWorldModelVectorObject object; - - object = (JausWorldModelVectorObject) malloc(sizeof(JausWorldModelVectorObjectStruct)); - if(object) - { - object->id = newJausUnsignedShort(0); - object->type = newJausByte(JAUS_WM_UNKNOWN_TYPE); // Object Type - object->bufferMeters = newJausFloat(0.0); // Buffer Size in meters - object->featureClasses = jausArrayCreate(); // Dynamic Array of JausWorldModelFeatureClass data - object->dataPoints = jausArrayCreate(); // Dynamic Array of JausGeometryPointLLA data - return object; - } - else - { - return NULL; - } -} - -// JausWorldModelVectorObject Constructor (from Buffer) -JausWorldModelVectorObject vectorObjectFromBuffer(unsigned char *buffer, unsigned int bufferSizeBytes, JausBoolean objectBuffered) -{ - unsigned int index = 0; - int i = 0; - JausByte featureClassCount; - JausUnsignedShort dataPointCount; - JausInteger tempInt; - JausWorldModelVectorObject object = NULL; - JausWorldModelFeatureClass class = NULL; - JausGeometryPointLLA point = NULL; - - object = (JausWorldModelVectorObject) malloc(sizeof(JausWorldModelVectorObjectStruct)); - if(object) - { - // Object Id will always be 0, this is because it is not always included in the buffer to be unpacked - // The specific message will have to populate this if provided - object->id = newJausUnsignedShort(0); - - // Read Object Type - if(!jausByteFromBuffer(&object->type, buffer+index, bufferSizeBytes-index)) - { - free(object); - return NULL; - } - index += JAUS_BYTE_SIZE_BYTES; - - // Buffer is optional - if(objectBuffered) - { - // Read Buffer Value - if(!jausFloatFromBuffer(&object->bufferMeters, buffer+index, bufferSizeBytes-index)) - { - free(object); - return NULL; - } - index += JAUS_FLOAT_SIZE_BYTES; - } - else - { - // Setup Buffer if not specified - object->bufferMeters = newJausFloat(0.0); - } - - // Create FC Vector - object->featureClasses = jausArrayCreate(); - if(!object->featureClasses) - { - free(object); - return NULL; - } - - // Read Number of Feature Classes - if(!jausByteFromBuffer(&featureClassCount, buffer+index, bufferSizeBytes-index)) - { - jausArrayDestroy(object->featureClasses, (void *)featureClassDestroy); - free(object); - return NULL; - } - index += JAUS_BYTE_SIZE_BYTES; - - for(i = 0; i < featureClassCount; i++) - { - // Create FC object from buffer - class = featureClassFromBuffer(buffer+index, bufferSizeBytes-index); - if(!class) - { - jausArrayDestroy(object->featureClasses, (void *)featureClassDestroy); - free(object); - return NULL; - } - index += featureClassSizeBytes(class); - - jausArrayAdd(object->featureClasses, class); - } - - // Create DataPoints Vector - object->dataPoints = jausArrayCreate(); - if(!object->dataPoints) - { - jausArrayDestroy(object->featureClasses, (void *)featureClassDestroy); - free(object); - return NULL; - } - - // Read Number of data Points - if(!jausUnsignedShortFromBuffer(&dataPointCount, buffer+index, bufferSizeBytes-index)) - { - jausArrayDestroy(object->dataPoints, (void *)jausGeometryPointLLADestroy); - jausArrayDestroy(object->featureClasses, (void *)featureClassDestroy); - free(object); - return NULL; - } - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - for(i = 0; i < dataPointCount; i++) - { - point = jausGeometryPointLLACreate(); - if(!point) - { - jausArrayDestroy(object->dataPoints, (void *)jausGeometryPointLLADestroy); - jausArrayDestroy(object->featureClasses, (void *)featureClassDestroy); - free(object); - return NULL; - } - - // unpack Latitude - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) - { - jausArrayDestroy(object->dataPoints, (void *)jausGeometryPointLLADestroy); - jausArrayDestroy(object->featureClasses, (void *)featureClassDestroy); - free(object); - return NULL; - } - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-90, 90) - point->latitudeRadians = jausIntegerToDouble(tempInt, -90, 90) * JAUS_RAD_PER_DEG; - - // unpack Latitude - if(!jausIntegerFromBuffer(&tempInt, buffer+index, bufferSizeBytes-index)) - { - jausArrayDestroy(object->dataPoints, (void *)jausGeometryPointLLADestroy); - jausArrayDestroy(object->featureClasses, (void *)featureClassDestroy); - free(object); - return NULL; - } - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-180, 180) - point->longitudeRadians = jausIntegerToDouble(tempInt, -180, 180) * JAUS_RAD_PER_DEG; - - jausArrayAdd(object->dataPoints, point); - } - - return object; - } - else - { - return NULL; - } -} - -// JausWorldModelVectorObject To Buffer -JausBoolean vectorObjectToBuffer(JausWorldModelVectorObject object, unsigned char *buffer, unsigned int bufferSizeBytes, JausBoolean objectBuffered) -{ - unsigned int index = 0; - int i = 0; - JausInteger tempInt; - JausWorldModelFeatureClass class = NULL; - JausGeometryPointLLA point = NULL; - - if(object) - { - // Type - if(!jausByteToBuffer(object->type, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - // Buffer is Optional - if(objectBuffered) - { - if(!jausFloatToBuffer(object->bufferMeters, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_FLOAT_SIZE_BYTES; - } - - // FC Count - if(!jausByteToBuffer((JausByte)object->featureClasses->elementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_BYTE_SIZE_BYTES; - - for(i = 0; i < object->featureClasses->elementCount; i++) - { - class = (JausWorldModelFeatureClass)object->featureClasses->elementData[i]; - - if(!featureClassToBuffer(class, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += featureClassSizeBytes(class); - } - - if(!jausUnsignedShortToBuffer((JausUnsignedShort)object->dataPoints->elementCount, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_UNSIGNED_SHORT_SIZE_BYTES; - - for(i = 0; i < object->dataPoints->elementCount; i++) - { - point = (JausGeometryPointLLA) object->dataPoints->elementData[i]; - - // Scaled Int (-90, 90) - tempInt = jausIntegerFromDouble((point->latitudeRadians * JAUS_DEG_PER_RAD), -90, 90); - - //pack Latitude - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - - // Scaled Int (-180, 180) - tempInt = jausIntegerFromDouble((point->longitudeRadians * JAUS_DEG_PER_RAD), -180, 180); - - //pack Longitude - if(!jausIntegerToBuffer(tempInt, buffer+index, bufferSizeBytes-index)) return JAUS_FALSE; - index += JAUS_INTEGER_SIZE_BYTES; - } - - return JAUS_TRUE; - } - - return JAUS_FALSE; -} - -// JausWorldModelVectorObject Destructor -void vectorObjectDestroy(JausWorldModelVectorObject object) -{ - if(object) - { - jausArrayDestroy(object->featureClasses, (void *)featureClassDestroy); - jausArrayDestroy(object->dataPoints, (void *)jausGeometryPointLLADestroy); - - free(object); - object = NULL; - } -} - -// JausWorldModelVectorObject Buffer Size -unsigned int vectorObjectSizeBytes(JausWorldModelVectorObject object, JausBoolean objectBuffered) -{ - int i = 0; - unsigned int size = 0; - JausWorldModelFeatureClass class = NULL; - - if(object) - { - size += JAUS_BYTE_SIZE_BYTES; // Type - - if(objectBuffered) - { - size += JAUS_FLOAT_SIZE_BYTES; // Buffer - } - - size += JAUS_BYTE_SIZE_BYTES; // Feature Class Count - - for(i = 0; i < object->featureClasses->elementCount; i++) - { - class = (JausWorldModelFeatureClass) object->featureClasses->elementData[i]; - size += featureClassSizeBytes(class); // size of each featureClass - } - - size += JAUS_UNSIGNED_SHORT_SIZE_BYTES; // Point Count - - for(i = 0; i < object->dataPoints->elementCount; i++) - { - size += JAUS_INTEGER_SIZE_BYTES; // Latitude - size += JAUS_INTEGER_SIZE_BYTES; // Longitude - } - } - return size; -} - -// JausWorldModelVectorObject Type To String -int vectorObjectTypeToString(JausWorldModelVectorObject object, char *string, size_t stringLength) -{ - switch(object->type) - { - case JAUS_WM_POINT_TYPE: - return sprintf(string, "Point"); - case JAUS_WM_LINE_TYPE: - return sprintf(string, "Line"); - case JAUS_WM_POLYGON_TYPE: - return sprintf(string, "Polygon"); - default: - return sprintf(string, "Unknown"); - } -} - -JausWorldModelVectorObject vectorObjectCopy(JausWorldModelVectorObject input) -{ - JausWorldModelVectorObject objectCopy; - JausWorldModelFeatureClass fc; - JausGeometryPointLLA pointInput, pointCopy; - int i; - - objectCopy = (JausWorldModelVectorObject) malloc(sizeof(JausWorldModelVectorObjectStruct)); - if(objectCopy) - { - objectCopy->id = input->id; - objectCopy->type = input->type; - objectCopy->bufferMeters = input->bufferMeters; - objectCopy->featureClasses = jausArrayCreate(); - if(!objectCopy->featureClasses) - { - //////cError("JausWorldModelVectorObject:%d: Failed to create objectCopy->featureClasses\n", __LINE__); - free(objectCopy); - return NULL; - } - - for(i = 0; i < input->featureClasses->elementCount; i++) - { - fc = featureClassCopy((JausWorldModelFeatureClass)input->featureClasses->elementData[i]); - if(!fc) - { - ////cError("JausWorldModelVectorObject:%d: Failed to clone FeatureClass\n", __LINE__); - jausArrayDestroy(objectCopy->featureClasses, (void *)featureClassDestroy); - free(objectCopy); - return NULL; - } - jausArrayAdd(objectCopy->featureClasses, fc); - } - - objectCopy->dataPoints = jausArrayCreate(); - if(!objectCopy->dataPoints) - { - ////cError("JausWorldModelVectorObject:%d: Failed to create objectCopy->dataPoints\n", __LINE__); - jausArrayDestroy(objectCopy->featureClasses, (void *)featureClassDestroy); - free(objectCopy); - return NULL; - } - - for(i = 0; i < input->dataPoints->elementCount; i++) - { - pointInput = (JausGeometryPointLLA) input->dataPoints->elementData[i]; - pointCopy = jausGeometryPointLLACreate(); - if(!pointCopy) - { - ////cError("JausWorldModelVectorObject:%d: Failed to clone DataPoint\n", __LINE__); - jausArrayDestroy(objectCopy->featureClasses, (void *)featureClassDestroy); - jausArrayDestroy(objectCopy->dataPoints, (void *)jausGeometryPointLLADestroy); - free(objectCopy); - return NULL; - } - - pointCopy->latitudeRadians = pointInput->latitudeRadians; - pointCopy->longitudeRadians = pointInput->longitudeRadians; - - jausArrayAdd(objectCopy->dataPoints, pointCopy); - } - return objectCopy; - } - else - { - ////cError("JausWorldModelVectorObject:%d: Failed to create objectCopy\n", __LINE__); - return NULL; - } - - ////cError("JausWorldModelVectorObject:%d: This shouldn't happen.\n", __LINE__); - return NULL; -} diff --git a/lib/openjaus/libopenJaus/include/componentLibrary/ojCmpt.h b/lib/openjaus/libopenJaus/include/componentLibrary/ojCmpt.h deleted file mode 100644 index 67a88257384739a295e55f8319f9fb5c1098fb99..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/componentLibrary/ojCmpt.h +++ /dev/null @@ -1,127 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: ojCmpt.h -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file contains the code associated with the OpenJAUS -// Component Library. The Component Library is a wrapper around -// common component functionality which accelerates and eases -// the creation of JAUS components. - - -#ifndef OJ_CMPT_H -#define OJ_CMPT_H - -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -#define OJ_CMPT_MAX_STATE_COUNT 32 -#define OJ_CMPT_MAX_INCOMING_SC_COUNT 32 -#define OJ_CMPT_MIN_FREQUENCY_HZ 0.1 -#define OJ_CMPT_MAX_FREQUENCY_HZ 1000.0 -#define OJ_CMPT_DEFAULT_FREQUENCY_HZ 1.0 - -typedef struct OjCmptStruct *OjCmpt; - -JAUS_EXPORT OjCmpt ojCmptCreate(char *name, JausByte id, double frequency); -JAUS_EXPORT void ojCmptDestroy(OjCmpt ojCmpt); -JAUS_EXPORT int ojCmptRun(OjCmpt ojCmpt); - -JAUS_EXPORT void ojCmptSetFrequencyHz(OjCmpt ojCmpt, double stateFrequencyHz); -JAUS_EXPORT void ojCmptSetState(OjCmpt ojCmpt, int state); - -JAUS_EXPORT int ojCmptSetStateCallback(OjCmpt ojCmpt, int state, void (*stateCallbackFunction)(OjCmpt)); // Calls method from stateHandler -JAUS_EXPORT int ojCmptSetMainCallback(OjCmpt ojCmpt, void (*mainCallbackFunction)(OjCmpt)); // Calls method from stateHandler -JAUS_EXPORT void ojCmptSetMessageCallback(OjCmpt ojCmpt, unsigned short commandCode, void (*messageFunction)(OjCmpt, JausMessage)); // Calls method from messageHandler -JAUS_EXPORT void ojCmptSetMessageProcessorCallback(OjCmpt ojCmpt, void (*processMessageFunction)(OjCmpt, JausMessage)); // Calls method from messageHandler -JAUS_EXPORT void ojCmptSetUserData(OjCmpt ojCmpt, void *data); -JAUS_EXPORT void ojCmptSetAuthority(OjCmpt ojCmpt, JausByte authority); - -JAUS_EXPORT int ojCmptSendMessage(OjCmpt ojCmpt, JausMessage message); - -// Accessors -JAUS_EXPORT JausByte ojCmptGetAuthority(OjCmpt ojCmpt); -JAUS_EXPORT JausAddress ojCmptGetAddress(OjCmpt ojCmpt); -JAUS_EXPORT JausAddress ojCmptGetControllerAddress(OjCmpt ojCmpt); -JAUS_EXPORT JausBoolean ojCmptHasController(OjCmpt ojCmpt); -JAUS_EXPORT int ojCmptGetState(OjCmpt ojCmpt); -JAUS_EXPORT void ojCmptDefaultMessageProcessor(OjCmpt ojCmpt, JausMessage message); -JAUS_EXPORT char* ojCmptGetName(OjCmpt ojCmpt); -JAUS_EXPORT void *ojCmptGetUserData(OjCmpt ojCmpt); -JAUS_EXPORT double ojCmptGetRateHz(OjCmpt ojCmpt); - -// Services -JAUS_EXPORT JausBoolean ojCmptAddService(OjCmpt ojCmpt, JausUnsignedShort serviceType); -JAUS_EXPORT JausBoolean ojCmptAddServiceInputMessage(OjCmpt ojCmpt, JausUnsignedShort serviceType, JausUnsignedShort commandCode, JausUnsignedInteger presenceVector); -JAUS_EXPORT JausBoolean ojCmptAddServiceOutputMessage(OjCmpt ojCmpt, JausUnsignedShort serviceType, JausUnsignedShort commandCode, JausUnsignedInteger presenceVector); - -// Incoming Service Connections -JAUS_EXPORT int ojCmptEstablishSc(OjCmpt ojCmpt, JausUnsignedShort cCode, JausUnsignedInteger pv, JausAddress address, double rateHz, double timeoutSec, int qSize); -JAUS_EXPORT int ojCmptTerminateSc(OjCmpt ojCmpt, int scIndex); -JAUS_EXPORT JausBoolean ojCmptIsIncomingScActive(OjCmpt ojCmpt, int scIndex); -// OjCmpt add receive SC method - -// Outgoing Service Connections -JAUS_EXPORT void ojCmptAddSupportedSc(OjCmpt ojCmpt, unsigned short commandCode); // Add service connection support for this message -JAUS_EXPORT void ojCmptRemoveSupportedSc(OjCmpt ojCmpt, unsigned short commandCode); // Removes service connection support for this message -JAUS_EXPORT ServiceConnection ojCmptGetScSendList(OjCmpt ojCmpt, unsigned short commandCode); -JAUS_EXPORT void ojCmptDestroySendList(ServiceConnection scList); -JAUS_EXPORT JausBoolean ojCmptIsOutgoingScActive(OjCmpt ojCmpt, unsigned short commandCode); - -// System Discovery -JAUS_EXPORT int ojCmptLookupAddress(OjCmpt ojCmpt, JausAddress address); - - -#ifdef __cplusplus -} -#endif - -#endif // OJ_CMPT_H - diff --git a/lib/openjaus/libopenJaus/include/nodeManager/CommunicatorComponent.h b/lib/openjaus/libopenJaus/include/nodeManager/CommunicatorComponent.h deleted file mode 100644 index 1e6edc3fdf13d80769b1ae152e03a95a5adc2690..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/CommunicatorComponent.h +++ /dev/null @@ -1,127 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: CommunicatorComponent.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef COMMUNICATOR_COMPONENT_H -#define COMMUNICATOR_COMPONENT_H - -#if defined(WIN32) - #include - #define HASH_MAP stdext::hash_map -#elif defined(__GNUC__) - #include - #define HASH_MAP __gnu_cxx::hash_map -#else - #error "Hash Map undefined in SystemTable.h." -#endif -#include "LocalComponent.h" - -#define MAXIMUM_EVENT_ID 255 -#define COMMUNICATOR_RATE_HZ 5 - -class SystemTree; -class JausComponentCommunicationManager; - -class CommunicatorComponent : public LocalComponent -{ -public: - CommunicatorComponent(FileLoader *configData, EventHandler *handler, JausComponentCommunicationManager *cmptComms); - ~CommunicatorComponent(void); - - bool processMessage(JausMessage message); - std::string toString(); - bool startInterface(void); - bool stopInterface(void); - -private: - bool processReportIdentification(JausMessage message); - bool processReportConfiguration(JausMessage message); - bool processReportServices(JausMessage message); - bool processReportHeartbeatPulse(JausMessage message); - bool processCreateEvent(JausMessage message); - bool processCancelEvent(JausMessage message); - bool processCreateServiceConnection(JausMessage message); - bool processActivateServiceConnection(JausMessage message); - bool processSuspendServiceConnection(JausMessage message); - bool processTerminateServiceConnection(JausMessage message); - bool processRequestComponentControl(JausMessage message); - bool processQueryComponentAuthority(JausMessage message); - bool processQueryComponentStatus(JausMessage message); - bool processQueryHeartbeatPulse(JausMessage message); - bool processQueryConfiguration(JausMessage message); - bool processQueryIdentification(JausMessage message); - bool processQueryServices(JausMessage message); - bool processConfirmEvent(JausMessage message); - bool processEvent(JausMessage message); - - void sendSubsystemChangedEvents(); - void sendSubsystemShutdownEvents(); - void generateHeartbeats(); - - bool sendQueryNodeIdentification(JausAddress address); - bool sendQuerySubsystemIdentification(JausAddress address); - bool sendQueryComponentIdentification(JausAddress address); - - bool sendQueryNodeConfiguration(JausAddress address, bool createEvent); - bool sendQuerySubsystemConfiguration(JausAddress address, bool createEvent); - bool sendQueryComponentServices(JausAddress address); - - void startupState(); - void intializeState(); - void standbyState(); - void readyState(); - void emergencyState(); - void failureState(); - void shutdownState(); - void allState(); - - int getNextEventId(); - bool setupJausServices(); - - HASH_MAP nodeChangeList; - HASH_MAP subsystemChangeList; - bool eventId[255]; - SystemTree *systemTree; - bool nodeManagerSubsystemEventConfirmed; -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/EventHandler.h b/lib/openjaus/libopenJaus/include/nodeManager/EventHandler.h deleted file mode 100644 index 36394268e43faa6a26a6b481ae789108a4139c1e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/EventHandler.h +++ /dev/null @@ -1,60 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: EventHandler.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef EVENT_HANDLER_H -#define EVENT_HANDLER_H - -#include "nodeManager/events/NodeManagerEvent.h" - -#if defined(__GNUC__) - #define __FUNCTION__ __PRETTY_FUNCTION__ -#endif - -class EventHandler -{ -public: - virtual void handleEvent(NodeManagerEvent *e) = 0; - virtual ~EventHandler() {}; -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/JausCommunicationManager.h b/lib/openjaus/libopenJaus/include/nodeManager/JausCommunicationManager.h deleted file mode 100644 index 08f88f64c5b592377a58ec0c229925d661f7e346..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/JausCommunicationManager.h +++ /dev/null @@ -1,94 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausCommunicationManager.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef JAUS_COMMUNICATION_MANAGER -#define JAUS_COMMUNICATION_MANAGER - -#ifdef WIN32 - #include - #include - #define HASH_MAP stdext::hash_map -#elif defined(__GNUC__) - #include - #define HASH_MAP __gnu_cxx::hash_map -#endif - -#include -#include "JausTransportInterface.h" -#include "utils/FileLoader.h" -#include "MessageRouter.h" -#include "SystemTree.h" -#include "EventHandler.h" - -class JausCommunicationManager -{ -public: - JausCommunicationManager(void); - virtual ~JausCommunicationManager(void); - - unsigned long getInterfaceCount(void); - JausTransportInterface *getJausInterface(unsigned long index); - JausTransportInterface *getJausInterface(std::string interfaceName); - bool interfaceExists(std::string interfaceName); - void enable(void); - void disable(void); - bool isEnabled(void); - SystemTree *getSystemTree(); - virtual bool sendJausMessage(JausMessage message) = 0; - virtual bool receiveJausMessage(JausMessage message, JausTransportInterface *jtInterface) = 0; - MessageRouter *getMessageRouter(); - virtual bool startInterfaces(void) = 0; - -protected: - MessageRouter *msgRouter; - std::vector interfaces; - HASH_MAP interfaceMap; - FileLoader *configData; - SystemTree *systemTree; - EventHandler *eventHandler; - JausByte mySubsystemId; - JausByte myNodeId; - bool enabled; -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/JausComponentCommunicationManager.h b/lib/openjaus/libopenJaus/include/nodeManager/JausComponentCommunicationManager.h deleted file mode 100644 index 7578b9f0fa488f73e607a8356e75f809853b7a8e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/JausComponentCommunicationManager.h +++ /dev/null @@ -1,75 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausComponentCommunicationManager.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef JAUS_CMPT_COMMS_MNGR_H -#define JAUS_CMPT_COMMS_MNGR_H - -#include "JausCommunicationManager.h" -#include "SystemTree.h" -#include "NodeManagerComponent.h" -#include "CommunicatorComponent.h" - -class OjUdpComponentInterface; - -class JausComponentCommunicationManager : public JausCommunicationManager -{ -public: - JausComponentCommunicationManager(FileLoader *configData, MessageRouter *msgRouter, SystemTree *systemTree, EventHandler *handler); - ~JausComponentCommunicationManager(void); - bool sendJausMessage(JausMessage message); - bool receiveJausMessage(JausMessage message, JausTransportInterface *srcInf); - bool startInterfaces(void); - bool stopInterfaces(void); - - NodeManagerComponent *getNodeManagerComponent(void); - -private: - OjUdpComponentInterface *udpCmptInf; - NodeManagerComponent *nodeManagerCmpt; - CommunicatorComponent *communicatorCmpt; - - bool sendToComponentX(JausMessage message); - bool sendToAllInterfaces(JausMessage message); -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/JausNodeCommunicationManager.h b/lib/openjaus/libopenJaus/include/nodeManager/JausNodeCommunicationManager.h deleted file mode 100644 index 326d7cc4387e5b020ce9e44d5a06ffddd8db8663..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/JausNodeCommunicationManager.h +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausNodeCommunicationManager.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef JAUS_NODE_COMMS_MNGR_H -#define JAUS_NODE_COMMS_MNGR_H - -#include "JausCommunicationManager.h" - -class JausNodeCommunicationManager : public JausCommunicationManager -{ -public: - JausNodeCommunicationManager(FileLoader *configData, MessageRouter *msgRouter, SystemTree *systemTree, EventHandler *handler); - ~JausNodeCommunicationManager(void); - bool sendJausMessage(JausMessage message); - bool receiveJausMessage(JausMessage message, JausTransportInterface *srcInf); - bool startInterfaces(void); - bool stopInterfaces(void); - -private: - bool sendToSubsystemGateway(JausMessage message); - bool sendToNodeX(JausMessage message); - bool sendToAllInterfaces(JausMessage message); - JausTransportInterface *subsystemGatewayInterface; -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/JausOpcUdpInterface.h b/lib/openjaus/libopenJaus/include/nodeManager/JausOpcUdpInterface.h deleted file mode 100644 index 7ca50a0fecfc9a14c9e690c59f4bc713b12ce3b3..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/JausOpcUdpInterface.h +++ /dev/null @@ -1,137 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausOpcUdpInterface.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef JAUS_OPC_UDP_INTERFACE_H -#define JAUS_OPC_UDP_INTERFACE_H - -#ifdef WIN32 - #include - #include - #define HASH_MAP stdext::hash_map -#elif defined(__GNUC__) - #include - #define HASH_MAP __gnu_cxx::hash_map -#endif - -#include "JausTransportInterface.h" -#include "utils/multicastSocket.h" -#include "utils/inetAddress.h" -#include "utils/datagramPacket.h" -#include "utils/FileLoader.h" - -#define JAUS_OPC_UDP_NAME "JAUS ETG/OPC UDP Interface" -#define JAUS_OPC_UDP_DATA_PORT 3794 // per AS5669 v1.0 and IANA assignment -#define JAUS_OPC_UDP_HEADER "JAUS01.0" // per OPC documents -#define JAUS_OPC_UDP_HEADER_SIZE_BYTES 8 // per OPC Documents - -// Default Configuration Values -// Component UDP Interface Default Values -#define OPC_UDP_DEFAULT_COMPONENT_UDP_PORT 24629 // per OpenJAUS Nodemanager Interface document -#define OPC_UDP_DEFAULT_COMPONENT_TTL 1 -#define OPC_UDP_DEFAULT_COMPONENT_UDP_TIMEOUT_SEC 1.0f -#define OPC_UDP_DEFAULT_COMPONENT_MULTICAST false - -// Node UDP Interface Default Values -#define OPC_UDP_DEFAULT_NODE_TTL 8 -#define OPC_UDP_DEFAULT_NODE_UDP_TIMEOUT_SEC 1.0f -#define OPC_UDP_DEFAULT_NODE_MULTICAST true - -// Subsystem UDP Interface Default Values -#define OPC_UDP_DEFAULT_SUBSYSTEM_TTL 32 -#define OPC_UDP_DEFAULT_SUBSYSTEM_UDP_TIMEOUT_SEC 1.0f -#define OPC_UDP_DEFAULT_SUBSYSTEM_MULTICAST true - -static const std::string OPC_UDP_DEFAULT_COMPONENT_IP = "127.0.0.1"; // per OpenJAUS Nodemanager Interface document -static const std::string OPC_UDP_DEFAULT_SUBSYSTEM_MULTICAST_GROUP = "224.1.0.1"; // per OPC Convention -static const std::string OPC_UDP_DEFAULT_NODE_MULTICAST_GROUP = "225.1.0.1"; // per OPC Convention - -extern "C" void *OpcUdpRecvThread(void *); - -// Transport Data Structure -typedef struct -{ - unsigned int addressValue; - unsigned short port; -}OpcUdpTransportData; - -class JausOpcUdpInterface : public JausTransportInterface -{ -public: - JausOpcUdpInterface(FileLoader *configData, EventHandler *handler, JausCommunicationManager *commMngr); - ~JausOpcUdpInterface(void); - - InetAddress getInetAddress(void); - - bool processMessage(JausMessage message); - - bool startInterface(); - bool stopInterface(); - std::string toString(); - void run(); - void recvThreadRun(); - -private: - MulticastSocket socket; - bool openSocket(void); - void closeSocket(void); - - bool multicast; - InetAddress ipAddress; - InetAddress multicastGroup; - unsigned short portNumber; - - int recvThreadId; - pthread_t recvThread; - pthread_attr_t recvThreadAttr; - - void sendJausMessage(OpcUdpTransportData data, JausMessage message); - void startRecvThread(); - void stopRecvThread(); - - HASH_MAP addressMap; - bool subsystemGatewayDiscovered; - OpcUdpTransportData subsystemGatewayData; - OpcUdpTransportData multicastData; -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/JausSubsystemCommunicationManager.h b/lib/openjaus/libopenJaus/include/nodeManager/JausSubsystemCommunicationManager.h deleted file mode 100644 index 440a59d4b151a4a7c934d47ddb91d62998ffe08d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/JausSubsystemCommunicationManager.h +++ /dev/null @@ -1,64 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausSubsystemCommunicationManager.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef JAUS_SUBS_COMMS_MNGR_H -#define JAUS_SUBS_COMMS_MNGR_H - -#include "JausCommunicationManager.h" - -class JausSubsystemCommunicationManager : public JausCommunicationManager -{ -public: - JausSubsystemCommunicationManager(FileLoader *configData, MessageRouter *msgRouter, SystemTree *systemTree, EventHandler *handler); - ~JausSubsystemCommunicationManager(void); - bool sendJausMessage(JausMessage message); - bool receiveJausMessage(JausMessage message, JausTransportInterface *srcInf); - bool startInterfaces(void); - bool stopInterfaces(void); - -private: - bool sendToSubsystemX(JausMessage message); - bool sendToAllInterfaces(JausMessage message); -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/JausTransportInterface.h b/lib/openjaus/libopenJaus/include/nodeManager/JausTransportInterface.h deleted file mode 100644 index dfe993f792bacba6cd2fde42166210f7c870ac35..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/JausTransportInterface.h +++ /dev/null @@ -1,110 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausTransportInterface.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef JAUS_TRANSPORT_INTERFACE -#define JAUS_TRANSPORT_INTERFACE - -#ifdef WIN32 - #include "pthread.h" -#elif defined(__GNUC__) - #include - #include -#endif - -#include -#include "JausTransportQueue.h" -#include "EventHandler.h" -#include "SystemTree.h" -#include "utils/FileLoader.h" -#include "jaus.h" - -enum JausTransportType {UNKNOWN_INTERFACE, SUBSYSTEM_INTERFACE, NODE_INTERFACE, COMPONENT_INTERFACE}; - -class JausCommunicationManager; - -extern "C" void *ThreadRun(void *); - -class JausTransportInterface -{ -public: - JausTransportInterface(void); - virtual ~JausTransportInterface(void); - - std::string getName(); - JausCommunicationManager *getCommunicationManager(); - void setCommunicationManager(JausCommunicationManager *commMngr); - - bool isRunning(); - void stopThread(); - - JausTransportType getType(void); - unsigned long queueSize(); - void queueJausMessage(JausMessage message); - - virtual bool startInterface(void) = 0; - virtual bool stopInterface(void) = 0; - virtual bool processMessage(JausMessage message) = 0; - virtual std::string toString() = 0; - virtual void run() = 0; - -protected: - void startThread(); - void wakeThread(); - - EventHandler *eventHandler; - std::string name; - JausTransportType type; - JausTransportQueue queue; - bool running; - JausCommunicationManager *commMngr; - FileLoader *configData; - int pThreadId; - pthread_t pThread; - pthread_attr_t threadAttributes; - pthread_cond_t threadConditional; - pthread_mutex_t threadMutex; - - JausByte mySubsystemId; -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/JausTransportQueue.h b/lib/openjaus/libopenJaus/include/nodeManager/JausTransportQueue.h deleted file mode 100644 index 88ddb7f686dfc92c943650d7e0f6b1024cdcf223..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/JausTransportQueue.h +++ /dev/null @@ -1,68 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausTransportQueue.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: Provides an interface for monitoring JausQueues - -#ifndef JAUS_TRANSPORT_QUEUE_H -#define JAUS_TRANSPORT_QUEUE_H - -#include -#include "jaus.h" -#include "pthread.h" - -class JausTransportQueue -{ -public: - JausTransportQueue(void); - ~JausTransportQueue(void); - - void push(JausMessage inc); - JausMessage pop(void); - bool isEmpty(void); - unsigned long size(void); - void emptyQueue(void); - -private: - std::queue list; - pthread_mutex_t mutex; -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/JudpInterface.h b/lib/openjaus/libopenJaus/include/nodeManager/JudpInterface.h deleted file mode 100644 index 886ef0f57b99f83412511e9a5092903b1ac9771b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/JudpInterface.h +++ /dev/null @@ -1,168 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JudpInterface.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file lists the functions associated with a UDP Jaus -// Transport interface. This interface confirms to the JUDP -// interface (with header compression) described in SAE -// document AS5669. - -#ifndef JUDP_INTERFACE_H -#define JUDP_INTERFACE_H - -#ifdef WIN32 - #include - #include - #define HASH_MAP stdext::hash_map -#elif defined(__GNUC__) - #include - #define HASH_MAP __gnu_cxx::hash_map -#endif - -#include "JausTransportInterface.h" -#include "utils/multicastSocket.h" -#include "utils/inetAddress.h" -#include "utils/datagramPacket.h" -#include "utils/FileLoader.h" - -#define JUDP_NAME "JUDP Interface" -#define JUDP_DATA_PORT 3794 // per AS5669 v1.0 and IANA assignment -#define JUDP_PER_PACKET_HEADER_SIZE_BYTES 1 -#define JUDP_PER_MESSAGE_HEADER_SIZE_BYTES 4 -#define JUDP_VERSION_NUMBER 1 // per AS5669 v1.0 -#define JUDP_MAX_PACKET_SIZE 4101 // per AS5669 v1.0 - -// Header Compression Flag Values -#define JUDP_HC_NO_COMPRESSION 0 -#define JUDP_HC_ENGAGE_COMPRESSION 1 -#define JUDP_HC_COMPRESSION_ACKNOWLEDGE 2 // Note: This value has multiple interpretations, depending on the message length field -#define JUDP_HC_COMPRESSED_MESSAGE 3 - -// Default Configuration Values -// Component UDP Interface Default Values -#define JUDP_DEFAULT_COMPONENT_UDP_PORT 24629 // Per OpenJAUS Node Manager Interface document -#define JUDP_DEFAULT_COMPONENT_TTL 1 -#define JUDP_DEFAULT_COMPONENT_UDP_TIMEOUT_SEC 1.0f -#define JUDP_DEFAULT_COMPONENT_MULTICAST false -#define JUDP_DEFAULT_COMPONENT_HEADER_COMPRESSION false - -// Node UDP Interface Default Values -#define JUDP_DEFAULT_NODE_TTL 16 // per AS5669 -#define JUDP_DEFAULT_NODE_UDP_TIMEOUT_SEC 1.0f -#define JUDP_DEFAULT_NODE_MULTICAST true -#define JUDP_DEFAULT_NODE_HEADER_COMPRESSION false - -// Subsystem UDP Interface Default Values -#define JUDP_DEFAULT_SUBSYSTEM_TTL 16 // per AS5669 -#define JUDP_DEFAULT_SUBSYSTEM_UDP_TIMEOUT_SEC 1.0f -#define JUDP_DEFAULT_SUBSYSTEM_MULTICAST true -#define JUDP_DEFAULT_SUBSYSTEM_HEADER_COMPRESSION false - -static const std::string JUDP_DEFAULT_COMPONENT_IP = "127.0.0.1"; // Per OpenJAUS Node Manager Interface document -static const std::string JUDP_DEFAULT_SUBSYSTEM_MULTICAST_GROUP = "224.1.0.1"; // per AS5669 -static const std::string JUDP_DEFAULT_NODE_MULTICAST_GROUP = "225.1.0.1"; // per AS5669 with slight modification - -extern "C" void *JudpRecvThread(void *); - -// Transport Data Structure -typedef struct -{ - unsigned int addressValue; - unsigned short port; -}JudpTransportData; - -typedef struct -{ - unsigned char headerNumber; - unsigned char length; - unsigned char flags; - unsigned short messageLength; -}JudpHeaderCompressionData; - -class JudpInterface : public JausTransportInterface -{ -public: - JudpInterface(FileLoader *configData, EventHandler *handler, JausCommunicationManager *commMngr); - ~JudpInterface(void); - - InetAddress getInetAddress(void); - - bool processMessage(JausMessage message); - - bool startInterface(); - bool stopInterface(); - std::string toString(); - void run(); - void recvThreadRun(); - -private: - MulticastSocket socket; - bool openSocket(void); - void closeSocket(void); - - bool multicast; - InetAddress ipAddress; - InetAddress multicastGroup; - unsigned short portNumber; - bool supportHeaderCompression; - - int recvThreadId; - pthread_t recvThread; - pthread_attr_t recvThreadAttr; - - void sendJausMessage(JudpTransportData data, JausMessage message); - void startRecvThread(); - void stopRecvThread(); - - unsigned int headerCompressionDataToBuffer(JudpHeaderCompressionData *hcData, unsigned char *buffer, unsigned int bufferSizeBytes); - unsigned int headerCompressionDataFromBuffer(JudpHeaderCompressionData *hcData, unsigned char *buffer, unsigned int bufferSizeBytes); - void sendUncompressedMessage(JudpTransportData data, JausMessage message); - void sendCompressedMessage(JudpTransportData data, JausMessage message); - bool receiveUncompressedMessage(JausMessage rxMessage, unsigned char *buffer, unsigned int bufferSizeBytes); - bool receiveCompressedMessage(JausMessage rxMessage, JudpHeaderCompressionData *hcData, unsigned char *buffer, unsigned int bufferSizeBytes); - - - HASH_MAP addressMap; - bool subsystemGatewayDiscovered; - JudpTransportData subsystemGatewayData; - JudpTransportData multicastData; -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/LocalComponent.h b/lib/openjaus/libopenJaus/include/nodeManager/LocalComponent.h deleted file mode 100644 index 88b690ecf352b62934ee11360898fb7d301c52d8..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/LocalComponent.h +++ /dev/null @@ -1,69 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: LocalComponent.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef LOCAL_COMPONENT_H -#define LOCAL_COMPONENT_H - -#include "JausTransportInterface.h" -#include "jaus.h" - -class LocalComponent : public JausTransportInterface -{ -protected: - JausComponent cmpt; - double cmptRateHz; - virtual void startupState() = 0; - virtual void intializeState() = 0; - virtual void standbyState() = 0; - virtual void readyState() = 0; - virtual void emergencyState() = 0; - virtual void failureState() = 0; - virtual void shutdownState() = 0; - virtual void allState() = 0; - void wakeThread(); -public: - void run(); - -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/MessageRouter.h b/lib/openjaus/libopenJaus/include/nodeManager/MessageRouter.h deleted file mode 100644 index fbdf1d0ea3e3c9f582413232e9fb6f05eb904ac0..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/MessageRouter.h +++ /dev/null @@ -1,82 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: MessageRouter.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef MESSAGE_ROUTER_H -#define MESSAGE_ROUTER_H - -#include "EventHandler.h" -#include "SystemTree.h" -#include "utils/FileLoader.h" -#include "jaus.h" - -class JausSubsystemCommunicationManager; -class JausNodeCommunicationManager; -class JausComponentCommunicationManager; - -class MessageRouter -{ -public: - MessageRouter(FileLoader *configData, SystemTree *systemTree, EventHandler *eventHandler); - ~MessageRouter(void); - bool routeSubsystemSourceMessage(JausMessage message); - bool routeNodeSourceMessage(JausMessage message); - bool routeComponentSourceMessage(JausMessage message); - - bool subsystemCommunicationEnabled(); - bool nodeCommunicationEnabled(); - bool componentCommunicationEnabled(); - -private: - FileLoader *configData; - JausSubsystemCommunicationManager *subsComms; - JausNodeCommunicationManager *nodeComms; - JausComponentCommunicationManager *cmptComms; - SystemTree *systemTree; - EventHandler *eventHandler; - - unsigned short mySubsystemId; - unsigned short myNodeId; - bool sendToCommunicator(JausMessage message); -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/NodeManager.h b/lib/openjaus/libopenJaus/include/nodeManager/NodeManager.h deleted file mode 100644 index a7d79afcd1183c13c348b27fddc6e47be113ad04..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/NodeManager.h +++ /dev/null @@ -1,87 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: NodeManager.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef NODEMANAGER_H -#define NODEMANAGER_H - -#include -#include -#include "MessageRouter.h" -#include "SystemTree.h" -#include "utils/FileLoader.h" -#include "EventHandler.h" -#include "events/NodeManagerEvent.h" -#include "events/SystemTreeEvent.h" -#include "events/ErrorEvent.h" -#include "events/JausMessageEvent.h" -#include "events/DebugEvent.h" -#include "events/ConfigurationEvent.h" - -#define OJ_NODE_MANAGER_VERSION "3.3.0a" - -class NodeManager : public EventHandler -{ -public: - JAUS_EXPORT NodeManager(FileLoader *configData, EventHandler *handler); - JAUS_EXPORT ~NodeManager(void); - - JAUS_EXPORT std::string systemTreeToString(); - JAUS_EXPORT std::string systemTreeToDetailedString(); - - JAUS_EXPORT bool registerEventHandler(EventHandler *handler); - -private: - FileLoader *configData; - - MessageRouter *msgRouter; - SystemTree *systemTree; - - JausNode node; - JausSubsystem subsystem; - - void handleEvent(NodeManagerEvent *e); - std::list eventHandlers; -}; - -#endif - diff --git a/lib/openjaus/libopenJaus/include/nodeManager/NodeManagerComponent.h b/lib/openjaus/libopenJaus/include/nodeManager/NodeManagerComponent.h deleted file mode 100644 index c437d5f5dddeed7920cb6e4069425bada1620320..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/NodeManagerComponent.h +++ /dev/null @@ -1,136 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: NodeManagerComponent.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef NODE_MANAGER_COMPONENT_H -#define NODE_MANAGER_COMPONENT_H - -#include "LocalComponent.h" - -#if defined(WIN32) - #include - #define HASH_MAP stdext::hash_map -#elif defined(__GNUC__) - #include - #define HASH_MAP __gnu_cxx::hash_map -#else - #error "Hash Map undefined in SystemTable.h." -#endif - -class JausComponentCommunicationManager; -class SystemTree; - -#define NM_RATE_HZ 5 -#define MAXIMUM_EVENT_ID 255 -#define REFRESH_TIME_SEC 1 - -class NodeManagerComponent : public LocalComponent, EventHandler -{ -public: - NodeManagerComponent(FileLoader *configData, EventHandler *handler, JausComponentCommunicationManager *cmptComms); - ~NodeManagerComponent(void); - - bool processMessage(JausMessage message); - std::string toString(); - void handleEvent(NodeManagerEvent *e); - bool startInterface(void); - bool stopInterface(void); - - JausAddress checkInLocalComponent(int cmptId); - void checkOutLocalComponent(int subsId, int nodeId, int cmptId, int instId); - void checkOutLocalComponent(JausAddress address); - -private: - bool processReportIdentification(JausMessage message); - bool processReportConfiguration(JausMessage message); - bool processReportServices(JausMessage message); - bool processReportHeartbeatPulse(JausMessage message); - bool processCreateEvent(JausMessage message); - bool processCancelEvent(JausMessage message); - bool processCreateServiceConnection(JausMessage message); - bool processActivateServiceConnection(JausMessage message); - bool processSuspendServiceConnection(JausMessage message); - bool processTerminateServiceConnection(JausMessage message); - bool processRequestComponentControl(JausMessage message); - bool processQueryComponentAuthority(JausMessage message); - bool processQueryComponentStatus(JausMessage message); - bool processQueryHeartbeatPulse(JausMessage message); - bool processQueryConfiguration(JausMessage message); - bool processQueryIdentification(JausMessage message); - bool processQueryServices(JausMessage message); - bool processConfirmEvent(JausMessage message); - bool processEvent(JausMessage message); - - void sendNodeChangedEvents(); - void sendSubsystemChangedEvents(); - void generateHeartbeats(); - bool setupJausServices(); - - void sendNodeShutdownEvents(); - void sendSubsystemShutdownEvents(); - - bool sendQueryNodeIdentification(JausAddress address); - bool sendQuerySubsystemIdentification(JausAddress address); - bool sendQueryComponentIdentification(JausAddress address); - - bool sendQueryNodeConfiguration(JausAddress address, bool createEvent); - bool sendQuerySubsystemConfiguration(JausAddress address, bool createEvent); - bool sendQueryComponentServices(JausAddress address); - - void startupState(); - void intializeState(); - void standbyState(); - void readyState(); - void emergencyState(); - void failureState(); - void shutdownState(); - void allState(); - - int getNextEventId(); - - HASH_MAP nodeChangeList; - HASH_MAP subsystemChangeList; - bool eventId[255]; - SystemTree *systemTree; -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/OjUdpComponentInterface.h b/lib/openjaus/libopenJaus/include/nodeManager/OjUdpComponentInterface.h deleted file mode 100644 index 2222ebc8dd45a33515b625eeee973c9c8d31333e..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/OjUdpComponentInterface.h +++ /dev/null @@ -1,115 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: OjUdpComponentInterface.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef OJ_UDP_COMPONENT_INTERFACE_H -#define OJ_UDP_COMPONENT_INTERFACE_H - -#if defined(WIN32) - #include - #define HASH_MAP stdext::hash_map -#elif defined(__GNUC__) - #include - #define HASH_MAP __gnu_cxx::hash_map -#else - #error "Hash Map undefined in SystemTable.h." -#endif - -#include "JausTransportInterface.h" -#include "JausComponentCommunicationManager.h" -#include "SystemTree.h" -#include "NodeManagerComponent.h" -#include "utils/datagramSocket.h" - -#define OJ_UDP_INTERFACE_MESSAGE_SIZE_BYTES 8 -#define OJ_UDP_DEFAULT_PORT 24627 // Per OJ Nodemanager Interface Document -#define OJ_UDP_DEFAULT_TIMEOUT 1.0f - -static const std::string OJ_UDP_DEFAULT_COMPONENT_IP = "127.0.0.1"; // Per OJ Nodemanager Interface Document - -class OjUdpComponentInterface : public JausTransportInterface -{ -public: - OjUdpComponentInterface(FileLoader *configData, EventHandler *handler, JausComponentCommunicationManager *commMngr); - ~OjUdpComponentInterface(void); - - unsigned int getPort(void); - bool processMessage(JausMessage message); - std::string toString(); - bool startInterface(void); - bool stopInterface(void); - -private: - NodeManagerComponent *nodeManager; - SystemTree *systemTree; - DatagramSocket socket; - InetAddress ipAddress; - unsigned short portNumber; - HASH_MAP portMap; - - bool sendDatagramPacket(DatagramPacket dgPacket); - bool openSocket(void); - void closeSocket(void); - void run(); - - bool processOjNodemanagerInterfaceMessage(char *buffer); - - // Message type codes - enum - { - CHECK_IN = 0x01, - REPORT_ADDRESS = 0x02, - CHECK_OUT = 0x03, - VERIFY_ADDRESS = 0x04, - ADDRESS_VERIFIED = 0x05, - GET_COMPONENT_ADDRESS_LIST = 0x06, - COMPONENT_ADDRESS_LIST_RESPONSE = 0x07, - LOOKUP_ADDRESS = 0x08, - LOOKUP_ADDRESS_RESPONSE = 0x09, - LOOKUP_SERVICE_ADDRESS = 0x0A, - LOOKUP_SERVICE_ADDRESS_RESPONSE = 0x0B, - LOOKUP_SERVICE_ADDRESS_LIST = 0x0C, - LOOKUP_SERVICE_ADDRESS_LIST_RESPONSE = 0x0D - }; -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/SystemTree.h b/lib/openjaus/libopenJaus/include/nodeManager/SystemTree.h deleted file mode 100644 index 969f0db91fd4754bdb11453526f47dddf101d69a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/SystemTree.h +++ /dev/null @@ -1,195 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: SystemTree.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef SYSTEM_TREE_H -#define SYSTEM_TREE_H - -#include -#include "utils/FileLoader.h" -#include "EventHandler.h" -#include "jaus.h" - -class SystemTree -{ -public: - SystemTree(FileLoader *configData, EventHandler *handler); - ~SystemTree(void); - - bool updateComponentTimestamp(JausAddress address); - bool updateNodeTimestamp(JausAddress address); - bool updateSubsystemTimestamp(JausAddress address); - - bool setComponentServices(JausAddress address, JausArray inputServices); - - bool setSubsystemIdentification(JausAddress address, char *identification); - bool setNodeIdentification(JausAddress address, char *identification); - bool setComponentIdentification(JausAddress address, char *identification); - - char *getSubsystemIdentification(JausSubsystem subsystem); - char *getSubsystemIdentification(JausAddress address); - char *getSubsystemIdentification(int subsId); - - char *getNodeIdentification(JausNode node); - char *getNodeIdentification(JausAddress address); - char *getNodeIdentification(int subsId, int nodeId); - - bool hasComponent(JausComponent cmpt); - bool hasComponent(JausAddress address); - bool hasComponent(int subsystemId, int nodeId, int componentId, int instanceId); - - bool hasNode(JausNode node); - bool hasNode(JausAddress address); - bool hasNode(int subsId, int nodeId); - - bool hasSubsystem(JausSubsystem subsystem); - bool hasSubsystem(JausAddress address); - bool hasSubsystem(int subsId); - - bool hasSubsystemIdentification(JausSubsystem subsystem); - bool hasSubsystemIdentification(JausAddress address); - bool hasSubsystemIdentification(int subsId); - - bool hasSubsystemConfiguration(JausSubsystem subsystem); - bool hasSubsystemConfiguration(JausAddress address); - bool hasSubsystemConfiguration(int subsId); - - bool hasNodeIdentification(JausNode node); - bool hasNodeIdentification(JausAddress address); - bool hasNodeIdentification(int subsId, int nodeId); - - bool hasNodeConfiguration(JausNode node); - bool hasNodeConfiguration(JausAddress address); - bool hasNodeConfiguration(int subsId, int nodeId); - - bool hasComponentIdentification(JausComponent cmpt); - bool hasComponentIdentification(JausAddress address); - bool hasComponentIdentification(int subsystemId, int nodeId, int componentId, int instanceId); - - bool hasComponentServices(JausComponent cmpt); - bool hasComponentServices(JausAddress address); - bool hasComponentServices(int subsystemId, int nodeId, int componentId, int instanceId); - - JausSubsystem *getSystem(void); - - JausSubsystem getSubsystem(JausSubsystem subsystem); - JausSubsystem getSubsystem(JausAddress address); - JausSubsystem getSubsystem(int subsId); - - JausNode getNode(JausNode node); - JausNode getNode(JausAddress address); - JausNode getNode(int subsId, int nodeId); - - JausComponent getComponent(JausComponent cmpt); - JausComponent getComponent(JausAddress address); - JausComponent getComponent(int subsystemId, int nodeId, int componentId, int instanceId); - - bool addSubsystem(JausSubsystem subs); - bool addSubsystem(JausAddress address, JausSubsystem subs); - bool addSubsystem(int subsId, JausSubsystem subs); - - bool addNode(JausNode node); - bool addNode(JausAddress address, JausNode node); - bool addNode(int subsId, int nodeId, JausNode node); - - bool addComponent(JausComponent cmpt); - bool addComponent(JausAddress address, JausComponent cmpt); - bool addComponent(int subsystemId, int nodeId, int componentId, int instanceId, JausComponent cmpt); - - bool removeSubsystem(JausSubsystem subsystem); - bool removeSubsystem(JausAddress address); - bool removeSubsystem(int subsId); - - bool removeNode(JausNode node); - bool removeNode(JausAddress address); - bool removeNode(int subsId, int nodeId); - - bool removeComponent(JausComponent cmpt); - bool removeComponent(JausAddress address); - bool removeComponent(int subsystemId, int nodeId, int componentId, int instanceId); - - bool replaceSubsystem(JausAddress address, JausSubsystem newSubs); - bool replaceSubsystem(int subsystemId, JausSubsystem newSubs); - - bool replaceNode(JausAddress address, JausNode newNode); - bool replaceNode(int subsystemId, int nodeId, JausNode newNode); - bool replaceComponent(JausAddress address, JausComponent newCmpt); - - JausAddress lookUpAddress(JausAddress address); - JausAddress lookUpAddress(int lookupSubs, int lookupNode, int lookupCmpt, int lookupInst); - JausAddress lookUpAddress2(int lookupSubs, int lookupNode, int lookupCmpt, int lookupInst); - JausAddress lookUpAddressInNode(JausNode node, int lookupCmpt, int lookupInst); - JausAddress lookUpAddressInSubsystem(JausSubsystem subs, int lookupNode, int lookupCmpt, int lookupInst); - - JausAddress lookUpServiceInNode(int nodeId, int commandCode, int serviceType); - JausAddress lookUpServiceInNode(JausNode node, int commandCode, int serviceType); - JausAddress lookUpServiceInSubsystem(int subsId, int nodeId, int commandCode, int serviceType); - JausAddress lookUpServiceInSubsystem(JausSubsystem subs, int commandCode, int serviceType); - JausAddress lookUpServiceInSystem(int commandCode, int serviceType); - JausAddress lookUpService(JausAddress address, int commandCode, int serviceType); - - unsigned char getNextInstanceId(JausAddress address); - bool registerEventHandler(EventHandler *handler); - - std::string toString(); - std::string toDetailedString(); - void refresh(); - -private: - FileLoader *configData; - std::list eventHandlers; - JausSubsystem system[255]; - int subsystemCount; - int mySubsystemId; - int myNodeId; - - JausNode findNode(JausNode node); - JausNode findNode(JausAddress address); - JausNode findNode(int subsId, int nodeId); - - JausComponent findComponent(JausComponent cmpt); - JausComponent findComponent(JausAddress address); - JausComponent findComponent(int subsId, int nodeId, int cmptId, int instId); - void handleEvent(NodeManagerEvent *e); -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/events/ConfigurationEvent.h b/lib/openjaus/libopenJaus/include/nodeManager/events/ConfigurationEvent.h deleted file mode 100644 index 265a65d3d5a5b01ec9e781b9789a8b1b0f1e3a43..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/events/ConfigurationEvent.h +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: ConfigurationEvent.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef CONFIGURATION_EVENT_H -#define CONFIGURATION_EVENT_H - -#include -#include "NodeManagerEvent.h" - -class EXPORT ConfigurationEvent : public NodeManagerEvent -{ -public: - ConfigurationEvent(const char *function, long line, std::string userString); - ~ConfigurationEvent(); - ConfigurationEvent *cloneEvent(); - std::string toString(); - std::string getUserString(); - -private: - std::string userString; - std::string function; - long line; -}; - -#endif - diff --git a/lib/openjaus/libopenJaus/include/nodeManager/events/DebugEvent.h b/lib/openjaus/libopenJaus/include/nodeManager/events/DebugEvent.h deleted file mode 100644 index 0206ac5d3649cbb2d9c69142dd2ec9f05a2b7b91..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/events/DebugEvent.h +++ /dev/null @@ -1,69 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: DebugEvent.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef DEBUG_EVENT_H -#define DEBUG_EVENT_H - -#include -#include "NodeManagerEvent.h" - -class EXPORT DebugEvent : public NodeManagerEvent -{ -public: - DebugEvent(std::string debugClass); - DebugEvent(std::string debugClass, const char *function, long line, std::string debugString); - ~DebugEvent(); - DebugEvent *cloneEvent(); - std::string toString(); - std::string getDebugString(); - std::string getDebugClass(); - -private: - std::string debugClass; - std::string debugString; - std::string function; - long line; -}; - -#endif - diff --git a/lib/openjaus/libopenJaus/include/nodeManager/events/ErrorEvent.h b/lib/openjaus/libopenJaus/include/nodeManager/events/ErrorEvent.h deleted file mode 100644 index 6ed12575eafd8a9ec9c6ebe5ddcc27e62f0997ae..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/events/ErrorEvent.h +++ /dev/null @@ -1,70 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: ErrorEvent.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef ERROR_EVENT_H -#define ERROR_EVENT_H - -#include -#include "NodeManagerEvent.h" - -class EXPORT ErrorEvent : public NodeManagerEvent -{ -public: - ErrorEvent(unsigned int subType); - ErrorEvent(unsigned int subType, const char *function, long line, std::string userString); - ~ErrorEvent(); - ErrorEvent *cloneEvent(); - std::string toString(); - std::string getUserString(); - - enum {Routing, Memory, NullPointer, Configuration, Message, Warning}; - -private: - unsigned int subType; - std::string userString; - std::string function; - long line; -}; - -#endif - diff --git a/lib/openjaus/libopenJaus/include/nodeManager/events/JausMessageEvent.h b/lib/openjaus/libopenJaus/include/nodeManager/events/JausMessageEvent.h deleted file mode 100644 index fb76f8f6d02768c6e5e6c111ec8b347f6188ecb1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/events/JausMessageEvent.h +++ /dev/null @@ -1,71 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausMessageEvent.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef JAUS_MESSAGE_EVENT_H -#define JAUS_MESSAGE_EVENT_H - -#include -#include "nodeManager/events/NodeManagerEvent.h" -#include "nodeManager/JausTransportInterface.h" - -class EXPORT JausMessageEvent : public NodeManagerEvent -{ -public: - JausMessageEvent(JausMessage message, JausTransportInterface *transport, unsigned char direction); - ~JausMessageEvent(); - JausMessageEvent *cloneEvent(); - - std::string toString(); - JausMessage getJausMessage(); - JausTransportInterface *getJausTransportInterface(); - unsigned char getMessageDirection(); - - enum{Inbound, Outbound}; - -private: - unsigned char direction; - JausMessage message; - JausTransportInterface *transport; -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManager/events/NodeManagerEvent.h b/lib/openjaus/libopenJaus/include/nodeManager/events/NodeManagerEvent.h deleted file mode 100644 index 34cb93b9d12db098db2411410a2f425a030d9e28..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/events/NodeManagerEvent.h +++ /dev/null @@ -1,71 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: NodeManagerEvent.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef NM_EVENT_H -#define NM_EVENT_H - -#include - -#ifdef WIN32 - #define EXPORT __declspec(dllexport) -#else - #define EXPORT -#endif - -class EXPORT NodeManagerEvent -{ - -public: - enum {SystemTreeEvent, ErrorEvent, JausMessageEvent, DebugEvent, ConfigurationEvent}; - unsigned int getType(); - virtual std::string toString(); - virtual ~NodeManagerEvent(); - virtual NodeManagerEvent *cloneEvent() = 0; - -protected: - unsigned int type; - -}; - -#endif - diff --git a/lib/openjaus/libopenJaus/include/nodeManager/events/SystemTreeEvent.h b/lib/openjaus/libopenJaus/include/nodeManager/events/SystemTreeEvent.h deleted file mode 100644 index e4e0a1aee84f5f11f5d0ea5984f2531b6c66947c..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManager/events/SystemTreeEvent.h +++ /dev/null @@ -1,78 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: SystemTreeEvent.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#ifndef SYSTEM_TREE_EVENT_H -#define SYSTEM_TREE_EVENT_H - -#include -#include "NodeManagerEvent.h" -#include "jaus.h" - -class EXPORT SystemTreeEvent : public NodeManagerEvent -{ -public: - SystemTreeEvent(unsigned int type); - SystemTreeEvent(unsigned int type, JausSubsystem subs); - SystemTreeEvent(unsigned int type, JausNode node); - SystemTreeEvent(unsigned int type, JausComponent cmpt); - ~SystemTreeEvent(); - SystemTreeEvent *cloneEvent(); - - std::string toString(); - unsigned int getSubType(); - JausComponent getComponent(); - JausNode getNode(); - JausSubsystem getSubsystem(); - - enum { SubsystemAdded, SubsystemRemoved, SubsystemTimeout, - NodeAdded, NodeRemoved, NodeTimeout, - ComponentAdded, ComponentRemoved, ComponentTimeout}; - -private: - unsigned int subType; - JausSubsystem subs; - JausNode node; - JausComponent cmpt; -}; - -#endif diff --git a/lib/openjaus/libopenJaus/include/nodeManagerInterface/nodeManagerInterface.h b/lib/openjaus/libopenJaus/include/nodeManagerInterface/nodeManagerInterface.h deleted file mode 100644 index 71ef9acbfb8eef7210a6c2e1740c3e5c7da6a145..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/nodeManagerInterface/nodeManagerInterface.h +++ /dev/null @@ -1,223 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -#ifndef NODE_MANAGER_H -#define NODE_MANAGER_H - -#include "utils/datagramSocket.h" -#include "utils/inetAddress.h" -#include "utils/queue.h" -#include "utils/timeLib.h" -#include -#include -#include - -#ifdef WIN32 - #define JAUS_EXPORT __declspec(dllexport) -#else - #define JAUS_EXPORT -#endif - -#define OJ_NODE_MANAGER_INTERFACE_VERSION "3.3.0" - -#define NMI_MESSAGE_RECEIVED 1 -#define NMI_RECEIVE_TIMED_OUT 2 -#define NMI_CONDITIONAL_WAIT_ERROR 3 -#define NMI_CLOSED_ERROR 4 - -#ifdef __cplusplus -extern "C" -{ -#endif - -#define SC_ERROR_SEQUENCE_NUMBERS_EQUAL -1 -#define SC_ERROR_SEQUENCE_NUMBER_OUT_OF_SYNC -2 -#define SC_ERROR_SERVICE_CONNECTION_QUEUE_EMPTY -1 -#define SC_ERROR_SERVICE_CONNECTION_DOES_NOT_EXIST -2 - -typedef struct ServiceConnectionStruct -{ - double requestedUpdateRateHz; - double confirmedUpdateRateHz; - double lastSentTime; - double timeoutSec; - double nextRequestTimeSec; - - JausAddress address; - JausUnsignedInteger presenceVector; - JausUnsignedShort commandCode; - JausUnsignedShort sequenceNumber; - - int instanceId; - JausBoolean isActive; - - Queue queue; - unsigned int queueSize; - - struct ServiceConnectionStruct *nextSc; -}ServiceConnectionStruct; - -typedef ServiceConnectionStruct *ServiceConnection; - -typedef struct SupportedScMessageStruct -{ - unsigned short commandCode; - ServiceConnection scList; - struct SupportedScMessageStruct *nextSupportedScMsg; -}SupportedScMessageStruct; - -typedef SupportedScMessageStruct *SupportedScMessage; - -typedef struct -{ - SupportedScMessage supportedScMsgList; - ServiceConnection incomingSc; - int supportedScMsgCount; - int outgoingScCount; - int incomingScCount; - pthread_mutex_t mutex; -}ServiceConnectionManagerStruct; - -typedef ServiceConnectionManagerStruct *ServiceConnectionManager; - -typedef struct JausAddressListStruct -{ - JausAddress address; - struct JausAddressListStruct *nextAddress; -}JausAddressList; - -typedef struct -{ - JausArray messageLists; -}LargeMessageHandlerStruct; - -typedef LargeMessageHandlerStruct *LargeMessageHandler; - -typedef struct -{ - JausUnsignedShort commandCode; - JausAddress source; - JausArray messages; -}LargeMessageListStruct; - -typedef LargeMessageListStruct *LargeMessageList; - -typedef struct -{ - DatagramSocket interfaceSocket; - DatagramSocket messageSocket; - - pthread_t heartbeatThreadId; - int heartbeatThreadRunning; - pthread_t receiveThreadId; - int receiveThreadRunning; - - pthread_cond_t recvCondition; - pthread_cond_t hbWakeCondition; - - InetAddress ipAddress; - - Queue receiveQueue; - - JausComponent cmpt; - - int isOpen; - - int heartbeatCount; - int receiveCount; - - double timestamp; - - ServiceConnectionManager scm; - LargeMessageHandler lmh; -}NodeManagerInterfaceStruct; - -typedef NodeManagerInterfaceStruct *NodeManagerInterface; - -JAUS_EXPORT NodeManagerInterface nodeManagerOpen(JausComponent); -JAUS_EXPORT int nodeManagerClose(NodeManagerInterface); -JAUS_EXPORT int nodeManagerReceive(NodeManagerInterface, JausMessage *); -JAUS_EXPORT int nodeManagerTimedReceive(NodeManagerInterface nmi, JausMessage *message, double timeLimitSec); -JAUS_EXPORT int nodeManagerSend(NodeManagerInterface, JausMessage); -JAUS_EXPORT int nodeManagerSendSingleMessage(NodeManagerInterface, JausMessage); -JAUS_EXPORT JausAddressList *nodeManagerGetComponentAddressList(NodeManagerInterface, unsigned char); -JAUS_EXPORT void nodeManagerDestroyAddressList(JausAddressList *); -JAUS_EXPORT int nodeManagerVerifyAddress(NodeManagerInterface, JausAddress); -JAUS_EXPORT JausBoolean nodeManagerLookupAddress(NodeManagerInterface, JausAddress); -JAUS_EXPORT void nodeManagerSendCoreServiceConnections(NodeManagerInterface); -JAUS_EXPORT JausBoolean nodeManagerLookupServiceAddress(NodeManagerInterface, JausAddress, unsigned short, int); -JAUS_EXPORT JausAddressList* nodeManagerLookupServiceAddressList(NodeManagerInterface, JausAddress, unsigned short, int); - -JAUS_EXPORT ServiceConnection serviceConnectionCreate(void); -JAUS_EXPORT void serviceConnectionDestroy(ServiceConnection sc); - -JAUS_EXPORT ServiceConnectionManager scManagerCreate(void); -JAUS_EXPORT void scManagerDestroy(ServiceConnectionManager); - -JAUS_EXPORT void scManagerProcessConfirmScMessage(NodeManagerInterface, ConfirmServiceConnectionMessage); -JAUS_EXPORT void scManagerProcessCreateScMessage(NodeManagerInterface, CreateServiceConnectionMessage); -JAUS_EXPORT void scManagerProcessActivateScMessage(NodeManagerInterface, ActivateServiceConnectionMessage); -JAUS_EXPORT void scManagerProcessSuspendScMessage(NodeManagerInterface, SuspendServiceConnectionMessage); -JAUS_EXPORT void scManagerProcessTerminateScMessage(NodeManagerInterface, TerminateServiceConnectionMessage); -JAUS_EXPORT void scManagerProcessUpdatedSubystem(NodeManagerInterface, JausSubsystem); - -JAUS_EXPORT void scManagerAddSupportedMessage(NodeManagerInterface, unsigned short); -JAUS_EXPORT void scManagerRemoveSupportedMessage(NodeManagerInterface, unsigned short); -JAUS_EXPORT JausBoolean scManagerQueryActiveMessage(NodeManagerInterface, unsigned short); - -JAUS_EXPORT ServiceConnection scManagerGetSendList(NodeManagerInterface, unsigned short); -JAUS_EXPORT void scManagerDestroySendList(ServiceConnection); - -JAUS_EXPORT JausBoolean scManagerCreateServiceConnection(NodeManagerInterface nmi, ServiceConnection sc); -JAUS_EXPORT JausBoolean scManagerTerminateServiceConnection(NodeManagerInterface, ServiceConnection); -JAUS_EXPORT JausBoolean scManagerReceiveServiceConnection(NodeManagerInterface nmi, ServiceConnection requestSc, JausMessage *message); -JAUS_EXPORT void scManagerReceiveMessage(NodeManagerInterface, JausMessage); - -JAUS_EXPORT void defaultJausMessageProcessor(JausMessage, NodeManagerInterface, JausComponent); -JAUS_EXPORT void defaultJausMessageProcessorNoDestroy(JausMessage message, NodeManagerInterface nmi, JausComponent cmpt); - -JAUS_EXPORT LargeMessageHandler lmHandlerCreate(void); -JAUS_EXPORT void lmHandlerDestroy(LargeMessageHandler); -JAUS_EXPORT LargeMessageList lmListCreate(void); -JAUS_EXPORT void lmListDestroy(LargeMessageList); -JAUS_EXPORT void lmHandlerReceiveLargeMessage(NodeManagerInterface, JausMessage); -JAUS_EXPORT int lmHandlerMessageListEqual(LargeMessageList, LargeMessageList); -JAUS_EXPORT LargeMessageList lmHandlerGetMessageList(LargeMessageHandler, JausMessage); -JAUS_EXPORT int lmHandlerLargeMessageCheck(JausMessage, JausMessage); -JAUS_EXPORT int lmHandlerSendLargeMessage(NodeManagerInterface, JausMessage); - -#ifdef __cplusplus -} -#endif - -#endif // NODE_MANAGER_INTERFACE_H diff --git a/lib/openjaus/libopenJaus/include/openJaus.h b/lib/openjaus/libopenJaus/include/openJaus.h deleted file mode 100644 index e99aa94f0a8dd11918b91005e857a52c6be0f714..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/openJaus.h +++ /dev/null @@ -1,44 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -#ifndef OPEN_JAUS_H -#define OPEN_JAUS_H - -#ifdef __cplusplus -#include "nodeManager/NodeManager.h" -#endif - -#include "nodeManagerInterface/nodeManagerInterface.h" -#include "componentLibrary/ojCmpt.h" - -#endif // OPEN_JAUS_H diff --git a/lib/openjaus/libopenJaus/include/utils/FileLoader.h b/lib/openjaus/libopenJaus/include/utils/FileLoader.h deleted file mode 100644 index 7034419179737bc3c459d470788db0df619648a5..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/utils/FileLoader.h +++ /dev/null @@ -1,162 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: FileLoader.h -// -// Written By: Jeffrey Kunkle -// -// Version: 3.3.0a -// -// Date: 04/26/2006 -// -// Description: - -#ifndef FILE_LOADER_H -#define FILE_LOADER_H - -#include -#include -#include -#include - -using std::string; -using std::vector; -using std::ios; -using std::ifstream; - -#ifdef WIN32 - #define EXPORT __declspec(dllexport) -#else - #define EXPORT -#endif - -struct Config_Data_t -{ - string label; - vector< string > tok; -}; - -struct Config_File_Data_t -{ - string configheader; - vector< Config_Data_t > data; -}; - -class FileLoader -{ -private: - vector< Config_File_Data_t > configFileData; - int findHeader( string hdr ); - int findLabel( int hdrIndex, string label ); - -public: - /** - * @brief Constructs the File Loader - */ - EXPORT FileLoader( ); - EXPORT FileLoader( string filename ); - - /** - * @brief Deconstructs the File Loader - */ - EXPORT ~FileLoader( ); - - /** - * @brief Loads the configuration file - * - * @param[in] filename is the name of the configuration file with extension - * @return success - */ - EXPORT bool load_cfg( string filename ); - - /** - * @brief Reads a string from the config file - * - * @param[in] header The data grouping. In the config file, this is enclosed in "[]" - * @param[in] label The label of the data being searched for. In the config file, this ends with ":" - * - * @return The string being searched for or "" if not found - */ - EXPORT string GetConfigDataString( string header, string label ); - - /** - * @brief Reads an int from the config file - * - * @param[in] header The data grouping. In the config file, this is enclosed in "[]" - * @param[in] label The label of the data being searched for. In the config file, this ends with ":" - * - * @return The int being searched for, -1 if not found, or 0 if a string or char - */ - EXPORT int GetConfigDataInt( string header, string label ); - - /** - * @brief Reads a float from the config file - * - * @param[in] header The data grouping. In the config file, this is enclosed in "[]" - * @param[in] label The label of the data being searched for. In the config file, this ends with ":" - * - * @return The float being searched for, -1 if not found, or 0 if a string or char - */ - EXPORT float GetConfigDataFloat( string header, string label ); - - /** - * @brief Reads a double from the config file - * - * @param[in] header The data grouping. In the config file, this is enclosed in "[]" - * @param[in] label The label of the data being searched for. In the config file, this ends with ":" - * - * @return The double being searched for, -1 if not found, or 0 if a string or char - */ - EXPORT double GetConfigDataDouble( string header, string label ); - - /** - * @brief Reads a vector from the config file - * - * @param[in] header The data grouping. In the config file, this is enclosed in "[]" - * @param[in] label The label of the data being searched for. In the config file, this ends with ":" - * - * @return A pointer to the vector being searched for or NULL if nothing found - */ - EXPORT vector< string >* GetConfigDataVector( string header, string label ); - - /** - * @brief Reads a boolean from the config file - * - * @param[in] header The data grouping. In the config file, this is enclosed in "[]" - * @param[in] label The label of the data being searched for. In the config file, this ends with ":" - * - * @return true if "true" (compared case insensitve) is found, false otherwise - */ - EXPORT bool GetConfigDataBool( string header, string label ); -}; -#endif diff --git a/lib/openjaus/libopenJaus/include/utils/datagramPacket.h b/lib/openjaus/libopenJaus/include/utils/datagramPacket.h deleted file mode 100644 index 2b0bbddf8fffb25632763d1faed6d57402494d36..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/utils/datagramPacket.h +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: datagramPacket.h -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) and Danny Kent -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes the functionality associated with a DatagramPacket object. -// Inspired by the class of the same name in the JAVA language. - -#ifndef DATAGRAM_PACKET_H -#define DATAGRAM_PACKET_H - -#ifdef WIN32 - #include - #include - #ifndef socklen_t - typedef int socklen_t; - #endif - #define CLOSE_SOCKET closesocket - typedef unsigned int size_t; -#elif defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - #include - #include - #include - #include - #include - #include - #include - #define CLOSE_SOCKET close -#else - #error "No Socket implementation defined for this platform." -#endif - -#include "utils/inetAddress.h" - -#ifdef WIN32 - #define JAUS_EXPORT __declspec(dllexport) -#else - #define JAUS_EXPORT -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef struct -{ - unsigned char *buffer; - -#if defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - size_t bufferSizeBytes; -#else - int bufferSizeBytes; -#endif - - unsigned short port; - InetAddress address; -}DatagramPacketStruct; - -typedef DatagramPacketStruct *DatagramPacket; - -JAUS_EXPORT DatagramPacket datagramPacketCreate(void); -JAUS_EXPORT void datagramPacketDestroy(DatagramPacket); - -#ifdef __cplusplus -} -#endif - -#endif // DATAGRAM_PACKET_H diff --git a/lib/openjaus/libopenJaus/include/utils/datagramSocket.h b/lib/openjaus/libopenJaus/include/utils/datagramSocket.h deleted file mode 100644 index d951d6452585784eb69490a302d6231a2d19fb82..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/utils/datagramSocket.h +++ /dev/null @@ -1,109 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: datagramSocket.h -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes the functionality associated with a DatagramSocket object. -// Inspired by the class of the same name in the JAVA language. - -#ifndef DATAGRAM_SOCKET_H -#define DATAGRAM_SOCKET_H - -#ifdef WIN32 - #include - #include - #ifndef socklen_t - typedef int socklen_t; - #endif - #define CLOSE_SOCKET closesocket - typedef unsigned int size_t; -#elif defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - #include - #include - #include - #include - #include - #include - #include - #define CLOSE_SOCKET close -#else - #error "No Socket implementation defined for this platform." -#endif - -#include "utils/inetAddress.h" -#include "utils/datagramPacket.h" - -#ifdef WIN32 - #define JAUS_EXPORT __declspec(dllexport) -#else - #define JAUS_EXPORT -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef struct -{ - int descriptor; - unsigned short port; - InetAddress address; - struct timeval timeout; - int blocking; -}DatagramSocketStruct; - -typedef DatagramSocketStruct *DatagramSocket; - -JAUS_EXPORT DatagramSocket datagramSocketCreate(short, InetAddress); -JAUS_EXPORT void datagramSocketDestroy(DatagramSocket); - -JAUS_EXPORT void datagramSocketSetSendBufferSize(DatagramSocket, int); -JAUS_EXPORT int datagramSocketGetSendBufferSize(DatagramSocket); -JAUS_EXPORT void datagramSocketSetRecvBufferSize(DatagramSocket, int); -JAUS_EXPORT int datagramSocketGetRecvBufferSize(DatagramSocket); -JAUS_EXPORT int datagramSocketSend(DatagramSocket, DatagramPacket); -JAUS_EXPORT int datagramSocketReceive(DatagramSocket, DatagramPacket); -JAUS_EXPORT void datagramSocketSetTimeout(DatagramSocket, double); - -#ifdef __cplusplus -} -#endif - -#endif // DATAGRAM_SOCKET_H diff --git a/lib/openjaus/libopenJaus/include/utils/inetAddress.h b/lib/openjaus/libopenJaus/include/utils/inetAddress.h deleted file mode 100644 index ea45a6b20d42e764b8b656ebd6b2cf0c480bd4d2..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/utils/inetAddress.h +++ /dev/null @@ -1,97 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: inetAddress.h -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes the functionality associated with a InetAddress object. -// Inspired by the class of the same name in the JAVA language. - -#ifndef INET_ADDRESS_H -#define INET_ADDRESS_H - -#ifdef WIN32 - #define JAUS_EXPORT __declspec(dllexport) - #include - #include - #ifndef socklen_t - typedef int socklen_t; - #endif - #define CLOSE_SOCKET closesocket - typedef unsigned int size_t; - #define JAUS_EXPORT __declspec(dllexport) -#elif defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - #define JAUS_EXPORT - #include - #include - #include - #include - #include - #include - #include - #define CLOSE_SOCKET close - #define JAUS_EXPORT -#else - #error "No Socket implementation defined for this platform." -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef struct -{ - unsigned int value; -}InetAddressStruct; - -typedef InetAddressStruct *InetAddress; - -JAUS_EXPORT InetAddress inetAddressCreate(void); -JAUS_EXPORT void inetAddressDestroy(InetAddress); -JAUS_EXPORT InetAddress inetAddressGetLocalHost(void); -JAUS_EXPORT InetAddress inetAddressGetByName(char *); -JAUS_EXPORT InetAddress inetAddressGetByString(char *); -JAUS_EXPORT int inetAddressToString(InetAddress, char *); -JAUS_EXPORT void inetAddressToBuffer(InetAddress address, char *string, int length); - -#ifdef __cplusplus -} -#endif - -#endif // INET_ADDRESS_H diff --git a/lib/openjaus/libopenJaus/include/utils/multicastSocket.h b/lib/openjaus/libopenJaus/include/utils/multicastSocket.h deleted file mode 100644 index 100c2b95a666b87b97f7379309ede48e9213879c..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/utils/multicastSocket.h +++ /dev/null @@ -1,107 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: multicastSocket.h -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes the functionality associated with a MulicastSocket object. -// Inspired by the class of the same name in the JAVA language. - -#ifndef MULTICAST_SOCKET_H -#define MULTICAST_SOCKET_H - -#ifdef WIN32 - #include - #include - #ifndef socklen_t - typedef int socklen_t; - #endif - #define CLOSE_SOCKET closesocket - typedef unsigned int size_t; -#elif defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - #include - #include - #include - #include - #include - #include - #include - #define CLOSE_SOCKET close -#else - #error "No Socket implementation defined for this platform." -#endif - -#include "utils/inetAddress.h" -#include "utils/datagramSocket.h" - -#define LOOPBACK_ENABLED 1 -#define LOOPBACK_DISABLED 0 - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef struct -{ - int unicastSocketDescriptor; - int multicastSocketDescriptor; - unsigned short port; - InetAddress address; - struct timeval timeout; - int blocking; - //NetworkInterface netIf; -}MulticastSocketStruct; - -typedef MulticastSocketStruct *MulticastSocket; - -JAUS_EXPORT MulticastSocket multicastSocketCreate(short, InetAddress ipAdress); -JAUS_EXPORT void multicastSocketDestroy(MulticastSocket); -JAUS_EXPORT int multicastSocketJoinGroup(MulticastSocket, InetAddress); -JAUS_EXPORT int multicastSocketSend(MulticastSocket, DatagramPacket); -JAUS_EXPORT int multicastSocketReceive(MulticastSocket multicastSocket, DatagramPacket packet); -JAUS_EXPORT int multicastSocketSetTTL(MulticastSocket multicastSocket, unsigned int ttl); -JAUS_EXPORT int multicastSocketSetLoopback(MulticastSocket multicastSocket, unsigned int loop); -JAUS_EXPORT void multicastSocketSetTimeout(MulticastSocket multicastSocket, double timeoutSec); - - -#ifdef __cplusplus -} -#endif - -#endif // MULTICAST_SOCKET_H diff --git a/lib/openjaus/libopenJaus/include/utils/queue.h b/lib/openjaus/libopenJaus/include/utils/queue.h deleted file mode 100644 index 22b5ce09bd18990f27cbecb27f39f155b950f799..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/utils/queue.h +++ /dev/null @@ -1,77 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queue.h -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes the functionality associated with a generic void pointer Queue object. - -#ifndef QUEUE_H -#define QUEUE_H - -#ifdef WIN32 - #define JAUS_EXPORT __declspec(dllexport) -#else - #define JAUS_EXPORT -#endif - -#include - -typedef struct queueObject -{ - void *object; - struct queueObject *nextObject; -}QueueObject; - -typedef struct -{ - QueueObject *firstObject; - QueueObject *lastObject; - int size; - pthread_mutex_t mutex; -}QueueStruct; - -typedef QueueStruct *Queue; - -JAUS_EXPORT Queue queueCreate(void); -JAUS_EXPORT void queueDestroy(Queue, void (*)(void *)); -JAUS_EXPORT void *queuePop(Queue); -JAUS_EXPORT void queuePush(Queue, void *); -JAUS_EXPORT void queueEmpty(Queue queue, void (*objectDestroy)(void *)); - -#endif // QUEUE_H diff --git a/lib/openjaus/libopenJaus/include/utils/timeLib.h b/lib/openjaus/libopenJaus/include/utils/timeLib.h deleted file mode 100644 index 6c09669ee1a7ac2bcb81526215d37579e9b9c4f9..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/utils/timeLib.h +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: timeLib.h -// -// Written by: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: CIMAR timing library header file - -#ifndef TIME_LIB_H -#define TIME_LIB_H - -#ifdef WIN32 - #define JAUS_EXPORT __declspec(dllexport) -#else - #define JAUS_EXPORT -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif - -JAUS_EXPORT double getTimeSeconds(void); -JAUS_EXPORT double ojGetTimeSec(void); -JAUS_EXPORT void ojSleepMsec(int msec); - -#ifdef __cplusplus -} -#endif - -#endif // TIME_LIB_H diff --git a/lib/openjaus/libopenJaus/include/utils/timeval.h b/lib/openjaus/libopenJaus/include/utils/timeval.h deleted file mode 100644 index 5b78d4285bd4a57a61eadb056c6dc803352c9a01..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/include/utils/timeval.h +++ /dev/null @@ -1,112 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ - -/* - * timeval.h 1.0 01/12/19 - * - * Defines gettimeofday, timeval, etc. for Win32 - * - * By Wu Yongwei - * - */ - -#ifndef _TIMEVAL_H -#define _TIMEVAL_H - -#ifdef _WIN32 - -#ifndef _INC_WINDOWS - #define WIN32_LEAN_AND_MEAN - #include - - struct timeval { - long tv_sec; /* seconds */ - long tv_usec; /* microseconds */ - }; -#endif /* _INC_WINDOWS */ -#include - -struct timezone { - long tz_minuteswest; /* minutes W of Greenwich */ - int tz_dsttime; /* type of dst correction */ -}; - -#ifndef __GNUC__ -#define EPOCHFILETIME (116444736000000000i64) -#else -#define EPOCHFILETIME (116444736000000000LL) -#endif - -__inline int gettimeofday(struct timeval *tv, struct timezone *tz) -{ - FILETIME ft; - LARGE_INTEGER li; - __int64 t; - static int tzflag; - - if (tv) - { - GetSystemTimeAsFileTime(&ft); - li.LowPart = ft.dwLowDateTime; - li.HighPart = ft.dwHighDateTime; - t = li.QuadPart; /* In 100-nanosecond intervals */ - t -= EPOCHFILETIME; /* Offset to the Epoch time */ - t /= 10; /* In microseconds */ - tv->tv_sec = (long)(t / 1000000); - tv->tv_usec = (long)(t % 1000000); - } - - if (tz) - { - if (!tzflag) - { - _tzset(); - tzflag++; - } - _get_timezone(&tz->tz_minuteswest); - tz->tz_minuteswest /= 60; - - _get_daylight(&tz->tz_dsttime); - } - - return 0; -} - -#else /* _WIN32 */ - -#include - -#endif /* _WIN32 */ - -#endif /* _TIMEVAL_H */ diff --git a/lib/openjaus/libopenJaus/lib/linux/libopenjaus.a b/lib/openjaus/libopenJaus/lib/linux/libopenjaus.a deleted file mode 100644 index 5c37b001b46076701fecd3a31c7f7d79fcd76729..0000000000000000000000000000000000000000 Binary files a/lib/openjaus/libopenJaus/lib/linux/libopenjaus.a and /dev/null differ diff --git a/lib/openjaus/libopenJaus/lib/mac/libopenjaus.a b/lib/openjaus/libopenJaus/lib/mac/libopenjaus.a deleted file mode 100644 index 6d1307853da1de9c1dcb14b1da7f86be557f819b..0000000000000000000000000000000000000000 Binary files a/lib/openjaus/libopenJaus/lib/mac/libopenjaus.a and /dev/null differ diff --git a/lib/openjaus/libopenJaus/libopenJaus.pro b/lib/openjaus/libopenJaus/libopenJaus.pro deleted file mode 100644 index c79796398780e0bf2ffd3b57c0824e4c0552dacb..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/libopenJaus.pro +++ /dev/null @@ -1,116 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Sa Mai 2 12:10:28 2009 -###################################################################### - -TEMPLATE = lib -QT -= gui -CONFIG += static - -VERSION = 3.3.0a - -BASEDIR = . -BUILDDIR = Build - -INCLUDEPATH += $$BASEDIR/../libjaus/include - -LANGUAGE = C++ - -OBJECTS_DIR = $$BUILDDIR/obj -MOC_DIR = $$BUILDDIR/moc - -macx { -TARGET = lib/mac/openjaus -LIBS += -L$$BASEDIR/../libjaus/lib/mac/libjaus.a -ljaus -} - -linux-g++ { -TARGET = lib/linux/openjaus -LIBS += -L$$BASEDIR/../libjaus/lib/linux/libjaus.a -ljaus -} - -win32 { -TARGET = lib/win32/openjaus -LIBS += -L$$BASEDIR/../libjaus/lib/win32/libjaus.a -ljaus -} - -DEPENDPATH += . \ - include \ - include/componentLibrary \ - include/nodeManager \ - include/nodeManagerInterface \ - include/utils \ - src/componentLibrary \ - src/nodeManager \ - src/nodeManagerInterface \ - src/utils \ - include/nodeManager/events \ - src/nodeManager/events -INCLUDEPATH += $$BASEDIR/include - -# Input -HEADERS += include/openJaus.h \ - include/componentLibrary/ojCmpt.h \ - include/nodeManager/CommunicatorComponent.h \ - include/nodeManager/EventHandler.h \ - include/nodeManager/JausCommunicationManager.h \ - include/nodeManager/JausComponentCommunicationManager.h \ - include/nodeManager/JausNodeCommunicationManager.h \ - include/nodeManager/JausOpcUdpInterface.h \ - include/nodeManager/JausSubsystemCommunicationManager.h \ - include/nodeManager/JausTransportInterface.h \ - include/nodeManager/JausTransportQueue.h \ - include/nodeManager/JudpInterface.h \ - include/nodeManager/LocalComponent.h \ - include/nodeManager/MessageRouter.h \ - include/nodeManager/NodeManager.h \ - include/nodeManager/NodeManagerComponent.h \ - include/nodeManager/OjUdpComponentInterface.h \ - include/nodeManager/SystemTree.h \ - include/nodeManagerInterface/nodeManagerInterface.h \ - include/utils/datagramPacket.h \ - include/utils/datagramSocket.h \ - include/utils/FileLoader.h \ - include/utils/inetAddress.h \ - include/utils/multicastSocket.h \ - include/utils/queue.h \ - include/utils/timeLib.h \ - include/utils/timeval.h \ - include/nodeManager/events/ConfigurationEvent.h \ - include/nodeManager/events/DebugEvent.h \ - include/nodeManager/events/ErrorEvent.h \ - include/nodeManager/events/JausMessageEvent.h \ - include/nodeManager/events/NodeManagerEvent.h \ - include/nodeManager/events/SystemTreeEvent.h -SOURCES += src/componentLibrary/ojCmpt.c \ - src/nodeManager/CommunicatorComponent.cpp \ - src/nodeManager/JausCommunicationManager.cpp \ - src/nodeManager/JausComponentCommunicationManager.cpp \ - src/nodeManager/JausNodeCommunicationManager.cpp \ - src/nodeManager/JausOpcUdpInterface.cpp \ - src/nodeManager/JausSubsystemCommunicationManager.cpp \ - src/nodeManager/JausTransportInterface.cpp \ - src/nodeManager/JausTransportQueue.cpp \ - src/nodeManager/JudpInterface.cpp \ - src/nodeManager/LocalComponent.cpp \ - src/nodeManager/MessageRouter.cpp \ - src/nodeManager/NodeManager.cpp \ - src/nodeManager/NodeManagerComponent.cpp \ - src/nodeManager/OjUdpComponentInterface.cpp \ - src/nodeManager/SystemTree.cpp \ - src/nodeManagerInterface/defaultJausMessageProcessor.c \ - src/nodeManagerInterface/lmHandler.c \ - src/nodeManagerInterface/nodeManagerInterface.c \ - src/nodeManagerInterface/scManager.c \ - src/utils/datagramPacket.c \ - src/utils/datagramSocket.c \ - src/utils/FileLoader.cpp \ - src/utils/inetAddress.c \ - src/utils/multicastSocket.c \ - src/utils/queue.c \ - src/utils/timeLib.c \ - src/nodeManager/events/ConfigurationEvent.cpp \ - src/nodeManager/events/DebugEvent.cpp \ - src/nodeManager/events/ErrorEvent.cpp \ - src/nodeManager/events/JausMessageEvent.cpp \ - src/nodeManager/events/NodeManagerEvent.cpp \ - src/nodeManager/events/SystemTreeEvent.cpp diff --git a/lib/openjaus/libopenJaus/src/componentLibrary/ojCmpt.c b/lib/openjaus/libopenJaus/src/componentLibrary/ojCmpt.c deleted file mode 100644 index 7bf68de1274c4ccf179b257ce50be2cca62b65e1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/componentLibrary/ojCmpt.c +++ /dev/null @@ -1,613 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: ojCmpt.c -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file contains the code associated with the OpenJAUS -// Component Library. The Component Library is a wrapper around -// common component functionality which accelerates and eases -// the creation of JAUS components. - -#include -#include -#include -#include "nodeManagerInterface/nodeManagerInterface.h" -#include "componentLibrary/ojCmpt.h" - -typedef struct -{ - void (*function)(OjCmpt, JausMessage); - unsigned short commandCode; -}MessageCallback; // An array to hold the pointers to the message callback functions - -struct OjCmptStruct -{ - double frequencyHz; // Desired frequency of the component - double rateHz; // Actual running frequency of the component - - JausComponent jaus; // A pointer to the JausComponent structure found in the OpenJAUS libjaus library. - - pthread_t thread; // Pointer to the pthread that is running the component thread - pthread_mutex_t scMutex; // TODO: Lock mutex when accessing service connection arrays - - void (*stateCallback[OJ_CMPT_MAX_STATE_COUNT])(OjCmpt); // An array to hold the pointers to the callback functions - void (*mainCallback)(OjCmpt); - void (*processMessageCallback)(OjCmpt, JausMessage); - - MessageCallback *messageCallback; // An array to hold the pointers to the message callback functions - int messageCallbackCount; - - int state; - int run; - - ServiceConnection inConnection[OJ_CMPT_MAX_INCOMING_SC_COUNT]; - - NodeManagerInterface nmi; - - void *userData; -}; - -void* ojCmptThread(void *threadData); -void ojCmptProcessMessage(OjCmpt ojCmpt, JausMessage message); -void ojCmptManageServiceConnections(OjCmpt ojCmpt); - -OjCmpt ojCmptCreate(char *name, JausByte id, double stateFrequencyHz) -{ - OjCmpt ojCmpt; - int i; - - ojCmpt = (OjCmpt)malloc(sizeof(struct OjCmptStruct)); - - ojCmpt->jaus = jausComponentCreate(); - ojCmpt->jaus->identification = (char *)calloc(strlen(name) + 1, 1); - strcpy(ojCmpt->jaus->identification, name); - ojCmpt->jaus->address->component = id; - ojCmptSetState(ojCmpt, JAUS_UNDEFINED_STATE); - ojCmptSetFrequencyHz(ojCmpt, stateFrequencyHz); - - for(i=0; istateCallback[i] = NULL; - } - ojCmpt->mainCallback = NULL; - ojCmpt->processMessageCallback = NULL; - ojCmpt->messageCallback = NULL; - ojCmpt->messageCallbackCount = 0; - - ojCmpt->run = FALSE; - - if (!jausServiceAddCoreServices(ojCmpt->jaus->services)) // Add core services - { - free(ojCmpt->jaus->identification); - ojCmpt->jaus->identification = NULL; - jausComponentDestroy(ojCmpt->jaus); - free(ojCmpt); - return NULL; - } - - for(i=0; iinConnection[i] = NULL; - } - - ojCmpt->nmi = nodeManagerOpen(ojCmpt->jaus); - if(ojCmpt->nmi == NULL) - { - free(ojCmpt->jaus->identification); - ojCmpt->jaus->identification = NULL; - jausComponentDestroy(ojCmpt->jaus); - free(ojCmpt); - return NULL; - } - - return ojCmpt; -} - -int ojCmptRun(OjCmpt ojCmpt) -{ - pthread_attr_t attr; // Thread attributed for the component threads spawned in this function - - ojCmpt->run = TRUE; - - pthread_attr_init(&attr); - if(pthread_create(&ojCmpt->thread, &attr, ojCmptThread, (void*)ojCmpt) != 0) - { - nodeManagerClose(ojCmpt->nmi); // Close Node Manager Connection - free(ojCmpt->jaus->identification); - ojCmpt->jaus->identification = NULL; - jausComponentDestroy(ojCmpt->jaus); - free(ojCmpt); - pthread_attr_destroy(&attr); - return -1; - } - pthread_attr_destroy(&attr); - - return 0; -} - -void ojCmptDestroy(OjCmpt ojCmpt) -{ - RejectComponentControlMessage rejectComponentControl; - JausMessage txMessage; - int i = 0; - - if(ojCmpt->run == TRUE) - { - ojCmpt->run = FALSE; - pthread_cond_signal(&ojCmpt->nmi->recvCondition); - pthread_join(ojCmpt->thread, NULL); - } - - if(ojCmpt->jaus->controller.active) - { - // Terminate control of current component - rejectComponentControl = rejectComponentControlMessageCreate(); - jausAddressCopy(rejectComponentControl->source, ojCmpt->jaus->address); - jausAddressCopy(rejectComponentControl->destination, ojCmpt->jaus->controller.address); - - txMessage = rejectComponentControlMessageToJausMessage(rejectComponentControl); - nodeManagerSend(ojCmpt->nmi, txMessage); - jausMessageDestroy(txMessage); - - rejectComponentControlMessageDestroy(rejectComponentControl); - } - - for(i=0; iinConnection[i]) - { - if(ojCmpt->inConnection[i]->isActive) - { - scManagerTerminateServiceConnection(ojCmpt->nmi, ojCmpt->inConnection[i]); - } - serviceConnectionDestroy(ojCmpt->inConnection[i]); - } - } - - if(ojCmpt->messageCallback) - { - free(ojCmpt->messageCallback); - } - - if(ojCmpt->nmi) - { - nodeManagerClose(ojCmpt->nmi); // Close Node Manager Connection - } - - free(ojCmpt->jaus->identification); - ojCmpt->jaus->identification = NULL; - jausComponentDestroy(ojCmpt->jaus); - free(ojCmpt); -}; - -void ojCmptSetFrequencyHz(OjCmpt ojCmpt, double stateFrequencyHz) -{ - if(stateFrequencyHz > OJ_CMPT_MIN_FREQUENCY_HZ && stateFrequencyHz < OJ_CMPT_MAX_FREQUENCY_HZ) - { - ojCmpt->frequencyHz = stateFrequencyHz; - } - else - { - ojCmpt->frequencyHz = OJ_CMPT_DEFAULT_FREQUENCY_HZ; - } -} - -void ojCmptSetState(OjCmpt ojCmpt, int state) -{ - if(state < 0 || state > OJ_CMPT_MAX_STATE_COUNT) - { - ojCmpt->state = JAUS_UNDEFINED_STATE; - ojCmpt->jaus->state = JAUS_UNDEFINED_STATE; - } - else - { - ojCmpt->state = state; - if(state > JAUS_EMERGENCY_STATE) - { - ojCmpt->jaus->state = JAUS_UNDEFINED_STATE; - } - else - { - ojCmpt->jaus->state = state; - } - } -} - -void ojCmptSetAuthority(OjCmpt ojCmpt, JausByte authority) -{ - ojCmpt->jaus->authority = authority; -} - -JausByte ojCmptGetAuthority(OjCmpt ojCmpt) -{ - return ojCmpt->jaus->authority; -} - -int ojCmptSetStateCallback(OjCmpt ojCmpt, int state, void (*stateCallbackFunction)(OjCmpt)) // Calls method from stateHandler -{ - if(state < 0 || state > OJ_CMPT_MAX_STATE_COUNT) - { - return -1; - } - else - { - ojCmpt->stateCallback[state] = stateCallbackFunction; - return 0; - } -} - -void ojCmptSetMessageCallback(OjCmpt ojCmpt, unsigned short commandCode, void (*messageFunction)(OjCmpt, JausMessage)) // Calls method from messageHandler -{ - int i; - - for(i=0; imessageCallbackCount; i++) - { - if(ojCmpt->messageCallback[i].commandCode == commandCode) - { - ojCmpt->messageCallback[i].function = messageFunction; - return; - } - } - - if(ojCmpt->messageCallback) - { - ojCmpt->messageCallbackCount++; - ojCmpt->messageCallback = (MessageCallback *)realloc(ojCmpt->messageCallback, ojCmpt->messageCallbackCount * sizeof(MessageCallback)); - } - else - { - ojCmpt->messageCallbackCount = 1; - ojCmpt->messageCallback = (MessageCallback *)malloc(sizeof(MessageCallback)); - } - - ojCmpt->messageCallback[ojCmpt->messageCallbackCount - 1].commandCode = commandCode; - ojCmpt->messageCallback[ojCmpt->messageCallbackCount - 1].function = messageFunction; -} - -void ojCmptSetMessageProcessorCallback(OjCmpt ojCmpt, void (*processMessageFunction)(OjCmpt, JausMessage)) // Calls method from messageHandler -{ - ojCmpt->processMessageCallback = processMessageFunction; -} - -void ojCmptSetUserData(OjCmpt ojCmpt, void *data) -{ - ojCmpt->userData = data; -} - -void *ojCmptGetUserData(OjCmpt ojCmpt) -{ - return ojCmpt->userData; -} - -void ojCmptProcessMessage(OjCmpt ojCmpt, JausMessage message) -{ - int i = 0; - - for(i=0; imessageCallbackCount; i++) - { - if(ojCmpt->messageCallback[i].commandCode == message->commandCode && ojCmpt->messageCallback[i].function) - { - ojCmpt->messageCallback[i].function(ojCmpt, message); - i = -1; - break; - } - } - - if(i == ojCmpt->messageCallbackCount) - { - if(ojCmpt->processMessageCallback) - { - ojCmpt->processMessageCallback(ojCmpt, message); - } - else - { - defaultJausMessageProcessorNoDestroy(message, ojCmpt->nmi, ojCmpt->jaus); - } - } - - jausMessageDestroy(message); -} - -double ojCmptGetRateHz(OjCmpt ojCmpt) -{ - return ojCmpt->rateHz; -} - -void* ojCmptThread(void *threadData) -{ - int i = 0; - OjCmpt ojCmpt; - JausMessage rxMessage; - double prevTime = 0; - double time = ojGetTimeSec(); - double nextStateTime = ojGetTimeSec(); - - // Get handle to OpenJausComponent that was created - ojCmpt = (OjCmpt)threadData; - - while(ojCmpt->run) // Execute state machine code while not in the SHUTDOWN state - { - switch(nodeManagerTimedReceive(ojCmpt->nmi, &rxMessage, nextStateTime)) - { - case NMI_MESSAGE_RECEIVED: - // If we were sent a message - if(rxMessage) - { - ojCmptProcessMessage(ojCmpt, rxMessage); - } - - // Always check for messages on incoming SC queues - for(i=0; iinConnection[i] && ojCmpt->inConnection[i]->isActive) // Attempt to process incoming message - { - if(scManagerReceiveServiceConnection(ojCmpt->nmi, ojCmpt->inConnection[i], &rxMessage)) - { - ojCmptProcessMessage(ojCmpt, rxMessage); - } - } - } - break; - - case NMI_RECEIVE_TIMED_OUT: - prevTime = time; - time = ojGetTimeSec(); - ojCmpt->rateHz = 1.0/(time-prevTime); // Compute the update rate of this thread - nextStateTime = time + 1.0/ojCmpt->frequencyHz; - - if(ojCmpt->mainCallback) - { - ojCmpt->mainCallback(ojCmpt); - } - - if(ojCmpt->state != JAUS_UNDEFINED_STATE && ojCmpt->stateCallback[ojCmpt->state]) - { - ojCmpt->stateCallback[ojCmpt->state](ojCmpt); - } - - ojCmptManageServiceConnections(ojCmpt); - nodeManagerSendCoreServiceConnections(ojCmpt->nmi); - break; - - case NMI_CONDITIONAL_WAIT_ERROR: - printf("ojCmpt.c : Conditional Wait Error in nodeManagerTimedReceive, Exiting ojCmpt Thread\n"); - ojCmpt->run = FALSE; - break; - - case NMI_CLOSED_ERROR: - printf("ojCmpt.c : Node Manager Interface closed when calling nodeManagerTimedReceive, Exiting ojCmpt Thread\n"); - ojCmpt->run = FALSE; - break; - - default: - printf("ojCmpt.c : Error in nodeManagerTimedReceive, Exiting ojCmpt Thread\n"); - ojCmpt->run = FALSE; - break; - } - - } - - return NULL; -} - -char* ojCmptGetName(OjCmpt ojCmpt) -{ - char *name; - - name = (char *)malloc(strlen(ojCmpt->jaus->identification)+1); - strcpy(name, ojCmpt->jaus->identification); - - return name; -} - -JausAddress ojCmptGetAddress(OjCmpt ojCmpt) -{ - return jausAddressClone(ojCmpt->jaus->address); -} - -JausAddress ojCmptGetControllerAddress(OjCmpt ojCmpt) -{ - if(ojCmptHasController(ojCmpt)) - { - return jausAddressClone(ojCmpt->jaus->controller.address); - } - else - { - return jausAddressCreate(); - } -} - -JausBoolean ojCmptHasController(OjCmpt ojCmpt) -{ - return ojCmpt->jaus->controller.active; -} - -void ojCmptDefaultMessageProcessor(OjCmpt ojCmpt, JausMessage message) -{ - defaultJausMessageProcessorNoDestroy(message, ojCmpt->nmi, ojCmpt->jaus); -} - -int ojCmptGetState(OjCmpt ojCmpt) -{ - return ojCmpt->state; -} - -int ojCmptSendMessage(OjCmpt ojCmpt, JausMessage message) -{ - jausAddressCopy(message->source, ojCmpt->jaus->address); - return nodeManagerSend(ojCmpt->nmi, message); -} - -JausBoolean ojCmptAddService(OjCmpt ojCmpt, JausUnsignedShort serviceType) -{ - JausService service = jausServiceCreate(serviceType); - if(service) - { - return jausServiceAddService(ojCmpt->jaus->services, service); - } - return JAUS_FALSE; -} - -JausBoolean ojCmptAddServiceInputMessage(OjCmpt ojCmpt, JausUnsignedShort serviceType, JausUnsignedShort commandCode, JausUnsignedInteger presenceVector) -{ - JausService service = jausServiceRetrieveService(ojCmpt->jaus->services, serviceType); - - if(service) - { - return jausServiceAddInputCommand(service, commandCode, presenceVector); - } - return JAUS_FALSE; -} - -JausBoolean ojCmptAddServiceOutputMessage(OjCmpt ojCmpt, JausUnsignedShort serviceType, JausUnsignedShort commandCode, JausUnsignedInteger presenceVector) -{ - JausService service = jausServiceRetrieveService(ojCmpt->jaus->services, serviceType); - - if(service) - { - return jausServiceAddOutputCommand(service, commandCode, presenceVector); - } - return JAUS_FALSE; -} - -void ojCmptAddSupportedSc(OjCmpt ojCmpt, unsigned short commandCode) // Add service connection support for this message -{ - scManagerAddSupportedMessage(ojCmpt->nmi, commandCode); -} - -void ojCmptRemoveSupportedSc(OjCmpt ojCmpt, unsigned short commandCode) // Removes service connection support for this message -{ - scManagerRemoveSupportedMessage(ojCmpt->nmi, commandCode); -} - -ServiceConnection ojCmptGetScSendList(OjCmpt ojCmpt, unsigned short commandCode) -{ - return scManagerGetSendList(ojCmpt->nmi, commandCode); -} - -void ojCmptDestroySendList(ServiceConnection scList) -{ - scManagerDestroySendList(scList); -} - -JausBoolean ojCmptIsOutgoingScActive(OjCmpt ojCmpt, unsigned short commandCode) -{ - return scManagerQueryActiveMessage(ojCmpt->nmi, commandCode); -} - -// Incoming Service Connections -void ojCmptManageServiceConnections(OjCmpt ojCmpt) -{ - int i = 0; - double time = ojGetTimeSec(); - - // Manage Incoming Connections - for(i=0; iinConnection[i] && !ojCmpt->inConnection[i]->isActive && time > ojCmpt->inConnection[i]->nextRequestTimeSec) - { - // set up the service connection - scManagerCreateServiceConnection(ojCmpt->nmi, ojCmpt->inConnection[i]); - ojCmpt->inConnection[i]->nextRequestTimeSec = time + ojCmpt->inConnection[i]->timeoutSec; - } - } -} - -int ojCmptEstablishSc(OjCmpt ojCmpt, JausUnsignedShort cCode, JausUnsignedInteger pv, JausAddress address, double rateHz, double timeoutSec, int qSize) -{ - int i = 0; - - for(i=0; iinConnection[i] == NULL) - { - break; - } - } - - if(i < OJ_CMPT_MAX_INCOMING_SC_COUNT) - { - ojCmpt->inConnection[i] = serviceConnectionCreate(); - ojCmpt->inConnection[i]->requestedUpdateRateHz = rateHz; - // TODO: Locate Command Code service in system based on address - jausAddressCopy(ojCmpt->inConnection[i]->address, address); - ojCmpt->inConnection[i]->presenceVector = pv; - ojCmpt->inConnection[i]->commandCode = cCode; - ojCmpt->inConnection[i]->isActive = JAUS_FALSE; - ojCmpt->inConnection[i]->queueSize = qSize; - ojCmpt->inConnection[i]->timeoutSec = timeoutSec; - ojCmpt->inConnection[i]->nextRequestTimeSec = 0; - return i; - } - - return -1; -} - -int ojCmptTerminateSc(OjCmpt ojCmpt, int scIndex) -{ - if(scIndex < 0 || scIndex >= OJ_CMPT_MAX_INCOMING_SC_COUNT || ojCmpt->inConnection[scIndex] == NULL) - { - return FALSE; - } - - if(ojCmpt->inConnection[scIndex]->isActive) - { - scManagerTerminateServiceConnection(ojCmpt->nmi, ojCmpt->inConnection[scIndex]); - } - serviceConnectionDestroy(ojCmpt->inConnection[scIndex]); - ojCmpt->inConnection[scIndex] = NULL; - - return TRUE; -} - -JausBoolean ojCmptIsIncomingScActive(OjCmpt ojCmpt, int scIndex) -{ - if(scIndex < 0 || scIndex >= OJ_CMPT_MAX_INCOMING_SC_COUNT || ojCmpt->inConnection[scIndex] == NULL) - { - return JAUS_FALSE; - } - - return ojCmpt->inConnection[scIndex]->isActive; -} - -int ojCmptLookupAddress(OjCmpt ojCmpt, JausAddress address) -{ - return nodeManagerLookupAddress(ojCmpt->nmi, address); -} diff --git a/lib/openjaus/libopenJaus/src/nodeManager/CommunicatorComponent.cpp b/lib/openjaus/libopenJaus/src/nodeManager/CommunicatorComponent.cpp deleted file mode 100644 index 1c0e9c881e934dc4b258b69cdecfd0994600723a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/CommunicatorComponent.cpp +++ /dev/null @@ -1,1938 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: CommunicatorComponent.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines a CommunicatorComponent class. -// This is derived from a the LocalComponent class. - -#include "nodeManager/CommunicatorComponent.h" -#include "nodeManager/JausComponentCommunicationManager.h" -#include "nodeManager/events/ErrorEvent.h" -#include "nodeManager/events/DebugEvent.h" -#include "nodeManager/EventHandler.h" -#include "utils/timeLib.h" -#include "jaus.h" - -CommunicatorComponent::CommunicatorComponent(FileLoader *configData, EventHandler *handler, JausComponentCommunicationManager *cmptComms) -{ - int subsystemId, nodeId; - - if(configData == NULL) - { - // OK, don't do this. This is bad. - throw "CommunicatorComponent: Configuration file is NULL\n"; - return; - } - - this->eventHandler = handler; - - if(cmptComms == NULL) - { - // OK, don't do this. This is bad. - throw "CommunicatorComponent: Component Communication Manager is NULL\n"; - return; - } - - this->type = COMPONENT_INTERFACE; - this->commMngr = cmptComms; - this->configData = configData; - this->name = "OpenJAUS Communicator"; - this->cmptRateHz = COMMUNICATOR_RATE_HZ; - this->systemTree = cmptComms->getSystemTree(); - this->nodeManagerSubsystemEventConfirmed = false; - for(int i = 0; i < MAXIMUM_EVENT_ID; i++) - { - eventId[i] = false; - } - - // NOTE: These two values should exist in the properties file and should be checked - // in the NodeManager class prior to constructing this object - subsystemId = configData->GetConfigDataInt("JAUS", "SubsystemId"); - if(subsystemId < JAUS_MINIMUM_SUBSYSTEM_ID || subsystemId > JAUS_MAXIMUM_SUBSYSTEM_ID) - { - // Invalid ID - throw "CommunicatorComponent: Config file [JAUS] SubsystemId is invalid\n"; - return; - } - - nodeId = configData->GetConfigDataInt("JAUS", "NodeId"); - if(nodeId < JAUS_MINIMUM_NODE_ID || nodeId > JAUS_MAXIMUM_NODE_ID) - { - // Invalid ID - throw "CommunicatorComponent: Config file [JAUS] NodeId is invalid\n"; - return; - } - - this->cmpt = jausComponentCreate(); - if(!this->cmpt) - { - throw "CommunicatorComponent: Could not create JausComponent\n"; - return; - } - - this->cmpt->address->subsystem = subsystemId; - this->cmpt->address->node = nodeId; - this->cmpt->address->component = JAUS_COMMUNICATOR; - this->cmpt->address->instance = JAUS_MINIMUM_INSTANCE_ID; - this->setupJausServices(); - - this->cmpt->identification = (char *)calloc(strlen(this->name.c_str()) + 1, sizeof(char)); - strcpy(this->cmpt->identification, this->name.c_str()); -} - -CommunicatorComponent::~CommunicatorComponent(void) -{ - if(running) - { - this->stopThread(); - } - - jausComponentDestroy(this->cmpt); - - HASH_MAP ::iterator iterator; - for(iterator = subsystemChangeList.begin(); iterator != subsystemChangeList.end(); iterator++) - { - jausAddressDestroy( iterator->second); - } -} - -bool CommunicatorComponent::startInterface() -{ - // Set our thread control flag to true - this->running = true; - - // Setup our pThread - this->startThread(); - - if(!systemTree->addComponent(this->cmpt)) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, "Cannot add Communicator component"); - this->eventHandler->handleEvent(e); - return false; - } - - return true; -} - -bool CommunicatorComponent::stopInterface() -{ - // Send our shutdown events - sendSubsystemShutdownEvents(); - - // Set our thread control flag to false - this->running = false; - - // Setup our pThread - this->stopThread(); - - return true; -} - -bool CommunicatorComponent::processMessage(JausMessage message) -{ - if(!message || !message->destination) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage."); - this->eventHandler->handleEvent(e); - return false; - } - - switch(message->commandCode) - { - case JAUS_SET_COMPONENT_AUTHORITY: - case JAUS_SHUTDOWN: - case JAUS_STANDBY: - case JAUS_RESUME: - case JAUS_RESET: - case JAUS_SET_EMERGENCY: - case JAUS_CLEAR_EMERGENCY: - // These messages are ignored! - jausMessageDestroy(message); - return true; - - case JAUS_CREATE_SERVICE_CONNECTION: - return processCreateServiceConnection(message); - - case JAUS_ACTIVATE_SERVICE_CONNECTION: - return processActivateServiceConnection(message); - - case JAUS_SUSPEND_SERVICE_CONNECTION: - return processSuspendServiceConnection(message); - - case JAUS_TERMINATE_SERVICE_CONNECTION: - return processTerminateServiceConnection(message); - - case JAUS_REQUEST_COMPONENT_CONTROL: - return processRequestComponentControl(message); - - case JAUS_QUERY_COMPONENT_AUTHORITY: - return processQueryComponentAuthority(message); - - case JAUS_QUERY_COMPONENT_STATUS: - return processQueryComponentStatus(message); - - case JAUS_QUERY_HEARTBEAT_PULSE: - return processQueryHeartbeatPulse(message); - - case JAUS_REPORT_HEARTBEAT_PULSE: - return processReportHeartbeatPulse(message); - - case JAUS_QUERY_CONFIGURATION: - return processQueryConfiguration(message); - - case JAUS_QUERY_IDENTIFICATION: - return processQueryIdentification(message); - - case JAUS_QUERY_SERVICES: - return processQueryServices(message); - - case JAUS_REPORT_CONFIGURATION: - return processReportConfiguration(message); - - case JAUS_REPORT_IDENTIFICATION: - return processReportIdentification(message); - - case JAUS_REPORT_SERVICES: - return processReportServices(message); - - case JAUS_CANCEL_EVENT: - return processCancelEvent(message); - - case JAUS_CONFIRM_EVENT_REQUEST: - return processConfirmEvent(message); - - case JAUS_CREATE_EVENT: - return processCreateEvent(message); - - case JAUS_EVENT: - return processEvent(message); - - default: - // Unhandled message received by node manager component - jausMessageDestroy(message); - return false; - } -} - -std::string CommunicatorComponent::toString() -{ - return "Communicator Component"; -} - -void CommunicatorComponent::startupState() -{ - // Nothing to do -} - -void CommunicatorComponent::intializeState() -{ - // Switch to Ready State - this->cmpt->state = JAUS_READY_STATE; -} - -void CommunicatorComponent::standbyState() -{ - -} - -void CommunicatorComponent::readyState() -{ - CreateEventMessage createEventMsg = NULL; - QueryConfigurationMessage query = NULL; - JausMessage txMessage = NULL; - static double nextSendTime = 0; - - if(!nodeManagerSubsystemEventConfirmed && ojGetTimeSec() > nextSendTime) - { - // Create query message - query = queryConfigurationMessageCreate(); - if(!query) - { - // Constructor Failed - return; - } - query->queryField = JAUS_SUBSYSTEM_CONFIGURATION; - - createEventMsg = createEventMessageCreate(); - if(!createEventMsg) - { - queryConfigurationMessageDestroy(query); - return; - } - - // Setup Create Event PV - createEventMsg->presenceVector = 0; - jausByteSetBit(&createEventMsg->presenceVector, CREATE_EVENT_PV_QUERY_MESSAGE_BIT); - - createEventMsg->reportMessageCode = jausMessageGetComplimentaryCommandCode(query->commandCode); - createEventMsg->eventType = EVENT_EVERY_CHANGE_TYPE; - createEventMsg->queryMessage = queryConfigurationMessageToJausMessage(query); - if(!createEventMsg->queryMessage) - { - // Problem with queryConfigurationMessageToJausMessage - createEventMessageDestroy(createEventMsg); - queryConfigurationMessageDestroy(query); - return; - } - - txMessage = createEventMessageToJausMessage(createEventMsg); - if(!txMessage) - { - // Problem with createEventMsgMessageToJausMessage - createEventMessageDestroy(createEventMsg); - queryConfigurationMessageDestroy(query); - return; - } - - txMessage->destination->subsystem = this->cmpt->address->subsystem; - txMessage->destination->node = this->cmpt->address->node; - txMessage->destination->component = JAUS_NODE_MANAGER_COMPONENT; - txMessage->destination->instance = 1; - - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - - createEventMessageDestroy(createEventMsg); - queryConfigurationMessageDestroy(query); - - nextSendTime = ojGetTimeSec() + 1.0; - } -} - -void CommunicatorComponent::emergencyState() -{ - -} - -void CommunicatorComponent::failureState() -{ - -} - -void CommunicatorComponent::shutdownState() -{ - -} - -void CommunicatorComponent::allState() -{ - generateHeartbeats(); - // TODO: Check for serviceConnections -} - -bool CommunicatorComponent::processReportIdentification(JausMessage message) -{ - // This function follows the flowchart designed for the Communicator by D. Kent - ReportIdentificationMessage reportId = NULL; - - reportId = reportIdentificationMessageFromJausMessage(message); - if(!reportId) - { - // Error unpacking the reportId msg - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot unpack ReportId message"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - switch(reportId->queryType) - { - case JAUS_QUERY_FIELD_SYSTEM_IDENTITY: - // We don't care about this (actually we never ask for this, so this shouldn't happen) - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return true; - - case JAUS_QUERY_FIELD_SS_IDENTITY: - // Has Subs? - if(!systemTree->hasSubsystem(reportId->source)) - { - // Report ID from unknown Subsystem - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Recieved ReportID from an unknown Subsystem"); - this->eventHandler->handleEvent(e); - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return false; - } - - // Add Identification - systemTree->setSubsystemIdentification(reportId->source, reportId->identification); - - // Query Subs Conf & Setup event - sendQuerySubsystemConfiguration(reportId->source, true); - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return true; - - case JAUS_QUERY_FIELD_NODE_IDENTITY: - // Has Node? - if(!systemTree->hasNode(reportId->source)) - { - // Report ID from unknown Node - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Recieved ReportID from an unknown Node"); - this->eventHandler->handleEvent(e); - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return false; - } - - // Add Identification - systemTree->setNodeIdentification(reportId->source, reportId->identification); - - // Query Subs Conf & Setup event - sendQueryNodeConfiguration(reportId->source, true); - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return true; - - case JAUS_QUERY_FIELD_COMPONENT_IDENTITY: - // Has Cmpt? - if(!systemTree->hasComponent(reportId->source)) - { - // Report ID from unknown Component - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Recieved ReportID from an unknown Component"); - this->eventHandler->handleEvent(e); - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return false; - } - - // Add Identification - systemTree->setComponentIdentification(reportId->source, reportId->identification); - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return true; - - default: - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Recieved ReportID with undefined queryType"); - this->eventHandler->handleEvent(e); - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return true; - } - - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processReportConfiguration(JausMessage message) -{ - // This function follows the flowchart designed for NM 2.0 by D. Kent and T. Galluzzo - ReportConfigurationMessage reportConf = NULL; - - // Check for a reportConf from our own NM - if(message->source->subsystem == this->cmpt->address->subsystem && - message->source->component == JAUS_NODE_MANAGER_COMPONENT) - { - sendSubsystemChangedEvents(); - jausMessageDestroy(message); - return true; - } - - reportConf = reportConfigurationMessageFromJausMessage(message); - if(!reportConf) - { - // Error unpacking the reportConf - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot unpack reportConf"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - // Has Subs? - if(!systemTree->hasSubsystem(reportConf->source)) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Report Configuration from unknown Subsystem"); - this->eventHandler->handleEvent(e); - reportConfigurationMessageDestroy(reportConf); - jausMessageDestroy(message); - return false; - } - - // Test for special case - if(reportConf->subsystem->nodes->elementCount == 0) - { - // Special Case: This is an empty subsystem report, this means that the source subsystem is going offline - systemTree->removeSubsystem(reportConf->source); - reportConfigurationMessageDestroy(reportConf); - jausMessageDestroy(message); - return true; - } - - // Replace Subsystem - systemTree->replaceSubsystem(reportConf->source, reportConf->subsystem); - - JausSubsystem subs = systemTree->getSubsystem(reportConf->source); - for(int i = 0; i < subs->nodes->elementCount; i++) - { - JausNode node = (JausNode) subs->nodes->elementData[i]; - - if(!jausNodeHasIdentification(node)) - { - JausAddress address = jausAddressCreate(); - if(!address) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Report Configuration from unknown Subsystem"); - this->eventHandler->handleEvent(e); - reportConfigurationMessageDestroy(reportConf); - jausMessageDestroy(message); - return false; - } - address->subsystem = reportConf->source->subsystem; - address->node = reportConf->source->node; - address->component = JAUS_NODE_MANAGER; - address->instance = 1; - - sendQueryNodeIdentification(address); - jausAddressDestroy(address); - } - - for(int j = 0; j < node->components->elementCount; j++) - { - JausComponent cmpt = (JausComponent) node->components->elementData[j]; - - if(!jausComponentHasIdentification(cmpt)) - { - sendQueryComponentIdentification(cmpt->address); - } - - if(!jausComponentHasServices(cmpt)) - { - sendQueryComponentServices(cmpt->address); - } - } // End For(Components) - } // End For(Nodes) - - jausSubsystemDestroy(subs); - reportConfigurationMessageDestroy(reportConf); - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processReportServices(JausMessage message) -{ - ReportServicesMessage reportServices = NULL; - - reportServices = reportServicesMessageFromJausMessage(message); - if(!reportServices) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot unpack reportServices"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - if(systemTree->hasComponent(reportServices->source)) - { - systemTree->setComponentServices(reportServices->source, reportServices->jausServices); - } - - reportServicesMessageDestroy(reportServices); - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processReportHeartbeatPulse(JausMessage message) -{ - // This function follows the flowchart designed for NM 2.0 by D. Kent and T. Galluzzo - if(jausAddressEqual(message->source, cmpt->address)) - { - // Should not receive my own heartbeats - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Received Heartbeat message from myself!"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - // Has Subs? - if(!systemTree->hasSubsystem(message->source)) - { - // Add Subs - systemTree->addSubsystem(message->source, NULL); - - // Query SubsId - sendQuerySubsystemIdentification(message->source); - jausMessageDestroy(message); - return true; - } - - // Update Subsystem Timestamp - systemTree->updateSubsystemTimestamp(message->source); - - // Has SubsId? - if(!systemTree->hasSubsystemIdentification(message->source)) - { - // Query SubsId - sendQuerySubsystemIdentification(message->source); - jausMessageDestroy(message); - return true; - } - - // Has SubsConf? - if(!systemTree->hasSubsystemConfiguration(message->source)) - { - sendQuerySubsystemConfiguration(message->source, true); - jausMessageDestroy(message); - return true; - } - - JausSubsystem subs = systemTree->getSubsystem(message->source); - if(!subs) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Could not retrieve Subsystem pointer from System Tree"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - for(int i = 0; i < subs->nodes->elementCount; i++) - { - JausNode node = (JausNode) subs->nodes->elementData[i]; - - if(!jausNodeHasIdentification(node)) - { - JausAddress address = jausAddressCreate(); - if(!address) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create JausAddress memory"); - this->eventHandler->handleEvent(e); - - jausSubsystemDestroy(subs); - jausMessageDestroy(message); - return false; - } - address->subsystem = message->source->subsystem; - address->node = node->id; - address->component = JAUS_NODE_MANAGER; - address->instance = 1; - - sendQueryNodeIdentification(address); - jausAddressDestroy(address); - } - - for(int j = 0; j < node->components->elementCount; j++) - { - JausComponent cmpt = (JausComponent) node->components->elementData[j]; - - if(!jausComponentHasIdentification(cmpt)) - { - sendQueryComponentIdentification(cmpt->address); - } - - if(!jausComponentHasServices(cmpt)) - { - sendQueryComponentServices(cmpt->address); - } - } // end For(Components) - } // end For(Nodes) - - jausSubsystemDestroy(subs); - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processCreateEvent(JausMessage message) -{ - // Only support Configuration Changed events - CreateEventMessage createEvent = NULL; - QueryConfigurationMessage queryConf = NULL; - ConfirmEventRequestMessage confirmEventRequest = NULL; - JausMessage txMessage = NULL; - int nextEventId = -1; - HASH_MAP ::iterator iterator; - - confirmEventRequest = confirmEventRequestMessageCreate(); - if(!confirmEventRequest) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create ConfirmEvent structure"); - this->eventHandler->handleEvent(e); - - jausMessageDestroy(message); - return false; - } - jausAddressCopy(confirmEventRequest->destination, message->source); - jausAddressCopy(confirmEventRequest->source, cmpt->address); - - createEvent = createEventMessageFromJausMessage(message); - if(!createEvent) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Cannot unpack Create Event Message"); - this->eventHandler->handleEvent(e); - - confirmEventRequest->responseCode = INVALID_EVENT_RESPONSE; - txMessage = confirmEventRequestMessageToJausMessage(confirmEventRequest); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - confirmEventRequestMessageDestroy(confirmEventRequest); - jausMessageDestroy(message); - return false; - } - - if(createEvent->reportMessageCode != JAUS_REPORT_CONFIGURATION) - { - // Currently the NM only supports configuration changed events - confirmEventRequest->responseCode = MESSAGE_UNSUPPORTED_RESPONSE; - txMessage = confirmEventRequestMessageToJausMessage(confirmEventRequest); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - char buf[256]; - sprintf(buf, "Rejected event from %d.%d.%d.%d. Unsupported command code (0x%04X)", createEvent->source->subsystem, createEvent->source->node, createEvent->source->component, createEvent->source->instance, createEvent->reportMessageCode); - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - - confirmEventRequestMessageDestroy(confirmEventRequest); - jausMessageDestroy(message); - return false; - } - confirmEventRequest->messageCode = JAUS_REPORT_CONFIGURATION; - - queryConf = queryConfigurationMessageFromJausMessage(createEvent->queryMessage); - if(!queryConf) - { - // ERROR: Cannot unpack query message - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Cannot unpack Query Configuration Message"); - this->eventHandler->handleEvent(e); - - confirmEventRequest->responseCode = INVALID_EVENT_RESPONSE; - txMessage = confirmEventRequestMessageToJausMessage(confirmEventRequest); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - confirmEventRequestMessageDestroy(confirmEventRequest); - jausMessageDestroy(message); - return false; - } - - if(queryConf->queryField == JAUS_SUBSYSTEM_CONFIGURATION) - { - for(iterator = subsystemChangeList.begin(); iterator != subsystemChangeList.end(); iterator++) - { - if(jausAddressEqual(createEvent->source, iterator->second)) - { - // Event already created - confirmEventRequest->responseCode = SUCCESSFUL_RESPONSE; - confirmEventRequest->eventId = iterator->first; - break; - } - } - - nextEventId = getNextEventId(); - if(nextEventId >= 0) - { - confirmEventRequest->eventId = (JausByte) nextEventId; - eventId[nextEventId] = true; - subsystemChangeList[nextEventId] = jausAddressClone(createEvent->source); - confirmEventRequest->responseCode = SUCCESSFUL_RESPONSE; - - char buf[256]; - sprintf(buf, "Added Subsystem Configuration event for %d.%d.%d.%d.", createEvent->source->subsystem, createEvent->source->node, createEvent->source->component, createEvent->source->instance); - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - else - { - confirmEventRequest->responseCode = CONNECTION_REFUSED_RESPONSE; - confirmEventRequest->eventId = 0; - - char buf[256]; - sprintf(buf, "Rejected event from %d.%d.%d.%d. No available Event Ids.", createEvent->source->subsystem, createEvent->source->node, createEvent->source->component, createEvent->source->instance); // NMJ - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - } - else - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Create Event: Invalid Query Type"); - this->eventHandler->handleEvent(e); - - // Invalid Query Type - confirmEventRequest->responseCode = INVALID_EVENT_RESPONSE; - txMessage = confirmEventRequestMessageToJausMessage(confirmEventRequest); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - confirmEventRequestMessageDestroy(confirmEventRequest); - jausMessageDestroy(message); - return false; - } - - // Send response - txMessage = confirmEventRequestMessageToJausMessage(confirmEventRequest); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - queryConfigurationMessageDestroy(queryConf); - createEventMessageDestroy(createEvent); - confirmEventRequestMessageDestroy(confirmEventRequest); - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processCancelEvent(JausMessage message) -{ - CancelEventMessage cancelEvent = NULL; - - cancelEvent = cancelEventMessageFromJausMessage(message); - if(!cancelEvent) - { - // Error unpacking message - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Cannot unpack Cancel Event Message"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - if(cancelEvent->messageCode == JAUS_QUERY_CONFIGURATION) - { - if(eventId[cancelEvent->eventId]) - { - eventId[cancelEvent->eventId] = false; - - if(subsystemChangeList.find(cancelEvent->eventId) != subsystemChangeList.end()) - { - // Remove that element - subsystemChangeList.erase(subsystemChangeList.find(cancelEvent->eventId)); - } - else if(nodeChangeList.find(cancelEvent->eventId) != nodeChangeList.end()) - { - // Remove that element - nodeChangeList.erase(nodeChangeList.find(cancelEvent->eventId)); - } - } - } - - cancelEventMessageDestroy(cancelEvent); - jausMessageDestroy(message); - return true; -} - -void CommunicatorComponent::sendSubsystemChangedEvents() -{ - ReportConfigurationMessage reportConf = NULL; - JausMessage txMessage = NULL; - EventMessage eventMessage = NULL; - HASH_MAP ::iterator iterator; - - JausSubsystem thisSubs = systemTree->getSubsystem(this->cmpt->address); - if(!thisSubs) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot get my subsystem from System Tree"); - this->eventHandler->handleEvent(e); - return; - } - - reportConf = reportConfigurationMessageCreate(); - if(!reportConf) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create reportConf"); - this->eventHandler->handleEvent(e); - - jausSubsystemDestroy(thisSubs); - return; - } - jausSubsystemDestroy(reportConf->subsystem); - reportConf->subsystem = thisSubs; - - eventMessage = eventMessageCreate(); - if(!eventMessage) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create eventMessage"); - this->eventHandler->handleEvent(e); - reportConfigurationMessageDestroy(reportConf); - return; - } - - eventMessage->reportMessage = reportConfigurationMessageToJausMessage(reportConf); - if(!eventMessage->reportMessage) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Cannot pack reportConf"); - this->eventHandler->handleEvent(e); - - reportConfigurationMessageDestroy(reportConf); - eventMessageDestroy(eventMessage); - return; - } - jausAddressCopy(eventMessage->source, cmpt->address); - - // TODO: check subsystemChangeList for dead addresses - for(iterator = subsystemChangeList.begin(); iterator != subsystemChangeList.end(); iterator++) - { - eventMessage->eventId = iterator->first; - jausAddressCopy(eventMessage->destination, iterator->second); - txMessage = eventMessageToJausMessage(eventMessage); - this->commMngr->receiveJausMessage(jausMessageClone(txMessage), this); - - char buf[256]; - sprintf(buf, "Send Subs Changed event to %d.%d.%d.%d.", txMessage->destination->subsystem, txMessage->destination->node, txMessage->destination->component, txMessage->destination->instance); - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - - eventMessageDestroy(eventMessage); - jausMessageDestroy(txMessage); - reportConfigurationMessageDestroy(reportConf); -} - -void CommunicatorComponent::sendSubsystemShutdownEvents() -{ - ReportConfigurationMessage reportConf = NULL; - JausMessage txMessage = NULL; - EventMessage eventMessage = NULL; - HASH_MAP ::iterator iterator; - - reportConf = reportConfigurationMessageCreate(); - if(!reportConf) - { - // TODO: Record an error. Throw Exception - return; - } - - // Empty Subsystem for message - JausSubsystem emptySubs = jausSubsystemCreate(); - if(!emptySubs) - { - // TODO: Record an error. Throw Exception - reportConfigurationMessageDestroy(reportConf); - return; - } - emptySubs->id = this->cmpt->address->subsystem; - - jausSubsystemDestroy(reportConf->subsystem); - reportConf->subsystem = emptySubs; - eventMessage = eventMessageCreate(); - if(!eventMessage) - { - // TODO: Record an error. Throw Exception - reportConfigurationMessageDestroy(reportConf); - return; - } - - eventMessage->reportMessage = reportConfigurationMessageToJausMessage(reportConf); - if(!eventMessage->reportMessage) - { - // TODO: Record an error. Throw Exception - reportConfigurationMessageDestroy(reportConf); - eventMessageDestroy(eventMessage); - return; - } - jausAddressCopy(eventMessage->source, cmpt->address); - - // TODO: check subsystemChangeList for dead addresses - for(iterator = subsystemChangeList.begin(); iterator != subsystemChangeList.end(); iterator++) - { - eventMessage->eventId = iterator->first; - jausAddressCopy(eventMessage->destination, iterator->second); - txMessage = eventMessageToJausMessage(eventMessage); - this->commMngr->receiveJausMessage(jausMessageClone(txMessage), this); - - char buf[256]; - sprintf(buf, "Send Subs Shutdown event to %d.%d.%d.%d.", txMessage->destination->subsystem, txMessage->destination->node, txMessage->destination->component, txMessage->destination->instance); - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - - eventMessageDestroy(eventMessage); - jausMessageDestroy(txMessage); - reportConfigurationMessageDestroy(reportConf); -} - -void CommunicatorComponent::generateHeartbeats() -{ - static double nextSendTime = ojGetTimeSec(); - ReportHeartbeatPulseMessage heartbeat; - JausMessage subsHeartbeat; - - if(ojGetTimeSec() >= nextSendTime) - { - heartbeat = reportHeartbeatPulseMessageCreate(); - if(!heartbeat) - { - // Error constructing message - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create heartbeat structure"); - this->eventHandler->handleEvent(e); - - return; - } - jausAddressCopy(heartbeat->source, cmpt->address); - - subsHeartbeat = reportHeartbeatPulseMessageToJausMessage(heartbeat); - if(!subsHeartbeat) - { - // Error constructing message - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Cannot pack Report Heartbeat Message"); - this->eventHandler->handleEvent(e); - - reportHeartbeatPulseMessageDestroy(heartbeat); - return; - } - - // Send Heartbeat to other node managers on this subsystem - subsHeartbeat->destination->subsystem = JAUS_BROADCAST_SUBSYSTEM_ID; - subsHeartbeat->destination->node = JAUS_BROADCAST_NODE_ID; - subsHeartbeat->destination->component = JAUS_NODE_MANAGER_COMPONENT; - subsHeartbeat->destination->instance = 1; - this->commMngr->receiveJausMessage(subsHeartbeat, this); - - nextSendTime = ojGetTimeSec() + 1.0; - reportHeartbeatPulseMessageDestroy(heartbeat); - } -} - -bool CommunicatorComponent::sendQueryNodeIdentification(JausAddress address) -{ - QueryIdentificationMessage queryId = NULL; - JausMessage txMessage = NULL; - - // TODO: Check timeout and request limit - if( systemTree->hasNode(address) && - !systemTree->hasNodeIdentification(address)) - { - // Create query message - queryId = queryIdentificationMessageCreate(); - if(!queryId) - { - // Constructor Failed - return false; - } - - queryId->queryField = JAUS_QUERY_FIELD_NODE_IDENTITY; - txMessage = queryIdentificationMessageToJausMessage(queryId); - if(!txMessage) - { - // ToJausMessage Failed - queryIdentificationMessageDestroy(queryId); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - queryIdentificationMessageDestroy(queryId); - return true; - } - return false; -} - -bool CommunicatorComponent::sendQuerySubsystemIdentification(JausAddress address) -{ - QueryIdentificationMessage queryId = NULL; - JausMessage txMessage = NULL; - - // TODO: Check timeout and request limit - if( systemTree->hasSubsystem(address) && - !systemTree->hasSubsystemIdentification(address)) - { - // Create query message - queryId = queryIdentificationMessageCreate(); - if(!queryId) - { - // Constructor Failed - return false; - } - - queryId->queryField = JAUS_QUERY_FIELD_SS_IDENTITY; - txMessage = queryIdentificationMessageToJausMessage(queryId); - if(!txMessage) - { - // ToJausMessage Failed - queryIdentificationMessageDestroy(queryId); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - queryIdentificationMessageDestroy(queryId); - return true; - } - return false; -} - -bool CommunicatorComponent::sendQueryComponentIdentification(JausAddress address) -{ - QueryIdentificationMessage queryId = NULL; - JausMessage txMessage = NULL; - - // TODO: Check timeout and request limit - if(systemTree->hasComponent(address) && - !systemTree->hasComponentIdentification(address)) - { - // Create query message - queryId = queryIdentificationMessageCreate(); - if(!queryId) - { - // Constructor Failed - return false; - } - - queryId->queryField = JAUS_QUERY_FIELD_COMPONENT_IDENTITY; - txMessage = queryIdentificationMessageToJausMessage(queryId); - if(!txMessage) - { - // ToJausMessage Failed - queryIdentificationMessageDestroy(queryId); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - queryIdentificationMessageDestroy(queryId); - return true; - } - return false; -} - -bool CommunicatorComponent::processCreateServiceConnection(JausMessage message) -{ - // Not implemented right now - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processActivateServiceConnection(JausMessage message) -{ - // Not Implemented right now - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processSuspendServiceConnection(JausMessage message) -{ - // Not Implemented right now - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processTerminateServiceConnection(JausMessage message) -{ - // Not Implemented right now - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processRequestComponentControl(JausMessage message) -{ - RequestComponentControlMessage requestComponentControl = NULL; - RejectComponentControlMessage rejectComponentControl = NULL; - ConfirmComponentControlMessage confirmComponentControl = NULL; - JausMessage txMessage = NULL; - - requestComponentControl = requestComponentControlMessageFromJausMessage(message); - if(!requestComponentControl) - { - // Error unpacking message - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Cannot unpack Request Comp. Control Message"); - this->eventHandler->handleEvent(e); - - jausMessageDestroy(message); - return false; - } - - if(cmpt->controller.active) - { - if(requestComponentControl->authorityCode > cmpt->controller.authority) // Test for higher authority - { - // Terminate control of current component - rejectComponentControl = rejectComponentControlMessageCreate(); - jausAddressCopy(rejectComponentControl->source, cmpt->address); - jausAddressCopy(rejectComponentControl->destination, cmpt->controller.address); - txMessage = rejectComponentControlMessageToJausMessage(rejectComponentControl); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - // Accept control of new component - confirmComponentControl = confirmComponentControlMessageCreate(); - jausAddressCopy(confirmComponentControl->source, cmpt->address); - jausAddressCopy(confirmComponentControl->destination, message->source); - confirmComponentControl->responseCode = JAUS_CONTROL_ACCEPTED; - txMessage = confirmComponentControlMessageToJausMessage(confirmComponentControl); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - // Update cmpt controller information - jausAddressCopy(cmpt->controller.address, message->source); - cmpt->controller.authority = requestComponentControl->authorityCode; - - rejectComponentControlMessageDestroy(rejectComponentControl); - confirmComponentControlMessageDestroy(confirmComponentControl); - } - else - { - if(!jausAddressEqual(message->source, cmpt->controller.address)) - { - rejectComponentControl = rejectComponentControlMessageCreate(); - jausAddressCopy(rejectComponentControl->source, cmpt->address); - jausAddressCopy(rejectComponentControl->destination, message->source); - txMessage = rejectComponentControlMessageToJausMessage(rejectComponentControl); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - rejectComponentControlMessageDestroy(rejectComponentControl); - } - else - { - // Reaccept control of new component - confirmComponentControl = confirmComponentControlMessageCreate(); - jausAddressCopy(confirmComponentControl->source, cmpt->address); - jausAddressCopy(confirmComponentControl->destination, message->source); - confirmComponentControl->responseCode = JAUS_CONTROL_ACCEPTED; - txMessage = confirmComponentControlMessageToJausMessage(confirmComponentControl); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - confirmComponentControlMessageDestroy(confirmComponentControl); - } - } - } - else // Not currently under component control, so give control - { - confirmComponentControl = confirmComponentControlMessageCreate(); - jausAddressCopy(confirmComponentControl->source, cmpt->address); - jausAddressCopy(confirmComponentControl->destination, message->source); - confirmComponentControl->responseCode = JAUS_CONTROL_ACCEPTED; - txMessage = confirmComponentControlMessageToJausMessage(confirmComponentControl); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - jausAddressCopy(cmpt->controller.address, message->source); - cmpt->controller.authority = requestComponentControl->authorityCode; - cmpt->controller.active = JAUS_TRUE; - - confirmComponentControlMessageDestroy(confirmComponentControl); - } - - requestComponentControlMessageDestroy(requestComponentControl); - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processQueryComponentAuthority(JausMessage message) -{ - ReportComponentAuthorityMessage report = NULL; - JausMessage txMessage = NULL; - - report = reportComponentAuthorityMessageCreate(); - if(!report) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create Report Comp. Authority Message"); - this->eventHandler->handleEvent(e); - - jausMessageDestroy(message); - return false; - } - - jausAddressCopy(report->source, cmpt->address); - jausAddressCopy(report->destination, message->source); - report->authorityCode = cmpt->authority; - - txMessage = reportComponentAuthorityMessageToJausMessage(report); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportComponentAuthorityMessageDestroy(report); - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processQueryComponentStatus(JausMessage message) -{ - ReportComponentStatusMessage reportComponentStatus = NULL; - JausMessage txMessage = NULL; - - reportComponentStatus = reportComponentStatusMessageCreate(); - jausAddressCopy(reportComponentStatus->source, cmpt->address); - jausAddressCopy(reportComponentStatus->destination, message->source); - reportComponentStatus->primaryStatusCode = cmpt->state; - - txMessage = reportComponentStatusMessageToJausMessage(reportComponentStatus); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportComponentStatusMessageDestroy(reportComponentStatus); - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processQueryHeartbeatPulse(JausMessage message) -{ - - JausMessage txMessage = NULL; - ReportHeartbeatPulseMessage reportHeartbeat = NULL; - - reportHeartbeat = reportHeartbeatPulseMessageCreate(); - if(!reportHeartbeat) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create Report Heartbeat Pulse Message"); - this->eventHandler->handleEvent(e); - - jausMessageDestroy(message); - return false; - } - - jausAddressCopy(reportHeartbeat->source, cmpt->address); - jausAddressCopy(reportHeartbeat->destination, message->source); - txMessage = reportHeartbeatPulseMessageToJausMessage(reportHeartbeat); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processQueryConfiguration(JausMessage message) -{ - QueryConfigurationMessage queryConf = NULL; - ReportConfigurationMessage reportConf = NULL; - JausMessage txMessage = NULL; - JausNode node = NULL; - - queryConf = queryConfigurationMessageFromJausMessage(message); - if(!queryConf) - { - // Error unpacking message - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Cannot unpack Query Configuration Message"); - this->eventHandler->handleEvent(e); - - jausMessageDestroy(message); - return false; - } - - switch(queryConf->queryField) - { - case JAUS_SUBSYSTEM_CONFIGURATION: - // Subsystem Configuration requests should go to the Communicator! - // This is included for backwards compatibility and other implementation support - reportConf = reportConfigurationMessageCreate(); - if(!reportConf) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create Report Configuration Message"); - this->eventHandler->handleEvent(e); - - queryConfigurationMessageDestroy(queryConf); - jausMessageDestroy(message); - return false; - } - - // Remove the subsystem created by the constructor - jausSubsystemDestroy(reportConf->subsystem); - - // This call to the systemTree returns a copy, so safe to set this pointer to it - reportConf->subsystem = systemTree->getSubsystem(this->cmpt->address->subsystem); - if(reportConf->subsystem) - { - txMessage = reportConfigurationMessageToJausMessage(reportConf); - jausAddressCopy(txMessage->source, cmpt->address); - jausAddressCopy(txMessage->destination, queryConf->source); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - } - - reportConfigurationMessageDestroy(reportConf); - queryConfigurationMessageDestroy(queryConf); - jausMessageDestroy(message); - return true; - - case JAUS_NODE_CONFIGURATION: - // Node Configuration requests should go to the Node Manager! - // This is included for backwards compatibility and other implementation support - reportConf = reportConfigurationMessageCreate(); - if(!reportConf) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create Report Configuration Message"); - this->eventHandler->handleEvent(e); - - queryConfigurationMessageDestroy(queryConf); - jausMessageDestroy(message); - return false; - } - - // This call to the systemTree returns a copy, so safe to set this pointer to it - node = systemTree->getNode(this->cmpt->address->subsystem, this->cmpt->address->node); - if(node) - { - jausArrayAdd(reportConf->subsystem->nodes, node); - } - - txMessage = reportConfigurationMessageToJausMessage(reportConf); - jausAddressCopy(txMessage->source, cmpt->address); - jausAddressCopy(txMessage->destination, queryConf->source); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportConfigurationMessageDestroy(reportConf); - queryConfigurationMessageDestroy(queryConf); - jausMessageDestroy(message); - return true; - - default: - // Unknown query type - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Invalid queryField in Query Configuration Message"); - this->eventHandler->handleEvent(e); - - queryConfigurationMessageDestroy(queryConf); - jausMessageDestroy(message); - return false; - } -} - -bool CommunicatorComponent::processQueryIdentification(JausMessage message) -{ - QueryIdentificationMessage queryId = NULL; - ReportIdentificationMessage reportId = NULL; - JausMessage txMessage = NULL; - char *identification = NULL; - - queryId = queryIdentificationMessageFromJausMessage(message); - if(!queryId) - { - // Error unpacking message - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Cannot unpack Query Identification Message"); - this->eventHandler->handleEvent(e); - - jausMessageDestroy(message); - return false; - } - - switch(queryId->queryField) - { - case JAUS_QUERY_FIELD_SS_IDENTITY: - reportId = reportIdentificationMessageCreate(); - if(!reportId) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create Report Identification Message"); - this->eventHandler->handleEvent(e); - - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return false; - } - - identification = systemTree->getSubsystemIdentification(cmpt->address); - if(strlen(identification) < JAUS_IDENTIFICATION_LENGTH_BYTES) - { - sprintf(reportId->identification, "%s", identification); - } - else - { - memcpy(reportId->identification, identification, JAUS_IDENTIFICATION_LENGTH_BYTES-1); - reportId->identification[JAUS_IDENTIFICATION_LENGTH_BYTES-1] = 0; - } - free(identification); - - reportId->queryType = JAUS_QUERY_FIELD_SS_IDENTITY; - txMessage = reportIdentificationMessageToJausMessage(reportId); - jausAddressCopy(txMessage->source, cmpt->address); - jausAddressCopy(txMessage->destination, queryId->source); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportIdentificationMessageDestroy(reportId); - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return true; - - case JAUS_QUERY_FIELD_NODE_IDENTITY: - // Node Identification requests should go to the NM! - // This is included for backwards compatibility and other implementation support - reportId = reportIdentificationMessageCreate(); - if(!reportId) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create Report Identification Message"); - this->eventHandler->handleEvent(e); - - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return false; - } - - identification = systemTree->getNodeIdentification(cmpt->address); - if(strlen(identification) < JAUS_IDENTIFICATION_LENGTH_BYTES) - { - sprintf(reportId->identification, "%s", identification); - } - else - { - memcpy(reportId->identification, identification, JAUS_IDENTIFICATION_LENGTH_BYTES-1); - reportId->identification[JAUS_IDENTIFICATION_LENGTH_BYTES-1] = 0; - } - - reportId->queryType = JAUS_QUERY_FIELD_NODE_IDENTITY; - txMessage = reportIdentificationMessageToJausMessage(reportId); - jausAddressCopy(txMessage->source, cmpt->address); - jausAddressCopy(txMessage->destination, queryId->source); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportIdentificationMessageDestroy(reportId); - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return true; - - case JAUS_QUERY_FIELD_COMPONENT_IDENTITY: - reportId = reportIdentificationMessageCreate(); - if(!reportId) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create Report Identification Message"); - this->eventHandler->handleEvent(e); - - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return false; - } - - identification = cmpt->identification; - if(strlen(identification) < JAUS_IDENTIFICATION_LENGTH_BYTES) - { - sprintf(reportId->identification, "%s", identification); - } - else - { - memcpy(reportId->identification, identification, JAUS_IDENTIFICATION_LENGTH_BYTES-1); - reportId->identification[JAUS_IDENTIFICATION_LENGTH_BYTES-1] = 0; - } - - reportId->queryType = JAUS_QUERY_FIELD_COMPONENT_IDENTITY; - txMessage = reportIdentificationMessageToJausMessage(reportId); - jausAddressCopy(txMessage->source, cmpt->address); - jausAddressCopy(txMessage->destination, queryId->source); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportIdentificationMessageDestroy(reportId); - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return true; - - default: - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Unknown queryField in Query Identification Message"); - this->eventHandler->handleEvent(e); - - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return false; - } -} - -bool CommunicatorComponent::processQueryServices(JausMessage message) -{ - QueryServicesMessage queryServices = NULL; - ReportServicesMessage reportServices = NULL; - JausMessage txMessage = NULL; - - queryServices = queryServicesMessageFromJausMessage(message); - if(!queryServices) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Cannot unpack Query Services Message"); - this->eventHandler->handleEvent(e); - - jausMessageDestroy(message); - return false; - } - - // Respond with our services - reportServices = reportServicesMessageCreate(); - if(!reportServices) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create Report Services Message"); - this->eventHandler->handleEvent(e); - - queryServicesMessageDestroy(queryServices); - jausMessageDestroy(message); - return false; - } - - jausAddressCopy(reportServices->destination, message->source); - jausAddressCopy(reportServices->source, cmpt->address); - jausServicesDestroy(reportServices->jausServices); - reportServices->jausServices = jausServicesClone(cmpt->services); - - txMessage = reportServicesMessageToJausMessage(reportServices); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportServicesMessageDestroy(reportServices); - queryServicesMessageDestroy(queryServices); - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processConfirmEvent(JausMessage message) -{ - ConfirmEventRequestMessage confirm = NULL; - - confirm = confirmEventRequestMessageFromJausMessage(message); - if(!confirm) - { - jausMessageDestroy(message); - return false; - } - - if( confirm->source->node == this->cmpt->address->node && - confirm->source->component == JAUS_NODE_MANAGER_COMPONENT && - confirm->messageCode == JAUS_REPORT_CONFIGURATION && - confirm->responseCode == SUCCESSFUL_RESPONSE) - { - this->nodeManagerSubsystemEventConfirmed = true; - } - - confirmEventRequestMessageDestroy(confirm); - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::processEvent(JausMessage message) -{ - EventMessage eventMessage; - - eventMessage = eventMessageFromJausMessage(message); - if(!eventMessage) - { - // Error unpacking the eventMessage - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot unpack EventMessage!"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - processMessage(jausMessageClone(eventMessage->reportMessage)); - eventMessageDestroy(eventMessage); - jausMessageDestroy(message); - return true; -} - -bool CommunicatorComponent::sendQueryComponentServices(JausAddress address) -{ - QueryServicesMessage query = NULL; - JausMessage txMessage = NULL; - - // TODO: Check timeout and request limit - if( systemTree->hasComponent(address) && - !systemTree->hasComponentServices(address)) - { - // Create query message - query = queryServicesMessageCreate(); - if(!query) - { - // Constructor Failed - return false; - } - - txMessage = queryServicesMessageToJausMessage(query); - if(!txMessage) - { - // ToJausMessage Failed - queryServicesMessageDestroy(query); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - queryServicesMessageDestroy(query); - return true; - } - - return false; -} -bool CommunicatorComponent::sendQueryNodeConfiguration(JausAddress address, bool createEvent) -{ - QueryConfigurationMessage query = NULL; - JausMessage txMessage = NULL; - CreateEventMessage createEventMsg = NULL; - - // TODO: Check timeout and request limit - if( systemTree->hasNode(address) && - !systemTree->hasNodeConfiguration(address)) - { - // Create query message - query = queryConfigurationMessageCreate(); - if(!query) - { - // Constructor Failed - return false; - } - query->queryField = JAUS_NODE_CONFIGURATION; - - txMessage = queryConfigurationMessageToJausMessage(query); - if(!txMessage) - { - // ToJausMessage Failed - queryConfigurationMessageDestroy(query); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - - if(createEvent) - { - createEventMsg = createEventMessageCreate(); - if(!createEventMsg) - { - queryConfigurationMessageDestroy(query); - return false; - } - - // Setup Create Event PV - createEventMsg->presenceVector = 0; - jausByteSetBit(&createEventMsg->presenceVector, CREATE_EVENT_PV_QUERY_MESSAGE_BIT); - - createEventMsg->reportMessageCode = jausMessageGetComplimentaryCommandCode(query->commandCode); - createEventMsg->eventType = EVENT_EVERY_CHANGE_TYPE; - createEventMsg->queryMessage = queryConfigurationMessageToJausMessage(query); - if(!createEventMsg->queryMessage) - { - // Problem with queryConfigurationMessageToJausMessage - createEventMessageDestroy(createEventMsg); - queryConfigurationMessageDestroy(query); - return false; - } - - txMessage = createEventMessageToJausMessage(createEventMsg); - if(!txMessage) - { - // Problem with createEventMsgMessageToJausMessage - createEventMessageDestroy(createEventMsg); - queryConfigurationMessageDestroy(query); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - } - - queryConfigurationMessageDestroy(query); - return true; - } - return false; -} - -bool CommunicatorComponent::sendQuerySubsystemConfiguration(JausAddress address, bool createEvent) -{ - QueryConfigurationMessage query = NULL; - JausMessage txMessage = NULL; - CreateEventMessage createEventMsg = NULL; - - // TODO: Check timeout and request limit - if( systemTree->hasSubsystem(address) && - !systemTree->hasSubsystemConfiguration(address)) - { - // Create query message - query = queryConfigurationMessageCreate(); - if(!query) - { - // Constructor Failed - return false; - } - query->queryField = JAUS_SUBSYSTEM_CONFIGURATION; - - txMessage = queryConfigurationMessageToJausMessage(query); - if(!txMessage) - { - // ToJausMessage Failed - queryConfigurationMessageDestroy(query); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - jausMessageDestroy(txMessage); // Send Query Node Configuration - - if(createEvent) - { - createEventMsg = createEventMessageCreate(); - if(!createEventMsg) - { - queryConfigurationMessageDestroy(query); - return false; - } - - // Setup Create Event PV - createEventMsg->presenceVector = 0; - jausByteSetBit(&createEventMsg->presenceVector, CREATE_EVENT_PV_QUERY_MESSAGE_BIT); - - createEventMsg->reportMessageCode = jausMessageGetComplimentaryCommandCode(query->commandCode); - createEventMsg->eventType = EVENT_EVERY_CHANGE_TYPE; - createEventMsg->queryMessage = queryConfigurationMessageToJausMessage(query); - if(!createEventMsg->queryMessage) - { - // Problem with queryConfigurationMessageToJausMessage - createEventMessageDestroy(createEventMsg); - queryConfigurationMessageDestroy(query); - return false; - } - - txMessage = createEventMessageToJausMessage(createEventMsg); - if(!txMessage) - { - // Problem with createEventMsgMessageToJausMessage - createEventMessageDestroy(createEventMsg); - queryConfigurationMessageDestroy(query); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - } - - queryConfigurationMessageDestroy(query); - return true; - } - return false; -} - -int CommunicatorComponent::getNextEventId() -{ - int i; - for(i = 0; i < MAXIMUM_EVENT_ID; i++) - { - if(eventId[i] == false) - { - return i; - } - } - return -1; -} - -bool CommunicatorComponent::setupJausServices() -{ - JausService service; - service = jausServiceCreate(0); - if(!service) return false; - jausServiceAddInputCommand(service, JAUS_SET_COMPONENT_AUTHORITY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_SHUTDOWN, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_STANDBY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_RESUME, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_RESET, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_SET_EMERGENCY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CLEAR_EMERGENCY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CREATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_ACTIVATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_SUSPEND_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_TERMINATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_REQUEST_COMPONENT_CONTROL, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_QUERY_COMPONENT_AUTHORITY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_QUERY_COMPONENT_STATUS, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_QUERY_HEARTBEAT_PULSE, NO_PRESENCE_VECTOR); - - jausServiceAddOutputCommand(service, JAUS_CREATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_CONFIRM_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_TERMINATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_CONFIRM_COMPONENT_CONTROL, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REJECT_COMPONENT_CONTROL, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_COMPONENT_AUTHORITY, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_COMPONENT_STATUS, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_HEARTBEAT_PULSE, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_QUERY_COMPONENT_STATUS, NO_PRESENCE_VECTOR); - - // Add Core Service - jausServiceAddService(cmpt->services, service); - - service = jausServiceCreate(JAUS_COMMUNICATOR); - if(!service) return false; - jausServiceAddInputCommand(service, JAUS_QUERY_CONFIGURATION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_QUERY_IDENTIFICATION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_QUERY_SERVICES, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_REPORT_CONFIGURATION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_REPORT_IDENTIFICATION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_REPORT_SERVICES, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CANCEL_EVENT, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CONFIRM_EVENT_REQUEST, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CREATE_EVENT, NO_PRESENCE_VECTOR); - - jausServiceAddOutputCommand(service, JAUS_QUERY_CONFIGURATION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_QUERY_IDENTIFICATION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_QUERY_SERVICES, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_CONFIGURATION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_IDENTIFICATION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_SERVICES, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_CANCEL_EVENT, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_CONFIRM_EVENT_REQUEST, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_CREATE_EVENT, NO_PRESENCE_VECTOR); - - // Add Communicator Manager Service - jausServiceAddService(cmpt->services, service); - - return true; -} - - diff --git a/lib/openjaus/libopenJaus/src/nodeManager/JausCommunicationManager.cpp b/lib/openjaus/libopenJaus/src/nodeManager/JausCommunicationManager.cpp deleted file mode 100644 index cfeb70c102bc31c8a7b887b403f0895bb731f42b..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/JausCommunicationManager.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausCommunicationManager.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines a JausCommunicationManager interface. -// This class is a virtual class which supports the common fuctionality of -// comminication managers. - -#include "nodeManager/JausCommunicationManager.h" -#include "nodeManager/JausTransportInterface.h" - -JausCommunicationManager::JausCommunicationManager(void) {} - -JausCommunicationManager::~JausCommunicationManager(void) {} - -unsigned long JausCommunicationManager::getInterfaceCount(void) -{ - return (unsigned long) this->interfaces.size(); -} - -JausTransportInterface *JausCommunicationManager::getJausInterface(unsigned long index) -{ - if(index < this->interfaces.size()) - { - return this->interfaces.at(index); - } - else - { - return NULL; - } -} - -JausTransportInterface *JausCommunicationManager::getJausInterface(std::string interfaceName) -{ - for(unsigned long i = 0; i < this->interfaces.size(); i++) - { - if(this->interfaces.at(i)->getName() == interfaceName) - { - return this->interfaces.at(i); - } - } - return NULL; -} - -bool JausCommunicationManager::interfaceExists(std::string interfaceName) -{ - for(unsigned long i = 0; i < this->interfaces.size(); i++) - { - if(this->interfaces.at(i)->getName() == interfaceName) - { - return true; - } - } - return false; -} - -void JausCommunicationManager::enable(void) -{ - enabled = true; -} - -void JausCommunicationManager::disable(void) -{ - enabled = false; -} - -bool JausCommunicationManager::isEnabled(void) -{ - return enabled; -} - -SystemTree *JausCommunicationManager::getSystemTree() -{ - return this->systemTree; -} - -MessageRouter *JausCommunicationManager::getMessageRouter() -{ - return this->msgRouter; -} - - diff --git a/lib/openjaus/libopenJaus/src/nodeManager/JausComponentCommunicationManager.cpp b/lib/openjaus/libopenJaus/src/nodeManager/JausComponentCommunicationManager.cpp deleted file mode 100644 index 81c2ca8a2e3dbb3cfa7ef56f1167b3b3a28d429d..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/JausComponentCommunicationManager.cpp +++ /dev/null @@ -1,388 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausComponentCommunicationManager.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines a JausComponentCommunicationManager.cpp class. -// This is derived from a the JausCommunicationManager class and supports -// different component interfaces. - -#include "nodeManager/JausComponentCommunicationManager.h" -#include "nodeManager/NodeManagerComponent.h" -#include "nodeManager/CommunicatorComponent.h" -#include "nodeManager/JausOpcUdpInterface.h" -#include "nodeManager/JudpInterface.h" -#include "nodeManager/OjUdpComponentInterface.h" -#include "nodeManager/events/ErrorEvent.h" -#include "nodeManager/events/ConfigurationEvent.h" - -JausComponentCommunicationManager::JausComponentCommunicationManager(FileLoader *configData, MessageRouter *msgRouter, SystemTree *systemTree, EventHandler *handler) -{ - this->enabled = true; - this->msgRouter = msgRouter; - this->systemTree = systemTree; - this->configData = configData; - this->eventHandler = handler; - this->interfaces.empty(); - this->interfaceMap.empty(); - - // NOTE: These two values should exist in the properties file and should be checked - // in the NodeManager class prior to constructing this object - mySubsystemId = configData->GetConfigDataInt("JAUS", "SubsystemId"); - if(mySubsystemId < JAUS_MINIMUM_SUBSYSTEM_ID || mySubsystemId > JAUS_MAXIMUM_SUBSYSTEM_ID) - { - // Invalid ID - throw "JausComponentCommunicationManager: Invalid Subsystem ID"; - mySubsystemId = JAUS_INVALID_SUBSYSTEM_ID; - return; - } - - myNodeId = configData->GetConfigDataInt("JAUS", "NodeId"); - if(myNodeId < JAUS_MINIMUM_NODE_ID || myNodeId > JAUS_MAXIMUM_NODE_ID) - { - // Invalid ID - throw "JausComponentCommunicationManager: Invalid Node ID"; - myNodeId= JAUS_INVALID_NODE_ID; - return; - } - - ConfigurationEvent *e = new ConfigurationEvent(__FUNCTION__, __LINE__, "Starting Component Interfaces"); - this->eventHandler->handleEvent(e); - - // Start Local Components - this->nodeManagerCmpt = new NodeManagerComponent(this->configData, this->eventHandler, this); - this->interfaces.push_back(nodeManagerCmpt); - - // Only start the Communicator if the SubsystemCommunications is enabled - if( configData->GetConfigDataBool("Subsystem_Communications", "Enabled")) - { - this->communicatorCmpt = new CommunicatorComponent(this->configData, this->eventHandler, this); - this->interfaces.push_back(communicatorCmpt); - } - else - { - this->communicatorCmpt = NULL; - } - - // Start component interface(s) - if(configData->GetConfigDataBool("Component_Communications", "JAUS_OPC_UDP_Interface")) - { - JausOpcUdpInterface *etgUdpInterface = new JausOpcUdpInterface(configData, this->eventHandler, this); - this->interfaces.push_back(etgUdpInterface); - - char buf[128] = {0}; - sprintf(buf, "Opened Component Interface:\t%s", etgUdpInterface->toString().c_str()); - ConfigurationEvent *e = new ConfigurationEvent(__FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - - if(configData->GetConfigDataBool("Component_Communications", "JUDP_Interface")) - { - JudpInterface *judpInterface = new JudpInterface(configData, this->eventHandler, this); - this->interfaces.push_back(judpInterface); - - char buf[128] = {0}; - sprintf(buf, "Opened Component Interface:\t%s", judpInterface->toString().c_str()); - ConfigurationEvent *e = new ConfigurationEvent(__FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - - if(configData->GetConfigDataBool("Component_Communications", "OpenJAUS_UDP_Interface")) - { - this->udpCmptInf = new OjUdpComponentInterface(configData, this->eventHandler, this); - - char buf[128] = {0}; - sprintf(buf, "Opened Component Interface:\t%s", udpCmptInf->toString().c_str()); - ConfigurationEvent *e = new ConfigurationEvent(__FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - else - { - this->udpCmptInf = NULL; - } - - - if(!this->udpCmptInf) - { - // Error, must have some CmptInterface - throw "JausComponentCommunicationManager: No Component Interface defined"; - } -} - -JausComponentCommunicationManager::~JausComponentCommunicationManager(void) -{ - std::vector::iterator iterator; - for(iterator = interfaces.begin(); iterator != interfaces.end(); iterator++) - { - delete *iterator; - } - - if(udpCmptInf) delete udpCmptInf; -} - -bool JausComponentCommunicationManager::startInterfaces(void) -{ - bool retVal = true; - std::vector ::iterator iter; - for(iter = interfaces.begin(); iter != interfaces.end(); iter++) - { - retVal = retVal && (*iter)->startInterface(); - } - - if(udpCmptInf) this->udpCmptInf->startInterface(); - - return retVal; -} - -bool JausComponentCommunicationManager::stopInterfaces(void) -{ - bool retVal = true; - std::vector ::iterator iter; - for(iter = interfaces.begin(); iter != interfaces.end(); iter++) - { - retVal = retVal && (*iter)->stopInterface(); - } - - if(udpCmptInf) this->udpCmptInf->stopInterface(); - - return retVal; -} - -bool JausComponentCommunicationManager::sendJausMessage(JausMessage message) -{ - // This conforms to the CmptCommMngr MsgRouter Source Routing Table v2.0 - if(!message) - { - // Error: Invalid message - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid message pointer"); - this->eventHandler->handleEvent(e); - return false; - } - - // Check for Errors - if( message->destination->subsystem != mySubsystemId && - message->destination->subsystem != JAUS_BROADCAST_SUBSYSTEM_ID ) - { - // ERROR: Message not for this subsystem has been routed from the MsgRouter - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message not for this subsystem has been routed from the MsgRouter"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - if(message->source->subsystem == mySubsystemId && message->source->node == myNodeId) - { - // ERROR: Message from this node has been routed from the MsgRouter - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message from this node has been routed from the MsgRouter"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - if( message->destination->subsystem == mySubsystemId || - message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID) - { - if( message->destination->component == JAUS_BROADCAST_COMPONENT_ID || - message->destination->instance == JAUS_BROADCAST_INSTANCE_ID) - { - return sendToAllInterfaces(message); - } - else - { - return sendToComponentX(message); - } - } - else - { - // ERROR: Message not for components on this node received - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message not for components on this node received"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } -} - -bool JausComponentCommunicationManager::receiveJausMessage(JausMessage message, JausTransportInterface *srcInf) -{ - // This conforms to the CmptCommMngr MsgRouter Source Routing Table v2.0 - if(!message) - { - // Error: Invalid message - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid message pointer"); - this->eventHandler->handleEvent(e); - return false; - } - - if(message->source->subsystem != mySubsystemId) - { - // ERROR: Received a message from a component that is not from my subsystem! - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Received a message from a component that is not from my subsystem!"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - if(message->source->node != myNodeId) - { - // ERROR: Received a message from a component with a source node that is not my node ID! - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Received a message from a component with a source node that is not my node ID!"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - // Add this source to our interface table - interfaceMap[jausAddressHash(message->source)] = srcInf; - - if(message->destination->subsystem == mySubsystemId) - { - if(message->destination->node == myNodeId) - { - if(message->destination->component == JAUS_BROADCAST_COMPONENT_ID) - { - return sendToAllInterfaces(message); - } - else - { - return sendToComponentX(message); - } - } - else - { - // Send to MsgRouter - msgRouter->routeComponentSourceMessage(jausMessageClone(message)); - - if(message->destination->component == JAUS_BROADCAST_COMPONENT_ID) - { - return sendToAllInterfaces(message); - } - else - { - return sendToComponentX(message); - } - } - } - else if(message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID) - { - msgRouter->routeComponentSourceMessage(jausMessageClone(message)); - - if(message->destination->component == JAUS_BROADCAST_COMPONENT_ID) - { - return sendToAllInterfaces(message); - } - else - { - return sendToComponentX(message); - } - } - else - { - msgRouter->routeComponentSourceMessage(message); - } - - return false; -} - -NodeManagerComponent *JausComponentCommunicationManager::getNodeManagerComponent(void) -{ - return this->nodeManagerCmpt; -} - -bool JausComponentCommunicationManager::sendToComponentX(JausMessage message) -{ - HASH_MAP::iterator iter; - - if(!message) - { - // Error: Invalid message - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid message pointer"); - this->eventHandler->handleEvent(e); - return false; - } - - if( message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID || - message->destination->node == JAUS_BROADCAST_NODE_ID) - { - // This is ensure that the jausAddressHash works incase either the Subs or Node IDs are BROADCAST - // Assume if we have gotten here this message is actually for our Subs & Node - JausAddress lookupAddress = jausAddressClone(message->destination); - lookupAddress->subsystem = mySubsystemId; - lookupAddress->node = myNodeId; - - iter = interfaceMap.find(jausAddressHash(lookupAddress)); - jausAddressDestroy(lookupAddress); - } - else - { - iter = interfaceMap.find(jausAddressHash(message->destination)); - } - - if(iter != interfaceMap.end()) - { - iter->second->queueJausMessage(message); - return true; - } - else - { - // I don't know how to send something to that node - jausMessageDestroy(message); - return false; - } -} - -bool JausComponentCommunicationManager::sendToAllInterfaces(JausMessage message) -{ - std::vector ::iterator iter; - - if(!message) - { - // Error: Invalid message - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid message pointer"); - this->eventHandler->handleEvent(e); - return false; - } - - for(iter = interfaces.begin(); iter != interfaces.end(); iter++) - { - (*iter)->queueJausMessage(jausMessageClone(message)); - } - jausMessageDestroy(message); - return true; -} - diff --git a/lib/openjaus/libopenJaus/src/nodeManager/JausNodeCommunicationManager.cpp b/lib/openjaus/libopenJaus/src/nodeManager/JausNodeCommunicationManager.cpp deleted file mode 100644 index b03f89d7cf269d7f3139096066b878adc89d6563..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/JausNodeCommunicationManager.cpp +++ /dev/null @@ -1,472 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausNodeCommunicationManager.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines a JausNodeCommunicationManager.cpp class. -// This is derived from a the JausCommunicationManager class and supports -// different node interfaces. - -#include "nodeManager/JausNodeCommunicationManager.h" -#include "nodeManager/JausOpcUdpInterface.h" -#include "nodeManager/JudpInterface.h" -#include "nodeManager/events/ErrorEvent.h" -#include "nodeManager/events/ConfigurationEvent.h" - -JausNodeCommunicationManager::JausNodeCommunicationManager(FileLoader *configData, MessageRouter *msgRouter, SystemTree *systemTree, EventHandler *handler) -{ - this->eventHandler = handler; - this->systemTree = systemTree; - this->msgRouter = msgRouter; - this->configData = configData; - this->subsystemGatewayInterface = NULL; - - // NOTE: These two values should exist in the properties file and should be checked - // in the NodeManager class prior to constructing this object - mySubsystemId = configData->GetConfigDataInt("JAUS", "SubsystemId"); - if(mySubsystemId < JAUS_MINIMUM_SUBSYSTEM_ID || mySubsystemId > JAUS_MAXIMUM_SUBSYSTEM_ID) - { - // Invalid ID - throw "JausNodeCommunicationManager: Config file [JAUS] SubsystemId is invalid\n"; - mySubsystemId = JAUS_INVALID_SUBSYSTEM_ID; - return; - } - - myNodeId = configData->GetConfigDataInt("JAUS", "NodeId"); - if(myNodeId < JAUS_MINIMUM_NODE_ID || myNodeId > JAUS_MAXIMUM_NODE_ID) - { - // Invalid ID - throw "JausNodeCommunicationManager: Config file [JAUS] NodeId is invalid\n"; - myNodeId= JAUS_INVALID_NODE_ID; - return; - } - - if( configData->GetConfigDataBool("Node_Communications", "Enabled")) - { - ConfigurationEvent *e = new ConfigurationEvent(__FUNCTION__, __LINE__, "Starting Node Interfaces"); - this->eventHandler->handleEvent(e); - - // Start subsystem interface(s) - if(configData->GetConfigDataBool("Node_Communications", "JAUS_OPC_UDP_Interface")) - { - JausOpcUdpInterface *etgUdpInterface = new JausOpcUdpInterface(configData, this->eventHandler, this); - this->interfaces.push_back(etgUdpInterface); - - char buf[128] = {0}; - sprintf(buf, "Opened Node Interface:\t\t%s", etgUdpInterface->toString().c_str()); - ConfigurationEvent *e = new ConfigurationEvent(__FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - - if(configData->GetConfigDataBool("Node_Communications", "JUDP_Interface")) - { - JudpInterface *judpInterface = new JudpInterface(configData, this->eventHandler, this); - this->interfaces.push_back(judpInterface); - - char buf[128] = {0}; - sprintf(buf, "Opened Node Interface:\t\t%s", judpInterface->toString().c_str()); - ConfigurationEvent *e = new ConfigurationEvent(__FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - - if( this->interfaces.size() > 0) - { - this->enabled = true; - } - else - { - this->enabled = false; - } - } - else - { - this->enabled = false; - } -} - - -JausNodeCommunicationManager::~JausNodeCommunicationManager(void) -{ - std::vector::iterator iterator; - for(iterator = interfaces.begin(); iterator != interfaces.end(); iterator++) - { - delete *iterator; - } -} - -bool JausNodeCommunicationManager::startInterfaces(void) -{ - bool retVal = true; - std::vector ::iterator iter; - for(iter = interfaces.begin(); iter != interfaces.end(); iter++) - { - retVal = retVal && (*iter)->startInterface(); - } - return retVal; -} - -bool JausNodeCommunicationManager::stopInterfaces(void) -{ - bool retVal = true; - std::vector ::iterator iter; - for(iter = interfaces.begin(); iter != interfaces.end(); iter++) - { - retVal = retVal && (*iter)->stopInterface(); - } - - return retVal; -} - - -bool JausNodeCommunicationManager::sendJausMessage(JausMessage message) -{ - if(!this->enabled) - { - // This Communication Manager is turned off - // Destroy this message - jausMessageDestroy(message); - return false; - } - - // This conforms to the NodeCommMngr Routing Table's MsgRouter Source Table v2.0 - if(!message) - { - // Error: Invalid message - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage."); - this->eventHandler->handleEvent(e); - return false; - } - - if(message->source->subsystem != mySubsystemId) - { - if( message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID || - message->destination->subsystem == mySubsystemId) - { - if(message->destination->node == JAUS_BROADCAST_NODE_ID) - { - // Send to all other nodes on this subs - return sendToAllInterfaces(message); - } - else if(message->destination->node != myNodeId) - { - // Route to Node X - return sendToNodeX(message); - } - else - { - // ERROR: Message received from MsgRouter that is not from this subs is for this node! - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message received from MsgRouter that is not from this subs is for this node"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - } - else - { - // ERROR: Message received from MsgRouter that is not from this subs and not for this subs! - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message received from MsgRouter that is not from this subs and not for this subs!"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - } - else // message->source->subsystem == mySubsystemId - { - if(message->source->node != myNodeId) - { - // ERROR: Message received from MsgRouter that has address of another node on this system - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message received from MsgRouter that has address of another node on this system"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - else - { - // Special behavior in here to handle routing of messages to the communicator / primary nodemngr - if( message->destination->subsystem != mySubsystemId && - message->destination->subsystem != JAUS_BROADCAST_SUBSYSTEM_ID) - { - return sendToSubsystemGateway(message); - } - else if(message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID) - { - if(message->destination->node == JAUS_BROADCAST_SUBSYSTEM_ID) - { - // Send to all other nodes - return sendToAllInterfaces(message); - } - else if(message->destination->node == myNodeId) - { - return sendToSubsystemGateway(message); - } - else //message->destination->node == X - { - // Route to node X - sendToNodeX(jausMessageClone(message)); - - // PREVENT DUPLICATION! - // If Node X is not the Communicator Node or the Primary node, sendToSubsystemGateway - JausAddress commAddress = systemTree->lookUpAddress(mySubsystemId, JAUS_ADDRESS_WILDCARD_OCTET, JAUS_COMMUNICATOR, JAUS_ADDRESS_WILDCARD_OCTET); - if(commAddress && commAddress->node != message->destination->node && message->destination->node != JAUS_PRIMARY_NODE_MANAGER_NODE) - { - sendToSubsystemGateway(jausMessageClone(message)); - } - - jausMessageDestroy(message); - return true; - } - } - else //message->destination->subsystem == mySubsystemId - { - if(message->destination->node == myNodeId) - { - // ERROR: Msg recv'd which is for this node! - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message received from MsgRouter that is for my Node!"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - else if(message->destination->node == JAUS_BROADCAST_NODE_ID) - { - // Send to all other nodes - return sendToAllInterfaces(message); - } - else - { - // Route to Node X - return sendToNodeX(message); - } - } - } - } -} - -bool JausNodeCommunicationManager::receiveJausMessage(JausMessage message, JausTransportInterface *srcInf) -{ - if(!this->enabled) - { - // This Communication Manager is turned off - // Destroy this message - jausMessageDestroy(message); - return false; - } - - // This conforms to the NodeCommMngr Routing Table's MsgRouter Source Table v2.0 - if(!message) - { - // Error: Invalid message - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage."); - this->eventHandler->handleEvent(e); - return false; - } - - // Check for errors - if(message->source->subsystem == mySubsystemId) - { - if(message->source->node == myNodeId) - { - // Error: Msg recv'd from this node through NodeInf, invalid! - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message received from NodeInterface that is from my Node!"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - else - { - if(message->source->subsystem == mySubsystemId) - { - // Put Interface data on the map - interfaceMap[message->source->node] = srcInf; - } - else - { - // Message is from another subsystem - this->subsystemGatewayInterface = srcInf; - } - - if(message->destination->subsystem == mySubsystemId) - { - if(message->destination->node == myNodeId || message->destination->node == JAUS_BROADCAST_NODE_ID) - { - msgRouter->routeNodeSourceMessage(message); - return true; - } - else - { - // ERROR: Message not for this node recv'd from another node - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message not for this node recv'd from another node"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - } - else - { - msgRouter->routeNodeSourceMessage(message); - return true; - } - - - } - } - else //message->source->subsystem != mySubsystemId - { - if( message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID || - message->destination->subsystem == mySubsystemId) - { - if(message->destination->node == myNodeId || message->destination->node == JAUS_BROADCAST_NODE_ID) - { - msgRouter->routeNodeSourceMessage(message); - return true; - } - else - { - // ERROR: Message not for this node recv'd from another node - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message not for this node recv'd from another node"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - } - else // message->destination->subsystem == X - { - // ERROR: Message not for this subsystem and not from this subsystem recv'd from another node - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message not for this subsystem and not from this subsystem recv'd from another node"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - } -} - -bool JausNodeCommunicationManager::sendToSubsystemGateway(JausMessage message) -{ - if(!message) - { - // Error: Invalid message - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage."); - this->eventHandler->handleEvent(e); - return false; - } - - if(msgRouter->subsystemCommunicationEnabled()) - { - // ERROR: This should have gone out to the SubsCommMngr - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message received in Node Communication Manager which should have gone out the Subsystem Communication manager."); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - // Send to the subsystemGatewayInterface - if(subsystemGatewayInterface) - { - // Send to the Communicator's Node - subsystemGatewayInterface->queueJausMessage(message); - return true; - } - else if(myNodeId != JAUS_PRIMARY_NODE_MANAGER_NODE) - { - // Send to the Primary Node Manager (note this is mainly for backwards compatibility) - JausTransportInterface *jtInf = interfaceMap[JAUS_PRIMARY_NODE_MANAGER_NODE]; - if(jtInf) - { - jtInf->queueJausMessage(message); - return true; - } - else - { - // I don't know how to send something to that node - jausMessageDestroy(message); - return false; - } - } - else - { - // No known subsystem interface - // This is the Primary Node - // And I don't have an active SubsCommMngr - jausMessageDestroy(message); - return false; - } -} - -bool JausNodeCommunicationManager::sendToNodeX(JausMessage message) -{ - if(!message) - { - // Error: Invalid message - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage."); - this->eventHandler->handleEvent(e); - return false; - } - - JausTransportInterface *jtInf = interfaceMap[message->destination->node]; - if(jtInf) - { - jtInf->queueJausMessage(message); - return true; - } - else - { - // I don't know how to send something to that node - jausMessageDestroy(message); - return false; - } -} - -bool JausNodeCommunicationManager::sendToAllInterfaces(JausMessage message) -{ - std::vector ::iterator iter; - if(!message) - { - // Error: Invalid message - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage."); - this->eventHandler->handleEvent(e); - return false; - } - - for(iter = interfaces.begin(); iter != interfaces.end(); iter++) - { - (*iter)->queueJausMessage(jausMessageClone(message)); - } - - jausMessageDestroy(message); - return true; -} diff --git a/lib/openjaus/libopenJaus/src/nodeManager/JausOpcUdpInterface.cpp b/lib/openjaus/libopenJaus/src/nodeManager/JausOpcUdpInterface.cpp deleted file mode 100644 index 115491212ee5f4254bc11639f2e34d61b9aaba62..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/JausOpcUdpInterface.cpp +++ /dev/null @@ -1,804 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausOpcUdpInterface.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: Defines the standard JAUS UDP interface on port 3792. Is compliant with the -// OPC/OPC style of UDP header - -#include "nodeManager/JausOpcUdpInterface.h" -#include "nodeManager/JausSubsystemCommunicationManager.h" -#include "nodeManager/JausNodeCommunicationManager.h" -#include "nodeManager/JausComponentCommunicationManager.h" -#include "nodeManager/events/ErrorEvent.h" -#include "nodeManager/events/JausMessageEvent.h" - -JausOpcUdpInterface::JausOpcUdpInterface(FileLoader *configData, EventHandler *handler, JausCommunicationManager *commMngr) -{ - this->commMngr = commMngr; - this->eventHandler = handler; - this->name = JAUS_OPC_UDP_NAME; - this->configData = configData; - this->multicast = false; - this->subsystemGatewayDiscovered = false; - - // Determine the type of our commMngr - if(dynamic_cast(this->commMngr)) - { - this->type = SUBSYSTEM_INTERFACE; - } - else if(dynamic_cast(this->commMngr)) - { - this->type = NODE_INTERFACE; - } - else if(dynamic_cast(this->commMngr)) - { - this->type = COMPONENT_INTERFACE; - } - else - { - this->type = UNKNOWN_INTERFACE; - } - - - // NOTE: These two values should exist in the properties file and should be checked - // in the NodeManager class prior to constructing this object - mySubsystemId = configData->GetConfigDataInt("JAUS", "SubsystemId"); - if(mySubsystemId < JAUS_MINIMUM_SUBSYSTEM_ID || mySubsystemId > JAUS_MAXIMUM_SUBSYSTEM_ID) - { - // Invalid ID - // TODO: Throw an exception? Log an error. - mySubsystemId = JAUS_INVALID_SUBSYSTEM_ID; - return; - } - - // Setup our UDP Socket - if(!this->openSocket()) - { - throw "JausOpcUdpInterface: Could not open socket\n"; - } -} - -bool JausOpcUdpInterface::startInterface(void) -{ - // Set our thread running flag - this->running = true; - - // Setup our pThread - this->startThread(); - - // Setup our receiveThread - this->startRecvThread(); - - return true; -} - -bool JausOpcUdpInterface::stopInterface(void) -{ - this->running = false; - - // Stop our pThread - this->stopThread(); - - // Stop our receiveThread - this->stopRecvThread(); - - return true; -} - -JausOpcUdpInterface::~JausOpcUdpInterface(void) -{ - if(running) - { - this->stopInterface(); - } - this->closeSocket(); - - // TODO: Check our threadIds to see if they terminated properly -} - -InetAddress JausOpcUdpInterface::getInetAddress(void) -{ - return this->socket->address; -} - -bool JausOpcUdpInterface::processMessage(JausMessage message) -{ - switch(this->type) - { - case SUBSYSTEM_INTERFACE: - // if subs==BROADCAST send multicast - if(message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID) - { - if(this->multicast) - { - // Send multicast packet - sendJausMessage(this->multicastData, message); - jausMessageDestroy(message); - return true; - } - else - { - // Unicast to all known subsystems - HASH_MAP::iterator iter; - for(iter = addressMap.begin(); iter != addressMap.end(); iter++) - { - sendJausMessage(iter->second, message); - } - jausMessageDestroy(message); - return true; - } - } - else - { - // Unicast - if(addressMap.find(message->destination->subsystem) != addressMap.end()) - { - sendJausMessage(addressMap.find(message->destination->subsystem)->second, message); - jausMessageDestroy(message); - return true; - } - else - { - // Don't know how to send this message - jausMessageDestroy(message); - return false; - } - } - break; - - case NODE_INTERFACE: - if( message->destination->subsystem == mySubsystemId || - message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID ) - { - // if node==BROADCAST send multicast - if(message->destination->node == JAUS_BROADCAST_NODE_ID) - { - if(this->multicast) - { - // Send multicast packet - sendJausMessage(this->multicastData, message); - jausMessageDestroy(message); - return true; - } - else - { - // Unicast to all known nodes - HASH_MAP::iterator iter; - for(iter = addressMap.begin(); iter != addressMap.end(); iter++) - { - sendJausMessage(iter->second, message); - } - jausMessageDestroy(message); - return true; - } - } - else - { - // Unicast - if(addressMap.find(message->destination->node) != addressMap.end()) - { - sendJausMessage(addressMap.find(message->destination->node)->second, message); - jausMessageDestroy(message); - return true; - } - else - { - // Don't know how to send this message - jausMessageDestroy(message); - return false; - } - } - } - else - { - // Message for other subsystem - if(subsystemGatewayDiscovered) - { - sendJausMessage(subsystemGatewayData, message); - jausMessageDestroy(message); - return true; - } - else - { - // Don't know how to send this message - jausMessageDestroy(message); - return false; - } - } - break; - - case COMPONENT_INTERFACE: - // if cmpt == BROADCAST || inst == BROADCAST send unicast to all components - if( message->destination->component == JAUS_BROADCAST_COMPONENT_ID || - message->destination->instance == JAUS_BROADCAST_INSTANCE_ID ) - { - if(this->multicast) - { - // Send multicast packet - sendJausMessage(this->multicastData, message); - jausMessageDestroy(message); - return true; - } - else - { - // Unicast to all known subsystems - HASH_MAP::iterator iter; - for(iter = addressMap.begin(); iter != addressMap.end(); iter++) - { - sendJausMessage(iter->second, message); - } - jausMessageDestroy(message); - return true; - } - } - else - { - // Unicast - if(addressMap.find(jausAddressHash(message->destination)) != addressMap.end()) - { - sendJausMessage(addressMap.find(jausAddressHash(message->destination))->second, message); - jausMessageDestroy(message); - return true; - } - else - { - // Don't know how to send this message - jausMessageDestroy(message); - return false; - } - } - break; - - default: - // Unknown type - // No routing behavior - jausMessageDestroy(message); - return false; - } -} - -void JausOpcUdpInterface::run() -{ - // Lock our mutex - pthread_mutex_lock(&threadMutex); - - while(this->running) - { - pthread_cond_wait(&threadConditional, &threadMutex); - - while(!this->queue.isEmpty()) - { - // Pop a packet off the queue and send it off - processMessage(queue.pop()); - } - } - pthread_mutex_unlock(&threadMutex); -} - -std::string JausOpcUdpInterface::toString() -{ - char ret[256] = {0}; - char buf[80] = {0}; - if(this->socket) - { - inetAddressToBuffer(this->socket->address, buf, 80); - sprintf(ret, "%s %s:%d", JAUS_OPC_UDP_NAME, buf, this->socket->port); - return ret; - } - else - { - sprintf(ret, "%s Invalid.", JAUS_OPC_UDP_NAME); - return ret; - } -} - -bool JausOpcUdpInterface::openSocket(void) -{ - double socketTimeoutSec = 0; - unsigned char socketTTL = 0; - std::string multicastGroupString; - - switch(this->type) - { - case SUBSYSTEM_INTERFACE: - // Read Subsystem UDP Parameters - // Port is constant per JAUS Standard - this->portNumber = JAUS_OPC_UDP_DATA_PORT; - - // IP Address - if(this->configData->GetConfigDataString("Subsystem_Communications", "JAUS_OPC_UDP_IP_Address") == "") - { - // Cannot open specified IP Address - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, "No IP Address specified!"); - this->eventHandler->handleEvent(e); - return false; - } - else - { - this->ipAddress = inetAddressGetByString((char *)this->configData->GetConfigDataString("Subsystem_Communications", "JAUS_OPC_UDP_IP_Address").c_str()); - if(this->ipAddress == NULL) - { - // Cannot open specified IP Address - char errorString[128] = {0}; - sprintf(errorString, "Could not open specified IP Address: %s", this->configData->GetConfigDataString("Subsystem_Communications", "JAUS_OPC_UDP_IP_Address").c_str()); - - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return false; - } - } - - // Timeout - if(this->configData->GetConfigDataString("Subsystem_Communications", "JAUS_OPC_UDP_Timeout_Sec") == "") - { - socketTimeoutSec = OPC_UDP_DEFAULT_SUBSYSTEM_UDP_TIMEOUT_SEC; - } - else - { - socketTimeoutSec = this->configData->GetConfigDataDouble("Subsystem_Communications", "JAUS_OPC_UDP_Timeout_Sec"); - } - - // TTL - if(this->configData->GetConfigDataString("Subsystem_Communications", "JAUS_OPC_UDP_TTL") == "") - { - socketTTL = OPC_UDP_DEFAULT_SUBSYSTEM_TTL; - } - else - { - socketTTL = this->configData->GetConfigDataInt("Subsystem_Communications", "JAUS_OPC_UDP_TTL"); - } - - // Multicast - if(this->configData->GetConfigDataString("Subsystem_Communications", "JAUS_OPC_UDP_Multicast") == "") - { - this->multicast = OPC_UDP_DEFAULT_SUBSYSTEM_MULTICAST; - } - else - { - this->multicast = this->configData->GetConfigDataBool("Subsystem_Communications", "JAUS_OPC_UDP_Multicast"); - } - - if(this->multicast) - { - // Multicast Group - if(this->configData->GetConfigDataString("Subsystem_Communications", "JAUS_OPC_UDP_Multicast_Group") == "") - { - multicastGroupString = OPC_UDP_DEFAULT_SUBSYSTEM_MULTICAST_GROUP; - } - else - { - multicastGroupString = this->configData->GetConfigDataString("Subsystem_Communications", "JAUS_OPC_UDP_Multicast_Group"); - } - } - break; - - case NODE_INTERFACE: - // Setup Node Configuration - // Port is constant per JAUS Standard - this->portNumber = JAUS_OPC_UDP_DATA_PORT; - - // IP Address - if(this->configData->GetConfigDataString("Node_Communications", "JAUS_OPC_UDP_IP_Address") == "") - { - // Cannot open specified IP Address - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, "No IP Address specified!"); - this->eventHandler->handleEvent(e); - return false; - } - else - { - this->ipAddress = inetAddressGetByString((char *)this->configData->GetConfigDataString("Node_Communications", "JAUS_OPC_UDP_IP_Address").c_str()); - if(this->ipAddress == NULL) - { - // Cannot open specified IP Address - char errorString[128] = {0}; - sprintf(errorString, "Could not open specified IP Address: %s", this->configData->GetConfigDataString("Node_Communications", "JAUS_OPC_UDP_IP_Address").c_str()); - - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return false; - } - } - - // Timeout - if(this->configData->GetConfigDataString("Node_Communications", "JAUS_OPC_UDP_Timeout_Sec") == "") - { - socketTimeoutSec = OPC_UDP_DEFAULT_NODE_UDP_TIMEOUT_SEC; - } - else - { - socketTimeoutSec = this->configData->GetConfigDataDouble("Node_Communications", "JAUS_OPC_UDP_Timeout_Sec"); - } - - // TTL - if(this->configData->GetConfigDataString("Node_Communications", "JAUS_OPC_UDP_TTL") == "") - { - socketTTL = OPC_UDP_DEFAULT_NODE_TTL; - } - else - { - socketTTL = this->configData->GetConfigDataInt("Node_Communications", "JAUS_OPC_UDP_TTL"); - } - - // Multicast - if(this->configData->GetConfigDataString("Node_Communications", "JAUS_OPC_UDP_Multicast") == "") - { - this->multicast = OPC_UDP_DEFAULT_NODE_MULTICAST; - } - else - { - this->multicast = this->configData->GetConfigDataBool("Node_Communications", "JAUS_OPC_UDP_Multicast"); - } - - if(this->multicast) - { - // Multicast Group - if(this->configData->GetConfigDataString("Node_Communications", "JAUS_OPC_UDP_Multicast_Group") == "") - { - multicastGroupString = OPC_UDP_DEFAULT_NODE_MULTICAST_GROUP; - } - else - { - multicastGroupString = this->configData->GetConfigDataString("Node_Communications", "JAUS_OPC_UDP_Multicast_Group"); - } - } - break; - - case COMPONENT_INTERFACE: - // Read Component Configuration - // Port Number - if(this->configData->GetConfigDataString("Component_Communications", "JAUS_OPC_UDP_Port") == "") - { - this->portNumber = OPC_UDP_DEFAULT_COMPONENT_UDP_PORT; - } - else - { - this->portNumber = this->configData->GetConfigDataInt("Component_Communications", "JAUS_OPC_UDP_Port"); - } - - // IP Address - if(this->configData->GetConfigDataString("Component_Communications", "JAUS_OPC_UDP_IP_Address") == "") - { - this->ipAddress = inetAddressGetByString((char *)OPC_UDP_DEFAULT_COMPONENT_IP.c_str()); - if(this->ipAddress == NULL) - { - // Cannot open specified IP Address - char errorString[128] = {0}; - sprintf(errorString, "Could not open default IP Address: %s", OPC_UDP_DEFAULT_COMPONENT_IP.c_str()); - - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return false; - } - } - else - { - this->ipAddress = inetAddressGetByString((char *)this->configData->GetConfigDataString("Component_Communications", "JAUS_OPC_UDP_IP_Address").c_str()); - if(this->ipAddress == NULL) - { - // Cannot open specified IP Address - char errorString[128] = {0}; - sprintf(errorString, "Could not open specified IP Address: %s", this->configData->GetConfigDataString("Component_Communications", "JAUS_OPC_UDP_IP_Address").c_str()); - - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return false; - } - } - - // Timeout - if(this->configData->GetConfigDataString("Component_Communications", "JAUS_OPC_UDP_Timeout_Sec") == "") - { - socketTimeoutSec = OPC_UDP_DEFAULT_COMPONENT_UDP_TIMEOUT_SEC; - } - else - { - socketTimeoutSec = this->configData->GetConfigDataDouble("Component_Communications", "JAUS_OPC_UDP_Timeout_Sec"); - } - - // TTL - if(this->configData->GetConfigDataString("Component_Communications", "JAUS_OPC_UDP_TTL") == "") - { - socketTTL = OPC_UDP_DEFAULT_COMPONENT_TTL; - } - else - { - socketTTL = this->configData->GetConfigDataInt("Component_Communications", "JAUS_OPC_UDP_TTL"); - } - - // Multicast - if(this->configData->GetConfigDataString("Component_Communications", "JAUS_OPC_UDP_Multicast") == "") - { - this->multicast = OPC_UDP_DEFAULT_COMPONENT_MULTICAST; - } - else - { - this->multicast = this->configData->GetConfigDataBool("Component_Communications", "JAUS_OPC_UDP_Multicast"); - } - - if(this->multicast) - { - // Multicast Group - if(this->configData->GetConfigDataString("Component_Communications", "JAUS_OPC_UDP_Multicast_Group") == "") - { - // Error. Component has no default Multicast group. - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, "No default Component Multicast Group and none defined."); - this->eventHandler->handleEvent(e); - - inetAddressDestroy(this->ipAddress); - return false; - } - else - { - multicastGroupString = this->configData->GetConfigDataString("Component_Communications", "JAUS_OPC_UDP_Multicast_Group"); - } - } - break; - - default: - // Unknown type - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, "Unknown JudpInterface type. Cannot open socket."); - this->eventHandler->handleEvent(e); - return false; - } - - // Create Socket - this->socket = multicastSocketCreate(this->portNumber, ipAddress); - if(!this->socket) - { - // Error creating our socket - char errorString[128] = {0}; - char buf[24] = {0}; - - inetAddressToBuffer(this->ipAddress, buf, 24); - sprintf(errorString, "Could not open socket: %s:%d", buf, this->portNumber); - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - - inetAddressDestroy(this->ipAddress); - return false; - } - else - { - this->ipAddress->value = socket->address->value; - this->portNumber = socket->port; - } - inetAddressDestroy(this->ipAddress); - - // Setup Timeout - multicastSocketSetTimeout(this->socket, socketTimeoutSec); - - // Setup TTL - multicastSocketSetTTL(this->socket, socketTTL); - - // Setup Multicast - if(this->multicast) - { - this->multicastGroup = inetAddressGetByString((char *)multicastGroupString.c_str()); - if(multicastSocketJoinGroup(this->socket, this->multicastGroup) != 0) - { - // Error joining our group - char errorString[128] = {0}; - char buf[24] = {0}; - - inetAddressToString(this->multicastGroup, buf); - sprintf(errorString, "Could not open socket: %s:%d", buf, this->portNumber); - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return false; - } - - // Setup Loopback - multicastSocketSetLoopback(this->socket, LOOPBACK_DISABLED); - - // Setup Multicast UdpData - multicastData.addressValue = multicastGroup->value; - multicastData.port = this->socket->port; - - inetAddressDestroy(this->multicastGroup); - } - - return true; -} - -void JausOpcUdpInterface::sendJausMessage(OpcUdpTransportData data, JausMessage message) -{ - DatagramPacket packet = NULL; - int result; - - JausMessage tempMessage = jausMessageClone(message); - JausMessageEvent *e = new JausMessageEvent(tempMessage, this, JausMessageEvent::Outbound); - this->eventHandler->handleEvent(e); - - switch(this->type) - { - case SUBSYSTEM_INTERFACE: - case NODE_INTERFACE: - packet = datagramPacketCreate(); - packet->bufferSizeBytes = (int) jausMessageSize(message) + JAUS_OPC_UDP_HEADER_SIZE_BYTES; - packet->buffer = (unsigned char *) calloc(packet->bufferSizeBytes, 1); - packet->port = data.port; - packet->address->value = data.addressValue; - - memcpy(packet->buffer, JAUS_OPC_UDP_HEADER, JAUS_OPC_UDP_HEADER_SIZE_BYTES); - if(jausMessageToBuffer(message, packet->buffer + JAUS_OPC_UDP_HEADER_SIZE_BYTES, packet->bufferSizeBytes - JAUS_OPC_UDP_HEADER_SIZE_BYTES)) - { - result = multicastSocketSend(this->socket, packet); - } - - free(packet->buffer); - datagramPacketDestroy(packet); - return; - - case COMPONENT_INTERFACE: - packet = datagramPacketCreate(); - packet->bufferSizeBytes = (int) jausMessageSize(message); - packet->buffer = (unsigned char *) calloc(packet->bufferSizeBytes, 1); - packet->port = data.port; - packet->address->value = data.addressValue; - - if(jausMessageToBuffer(message, packet->buffer, packet->bufferSizeBytes)) - { - result = multicastSocketSend(this->socket, packet); - } - - free(packet->buffer); - datagramPacketDestroy(packet); - return; - - default: - char errorString[128] = {0}; - sprintf(errorString, "Unknown socket type %d\n", this->type); - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return; - } -} - -void JausOpcUdpInterface::closeSocket(void) -{ - multicastSocketDestroy(this->socket); -} - -void JausOpcUdpInterface::startRecvThread() -{ - pthread_attr_init(&this->recvThreadAttr); - pthread_attr_setdetachstate(&this->recvThreadAttr, PTHREAD_CREATE_JOINABLE); - this->recvThreadId = pthread_create(&this->recvThread, &this->recvThreadAttr, OpcUdpRecvThread, this); - pthread_attr_destroy(&this->recvThreadAttr); -} - -void JausOpcUdpInterface::stopRecvThread() -{ - pthread_join(this->recvThread, NULL); -} - -void JausOpcUdpInterface::recvThreadRun() -{ - DatagramPacket packet; - JausMessage rxMessage; - OpcUdpTransportData data; - int index = 0; - long bytesRecv = 0; - - packet = datagramPacketCreate(); - packet->bufferSizeBytes = JAUS_HEADER_SIZE_BYTES + JAUS_MAX_DATA_SIZE_BYTES + JAUS_OPC_UDP_HEADER_SIZE_BYTES; - packet->buffer = (unsigned char *) calloc(packet->bufferSizeBytes, 1); - - while(this->running) - { - index = 0; - bytesRecv = multicastSocketReceive(this->socket, packet); - - if(bytesRecv > 0) - { - if(!strncmp((char *)packet->buffer, JAUS_OPC_UDP_HEADER, JAUS_OPC_UDP_HEADER_SIZE_BYTES)) // equals 1 if same - { - index += JAUS_OPC_UDP_HEADER_SIZE_BYTES; - } - else if(this->type == SUBSYSTEM_INTERFACE || this->type == NODE_INTERFACE) - { - char errorString[128] = {0}; - sprintf(errorString, "Received packet on %s with invalid header. First byte is: %d (%c)", this->toString().c_str(), (char) packet->buffer[0], (char) packet->buffer[0]); - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - continue; - } - - rxMessage = jausMessageCreate(); - if(jausMessageFromBuffer(rxMessage, packet->buffer + index, packet->bufferSizeBytes - index)) - { - JausMessage tempMessage = jausMessageClone(rxMessage); - JausMessageEvent *e = new JausMessageEvent(tempMessage, this, JausMessageEvent::Inbound); - this->eventHandler->handleEvent(e); - - // Add to transportMap - switch(this->type) - { - case SUBSYSTEM_INTERFACE: - data.addressValue = packet->address->value; - data.port = JAUS_OPC_UDP_DATA_PORT; - this->addressMap[rxMessage->source->subsystem] = data; - break; - - case NODE_INTERFACE: - data.addressValue = packet->address->value; - data.port = JAUS_OPC_UDP_DATA_PORT; - if(rxMessage->source->subsystem == mySubsystemId) - { - this->addressMap[rxMessage->source->node] = data; - } - else - { - this->subsystemGatewayData = data; - this->subsystemGatewayDiscovered = true; - } - break; - - case COMPONENT_INTERFACE: - data.addressValue = packet->address->value; - data.port = packet->port; - this->addressMap[jausAddressHash(rxMessage->source)] = data; - break; - - default: - // Unknown type - break; - } - - this->commMngr->receiveJausMessage(rxMessage, this); - } - else - { - jausMessageDestroy(rxMessage); - } - } - } - - free(packet->buffer); - datagramPacketDestroy(packet); -} - -void *OpcUdpRecvThread(void *obj) -{ - JausOpcUdpInterface *etgUdpInterface = (JausOpcUdpInterface *)obj; - etgUdpInterface->recvThreadRun(); - return NULL; -} diff --git a/lib/openjaus/libopenJaus/src/nodeManager/JausSubsystemCommunicationManager.cpp b/lib/openjaus/libopenJaus/src/nodeManager/JausSubsystemCommunicationManager.cpp deleted file mode 100644 index 484963e6844021566b1ac02322296830d3f76213..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/JausSubsystemCommunicationManager.cpp +++ /dev/null @@ -1,302 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausSubsystemCommunicationManager.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines a JausSubsystemCommunicationManager.cpp class. -// This is derived from a the JausCommunicationManager class and supports -// different subsystem interfaces. - -#include "nodeManager/JausSubsystemCommunicationManager.h" -#include "nodeManager/JausOpcUdpInterface.h" -#include "nodeManager/JudpInterface.h" -#include "nodeManager/events/ErrorEvent.h" -#include "nodeManager/events/ConfigurationEvent.h" - -JausSubsystemCommunicationManager::JausSubsystemCommunicationManager(FileLoader *configData, MessageRouter *msgRouter, SystemTree *systemTree, EventHandler *handler) -{ - this->systemTree = systemTree; - this->msgRouter = msgRouter; - this->configData = configData; - this->eventHandler = handler; - - // NOTE: These two values should exist in the properties file and should be checked - // in the NodeManager class prior to constructing this object - mySubsystemId = configData->GetConfigDataInt("JAUS", "SubsystemId"); - if(mySubsystemId < JAUS_MINIMUM_SUBSYSTEM_ID || mySubsystemId > JAUS_MAXIMUM_SUBSYSTEM_ID) - { - // Invalid ID - throw "JausSubsystemCommunicationManager: Config file [JAUS] SubsystemId is invalid\n"; - mySubsystemId = JAUS_INVALID_SUBSYSTEM_ID; - return; - } - - myNodeId = configData->GetConfigDataInt("JAUS", "NodeId"); - if(myNodeId < JAUS_MINIMUM_NODE_ID || myNodeId > JAUS_MAXIMUM_NODE_ID) - { - // Invalid ID - throw "JausSubsystemCommunicationManager: Config file [JAUS] NodeId is invalid\n"; - myNodeId= JAUS_INVALID_NODE_ID; - return; - } - - if( configData->GetConfigDataBool("Subsystem_Communications", "Enabled")) - { - ConfigurationEvent *e = new ConfigurationEvent(__FUNCTION__, __LINE__, "Starting Subsystem Interfaces"); - this->eventHandler->handleEvent(e); - - // Start subsystem interface(s) - if(configData->GetConfigDataBool("Subsystem_Communications", "JAUS_OPC_UDP_Interface")) - { - JausOpcUdpInterface *etgUdpInterface = new JausOpcUdpInterface(configData, handler, this); - this->interfaces.push_back(etgUdpInterface); - - char buf[128] = {0}; - sprintf(buf, "Opened Subsystem Interface:\t%s", etgUdpInterface->toString().c_str()); - ConfigurationEvent *e = new ConfigurationEvent(__FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - - if(configData->GetConfigDataBool("Subsystem_Communications", "JUDP_Interface")) - { - JudpInterface *judpInterface = new JudpInterface(configData, this->eventHandler, this); - this->interfaces.push_back(judpInterface); - - char buf[128] = {0}; - sprintf(buf, "Opened Subsystem Interface:\t%s", judpInterface->toString().c_str()); - ConfigurationEvent *e = new ConfigurationEvent(__FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - - if( this->interfaces.size() > 0) - { - this->enabled = true; - } - else - { - this->enabled = false; - } - } - else - { - this->enabled = false; - } - -} - -JausSubsystemCommunicationManager::~JausSubsystemCommunicationManager(void) -{ - std::vector::iterator iterator; - for(iterator = interfaces.begin(); iterator != interfaces.end(); iterator++) - { - delete *iterator; - } -} - -bool JausSubsystemCommunicationManager::startInterfaces(void) -{ - bool retVal = true; - std::vector ::iterator iter; - for(iter = interfaces.begin(); iter != interfaces.end(); iter++) - { - retVal = retVal && (*iter)->startInterface(); - } - return retVal; -} - -bool JausSubsystemCommunicationManager::stopInterfaces(void) -{ - bool retVal = true; - std::vector ::iterator iter; - for(iter = interfaces.begin(); iter != interfaces.end(); iter++) - { - retVal = retVal && (*iter)->stopInterface(); - } - - return retVal; -} - -bool JausSubsystemCommunicationManager::sendJausMessage(JausMessage message) -{ - if(!this->enabled) - { - // This Communication Manager is turned off - // Destroy this message - jausMessageDestroy(message); - return false; - } - - // This conforms to the SubsCommMngr MsgRouter Source Routing Table v2.0 - if(!message) - { - // Error: Invalid message - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage."); - this->eventHandler->handleEvent(e); - return false; - } - - // Check for Errors - if(message->source->subsystem != mySubsystemId) - { - // ERROR: Message from another Subs coming in from MsgRouter - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message from another Subs coming in from MsgRouter"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - if(message->destination->subsystem == mySubsystemId) - { - // ERROR: Message for this Subs coming in from MsgRouter - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message for this Subs coming in from MsgRouter"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - if(message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID) - { - return sendToAllInterfaces(message); - } - else - { - return sendToSubsystemX(message); - } -} - -bool JausSubsystemCommunicationManager::receiveJausMessage(JausMessage message, JausTransportInterface *srcInf) -{ - if(!this->enabled) - { - // This Communication Manager is turned off - // Destroy this message - jausMessageDestroy(message); - return false; - } - - // This conforms to the SubsCommMngr MsgRouter Source Routing Table v2.0 - if(!message) - { - // Error: Invalid message - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage."); - this->eventHandler->handleEvent(e); - return false; - } - - if(!srcInf) - { - // Error: Invalid interface - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "srcInf is invalid"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - if(message->source->subsystem == mySubsystemId) - { - // Error: Cannot receive messages for myself through a subsInterface! - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message received from MsgRouter that is not from this subs is for this node"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - // Ok, this is a valid source. Add/Update its interface on the map - interfaceMap[message->source->subsystem] = srcInf; - - if( message->destination->subsystem == mySubsystemId || - message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID) - { - msgRouter->routeSubsystemSourceMessage(message); - return true; - } - else - { - // Error: Somehow I received a message intended for another subsystem - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message received on my Subsystem Interface for another subsystem ID!"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } -} - -bool JausSubsystemCommunicationManager::sendToSubsystemX(JausMessage message) -{ - if(!message) - { - // Error: Invalid message - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage."); - this->eventHandler->handleEvent(e); - return false; - } - - // Route to subsystem X - JausTransportInterface *jtInf = interfaceMap[message->destination->subsystem]; - if(jtInf) - { - jtInf->queueJausMessage(message); - return true; - } - else - { - // I don't know how to send to Subsystem X - jausMessageDestroy(message); - return false; - } -} - -bool JausSubsystemCommunicationManager::sendToAllInterfaces(JausMessage message) -{ - std::vector ::iterator iter; - - if(!message) - { - // Error: Invalid message - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage."); - this->eventHandler->handleEvent(e); - return false; - } - - for(iter = interfaces.begin(); iter != interfaces.end(); iter++) - { - (*iter)->queueJausMessage(jausMessageClone(message)); - } - jausMessageDestroy(message); - return true; -} diff --git a/lib/openjaus/libopenJaus/src/nodeManager/JausTransportInterface.cpp b/lib/openjaus/libopenJaus/src/nodeManager/JausTransportInterface.cpp deleted file mode 100644 index 7d17b8e414b228f5fcc2874471d2af30647fbd6a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/JausTransportInterface.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausTransportInterface.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines a JausTransportInterface.cpp class. - -#include "nodeManager/JausTransportInterface.h" -#include "nodeManager/JausCommunicationManager.h" - -JausTransportInterface::JausTransportInterface(void) -{ - this->running = false; -} - -JausTransportInterface::~JausTransportInterface(void) {} - -std::string JausTransportInterface::getName() -{ - return this->name; -} - -JausCommunicationManager *JausTransportInterface::getCommunicationManager() -{ - return this->commMngr; -} - -void JausTransportInterface::setCommunicationManager(JausCommunicationManager *commMngr) -{ - this->commMngr = commMngr; -} - -bool JausTransportInterface::isRunning() -{ - return this->running; -} - -void JausTransportInterface::stopThread() -{ - wakeThread(); - pthread_join(this->pThread, NULL); - this->queue.emptyQueue(); - pthread_mutex_destroy(&this->threadMutex); - pthread_cond_destroy(&this->threadConditional); -} - -void JausTransportInterface::startThread() -{ - int retVal; - char errorString[128] = {0}; - - retVal = pthread_cond_init(&this->threadConditional, NULL); - if(retVal != 0) - { - sprintf(errorString, "JausTransportInterface: pthread_cond_init returned error code: %d", retVal); - throw errorString; - } - - retVal = pthread_mutex_init(&this->threadMutex, NULL); - if(retVal != 0) - { - sprintf(errorString, "JausTransportInterface: pthread_mutex_init returned error code: %d", retVal); - throw errorString; - } - - retVal = pthread_attr_init(&this->threadAttributes); - if(retVal != 0) - { - sprintf(errorString, "JausTransportInterface: pthread_attr_init returned error code: %d", retVal); - throw errorString; - } - - retVal = pthread_attr_setdetachstate(&this->threadAttributes, PTHREAD_CREATE_JOINABLE); - if(retVal != 0) - { - sprintf(errorString, "JausTransportInterface: pthread_attr_setdetachstate returned error code: %d", retVal); - throw errorString; - } - - retVal = pthread_create(&this->pThread, &this->threadAttributes, ThreadRun, this); - if(retVal != 0) - { - sprintf(errorString, "JausTransportInterface: pthread_attr_destroy returned error code: %d", retVal); - throw errorString; - } - - retVal = pthread_attr_destroy(&this->threadAttributes); - if(retVal != 0) - { - sprintf(errorString, "JausTransportInterface: pthread_attr_destroy returned error code: %d", retVal); - throw errorString; - } -} - -JausTransportType JausTransportInterface::getType(void) -{ - return this->type; -} - -unsigned long JausTransportInterface::queueSize() -{ - return this->queue.size(); -} - -void JausTransportInterface::queueJausMessage(JausMessage message) -{ - if(this->running) - { - this->queue.push(message); - wakeThread(); - } - else - { - jausMessageDestroy(message); - } -} - -void JausTransportInterface::wakeThread() -{ - pthread_cond_signal(&this->threadConditional); -} - -void *ThreadRun(void *obj) -{ - JausTransportInterface *jtInterface = (JausTransportInterface *)obj; - jtInterface->run(); - return NULL; -} - diff --git a/lib/openjaus/libopenJaus/src/nodeManager/JausTransportQueue.cpp b/lib/openjaus/libopenJaus/src/nodeManager/JausTransportQueue.cpp deleted file mode 100644 index 42c4f7fae4e14ac6c9c52e7bde2435be2de44405..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/JausTransportQueue.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausTransportQueue.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: Provides a FIFO queue for JausTransportPackets. Supports monitoring. - -#include "nodeManager/JausTransportQueue.h" -#include "nodeManager/JausTransportInterface.h" -#include "nodeManager/JausCommunicationManager.h" - -JausTransportQueue::JausTransportQueue(void) -{ - pthread_mutex_init(&mutex, NULL); -} - -JausTransportQueue::~JausTransportQueue(void) -{ - //list.~queue(); - pthread_mutex_destroy(&mutex); -} - -void JausTransportQueue::emptyQueue(void) -{ - pthread_mutex_lock(&mutex); - while(!list.empty()) - { - JausMessage out = list.front(); - list.pop(); - jausMessageDestroy(out); - } - - pthread_mutex_unlock(&mutex); -} - -void JausTransportQueue::push(JausMessage inc) -{ - pthread_mutex_lock(&mutex); - list.push(inc); - pthread_mutex_unlock(&mutex); -} - -JausMessage JausTransportQueue::pop(void) -{ - pthread_mutex_lock(&mutex); - if(!list.empty()) - { - JausMessage out = list.front(); - list.pop(); - - pthread_mutex_unlock(&mutex); - return out; - } - - pthread_mutex_unlock(&mutex); - return NULL; - -} - -bool JausTransportQueue::isEmpty(void) -{ - return list.empty(); -} - -unsigned long JausTransportQueue::size() -{ - return (unsigned long)list.size(); -} - diff --git a/lib/openjaus/libopenJaus/src/nodeManager/JudpInterface.cpp b/lib/openjaus/libopenJaus/src/nodeManager/JudpInterface.cpp deleted file mode 100644 index aad6a9aafcf60c4e901e63a8a2a35e2e7697fdbc..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/JudpInterface.cpp +++ /dev/null @@ -1,969 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JudpInterface.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: Defines the standard JAUS UDP interface on port 3792. Is compliant with the -// ETG/OPC style of UDP header - -#include "nodeManager/JudpInterface.h" -#include "nodeManager/JausSubsystemCommunicationManager.h" -#include "nodeManager/JausNodeCommunicationManager.h" -#include "nodeManager/JausComponentCommunicationManager.h" -#include "nodeManager/events/ErrorEvent.h" -#include "nodeManager/events/JausMessageEvent.h" - -JudpInterface::JudpInterface(FileLoader *configData, EventHandler *handler, JausCommunicationManager *commMngr) -{ - this->commMngr = commMngr; - this->eventHandler = handler; - this->name = JUDP_NAME; - this->configData = configData; - this->multicast = false; - this->subsystemGatewayDiscovered = false; - - // Determine the type of our commMngr - if(dynamic_cast(this->commMngr)) - { - this->type = SUBSYSTEM_INTERFACE; - } - else if(dynamic_cast(this->commMngr)) - { - this->type = NODE_INTERFACE; - } - else if(dynamic_cast(this->commMngr)) - { - this->type = COMPONENT_INTERFACE; - } - else - { - this->type = UNKNOWN_INTERFACE; - } - - - // NOTE: This value should exist in the properties file and should be checked - // in the NodeManager class prior to constructing this object - mySubsystemId = configData->GetConfigDataInt("JAUS", "SubsystemId"); - if(mySubsystemId < JAUS_MINIMUM_SUBSYSTEM_ID || mySubsystemId > JAUS_MAXIMUM_SUBSYSTEM_ID) - { - // Invalid ID - // TODO: Throw an exception? Log an error. - mySubsystemId = JAUS_INVALID_SUBSYSTEM_ID; - return; - } - - // Setup our UDP Socket - if(!this->openSocket()) - { - throw "JudpInterface: Could not open socket\n"; - } -} - -bool JudpInterface::startInterface(void) -{ - // Set our thread running flag - this->running = true; - - // Setup our pThread - this->startThread(); - - // Setup our receiveThread - this->startRecvThread(); - - return true; -} - -bool JudpInterface::stopInterface(void) -{ - this->running = false; - - // Stop our pThread - this->stopThread(); - - // Stop our receiveThread - this->stopRecvThread(); - - return true; -} - -JudpInterface::~JudpInterface(void) -{ - if(running) - { - this->stopInterface(); - } - this->closeSocket(); - - // TODO: Check our threadIds to see if they terminated properly -} - -InetAddress JudpInterface::getInetAddress(void) -{ - return this->socket->address; -} - -bool JudpInterface::processMessage(JausMessage message) -{ - switch(this->type) - { - case SUBSYSTEM_INTERFACE: - // if subs==BROADCAST send multicast - if(message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID) - { - if(this->multicast) - { - // Send multicast packet - sendJausMessage(this->multicastData, message); - jausMessageDestroy(message); - return true; - } - else - { - // Unicast to all known subsystems - HASH_MAP::iterator iter; - for(iter = addressMap.begin(); iter != addressMap.end(); iter++) - { - sendJausMessage(iter->second, message); - } - jausMessageDestroy(message); - return true; - } - } - else - { - // Unicast - if(addressMap.find(message->destination->subsystem) != addressMap.end()) - { - sendJausMessage(addressMap.find(message->destination->subsystem)->second, message); - jausMessageDestroy(message); - return true; - } - else - { - // Don't know how to send this message - jausMessageDestroy(message); - return false; - } - } - break; - - case NODE_INTERFACE: - if( message->destination->subsystem == mySubsystemId || - message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID ) - { - // if node==BROADCAST send multicast - if(message->destination->node == JAUS_BROADCAST_NODE_ID) - { - if(this->multicast) - { - // Send multicast packet - sendJausMessage(this->multicastData, message); - jausMessageDestroy(message); - return true; - } - else - { - // Unicast to all known nodes - HASH_MAP::iterator iter; - for(iter = addressMap.begin(); iter != addressMap.end(); iter++) - { - sendJausMessage(iter->second, message); - } - jausMessageDestroy(message); - return true; - } - } - else - { - // Unicast - if(addressMap.find(message->destination->node) != addressMap.end()) - { - sendJausMessage(addressMap.find(message->destination->node)->second, message); - jausMessageDestroy(message); - return true; - } - else - { - // Don't know how to send this message - jausMessageDestroy(message); - return false; - } - } - } - else - { - // Message for other subsystem - if(subsystemGatewayDiscovered) - { - sendJausMessage(subsystemGatewayData, message); - jausMessageDestroy(message); - return true; - } - else - { - // Don't know how to send this message - jausMessageDestroy(message); - return false; - } - } - break; - - case COMPONENT_INTERFACE: - // if cmpt == BROADCAST || inst == BROADCAST send unicast to all components - if( message->destination->component == JAUS_BROADCAST_COMPONENT_ID || - message->destination->instance == JAUS_BROADCAST_INSTANCE_ID ) - { - if(this->multicast) - { - // Send multicast packet - sendJausMessage(this->multicastData, message); - jausMessageDestroy(message); - return true; - } - else - { - // Unicast to all known subsystems - HASH_MAP::iterator iter; - for(iter = addressMap.begin(); iter != addressMap.end(); iter++) - { - sendJausMessage(iter->second, message); - } - jausMessageDestroy(message); - return true; - } - } - else - { - // Unicast - if(addressMap.find(jausAddressHash(message->destination)) != addressMap.end()) - { - sendJausMessage(addressMap.find(jausAddressHash(message->destination))->second, message); - jausMessageDestroy(message); - return true; - } - else - { - // Don't know how to send this message - jausMessageDestroy(message); - return false; - } - } - break; - - default: - // Unknown type - // No routing behavior - jausMessageDestroy(message); - return false; - } -} - -void JudpInterface::run() -{ - // Lock our mutex - pthread_mutex_lock(&threadMutex); - - while(this->running) - { - pthread_cond_wait(&threadConditional, &threadMutex); - - while(!this->queue.isEmpty()) - { - // Pop a packet off the queue and send it off - processMessage(queue.pop()); - } - } - pthread_mutex_unlock(&threadMutex); -} - -std::string JudpInterface::toString() -{ - char ret[256] = {0}; - char buf[80] = {0}; - if(this->socket) - { - inetAddressToBuffer(this->socket->address, buf, 80); - sprintf(ret, "%s %s:%d", JUDP_NAME, buf, this->socket->port); - return ret; - } - else - { - sprintf(ret, "%s Invalid.", JUDP_NAME); - return ret; - } -} - -bool JudpInterface::openSocket(void) -{ - double socketTimeoutSec = 0; - unsigned char socketTTL = 0; - std::string multicastGroupString; - - switch(this->type) - { - case SUBSYSTEM_INTERFACE: - // Read Subsystem UDP Parameters - // Port is constant per JAUS Standard - this->portNumber = JUDP_DATA_PORT; - - // IP Address - if(this->configData->GetConfigDataString("Subsystem_Communications", "JUDP_IP_Address") == "") - { - // Cannot open specified IP Address - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, "No IP Address specified!"); - this->eventHandler->handleEvent(e); - return false; - } - else - { - this->ipAddress = inetAddressGetByString((char *)this->configData->GetConfigDataString("Subsystem_Communications", "JUDP_IP_Address").c_str()); - if(this->ipAddress == NULL) - { - // Cannot open specified IP Address - char errorString[128] = {0}; - sprintf(errorString, "Could not open specified IP Address: %s", this->configData->GetConfigDataString("Subsystem_Communications", "JUDP_IP_Address").c_str()); - - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return false; - } - } - - // Timeout - if(this->configData->GetConfigDataString("Subsystem_Communications", "JUDP_Timeout_Sec") == "") - { - socketTimeoutSec = JUDP_DEFAULT_SUBSYSTEM_UDP_TIMEOUT_SEC; - } - else - { - socketTimeoutSec = this->configData->GetConfigDataDouble("Subsystem_Communications", "JUDP_Timeout_Sec"); - } - - // TTL - if(this->configData->GetConfigDataString("Subsystem_Communications", "JUDP_TTL") == "") - { - socketTTL = JUDP_DEFAULT_SUBSYSTEM_TTL; - } - else - { - socketTTL = this->configData->GetConfigDataInt("Subsystem_Communications", "JUDP_TTL"); - } - - // Multicast - if(this->configData->GetConfigDataString("Subsystem_Communications", "JUDP_Multicast") == "") - { - this->multicast = JUDP_DEFAULT_SUBSYSTEM_MULTICAST; - } - else - { - this->multicast = this->configData->GetConfigDataBool("Subsystem_Communications", "JUDP_Multicast"); - } - - if(this->multicast) - { - // Multicast Group - if(this->configData->GetConfigDataString("Subsystem_Communications", "JUDP_Multicast_Group") == "") - { - multicastGroupString = JUDP_DEFAULT_SUBSYSTEM_MULTICAST_GROUP; - } - else - { - multicastGroupString = this->configData->GetConfigDataString("Subsystem_Communications", "JUDP_Multicast_Group"); - } - } - - // Header Compression - if(this->configData->GetConfigDataString("Subsystem_Communications", "JUDP_Header_Compression") == "") - { - this->supportHeaderCompression = JUDP_DEFAULT_SUBSYSTEM_HEADER_COMPRESSION; - } - else - { - this->supportHeaderCompression = this->configData->GetConfigDataBool("Subsystem_Communications", "JUDP_Header_Compression"); - } - break; - - case NODE_INTERFACE: - // Setup Node Configuration - // Port is constant per JAUS Standard - this->portNumber = JUDP_DATA_PORT; - - // IP Address - if(this->configData->GetConfigDataString("Node_Communications", "JUDP_IP_Address") == "") - { - // Cannot open specified IP Address - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, "No IP Address specified!"); - this->eventHandler->handleEvent(e); - return false; - } - else - { - this->ipAddress = inetAddressGetByString((char *)this->configData->GetConfigDataString("Node_Communications", "JUDP_IP_Address").c_str()); - if(this->ipAddress == NULL) - { - // Cannot open specified IP Address - char errorString[128] = {0}; - sprintf(errorString, "Could not open specified IP Address: %s", this->configData->GetConfigDataString("Node_Communications", "JUDP_IP_Address").c_str()); - - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return false; - } - } - - // Timeout - if(this->configData->GetConfigDataString("Node_Communications", "JUDP_Timeout_Sec") == "") - { - socketTimeoutSec = JUDP_DEFAULT_NODE_UDP_TIMEOUT_SEC; - } - else - { - socketTimeoutSec = this->configData->GetConfigDataDouble("Node_Communications", "JUDP_Timeout_Sec"); - } - - // TTL - if(this->configData->GetConfigDataString("Node_Communications", "JUDP_TTL") == "") - { - socketTTL = JUDP_DEFAULT_NODE_TTL; - } - else - { - socketTTL = this->configData->GetConfigDataInt("Node_Communications", "JUDP_TTL"); - } - - // Multicast - if(this->configData->GetConfigDataString("Node_Communications", "JUDP_Multicast") == "") - { - this->multicast = JUDP_DEFAULT_NODE_MULTICAST; - } - else - { - this->multicast = this->configData->GetConfigDataBool("Node_Communications", "JUDP_Multicast"); - } - - if(this->multicast) - { - // Multicast Group - if(this->configData->GetConfigDataString("Node_Communications", "JUDP_Multicast_Group") == "") - { - multicastGroupString = JUDP_DEFAULT_NODE_MULTICAST_GROUP; - } - else - { - multicastGroupString = this->configData->GetConfigDataString("Node_Communications", "JUDP_Multicast_Group"); - } - } - - // Header Compression - if(this->configData->GetConfigDataString("Node_Communications", "JUDP_Header_Compression") == "") - { - this->supportHeaderCompression = JUDP_DEFAULT_NODE_HEADER_COMPRESSION; - } - else - { - this->supportHeaderCompression = this->configData->GetConfigDataBool("Node_Communications", "JUDP_Header_Compression"); - } - break; - - case COMPONENT_INTERFACE: - // Read Component Configuration - // Port Number - if(this->configData->GetConfigDataString("Component_Communications", "JUDP_Port") == "") - { - this->portNumber = JUDP_DEFAULT_COMPONENT_UDP_PORT; - } - else - { - this->portNumber = this->configData->GetConfigDataInt("Component_Communications", "JUDP_Port"); - } - - // IP Address - if(this->configData->GetConfigDataString("Component_Communications", "JUDP_IP_Address") == "") - { - this->ipAddress = inetAddressGetByString((char *)JUDP_DEFAULT_COMPONENT_IP.c_str()); - if(this->ipAddress == NULL) - { - // Cannot open specified IP Address - char errorString[128] = {0}; - sprintf(errorString, "Could not open default IP Address: %s", JUDP_DEFAULT_COMPONENT_IP.c_str()); - - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return false; - } - } - else - { - this->ipAddress = inetAddressGetByString((char *)this->configData->GetConfigDataString("Component_Communications", "JUDP_IP_Address").c_str()); - if(this->ipAddress == NULL) - { - // Cannot open specified IP Address - char errorString[128] = {0}; - sprintf(errorString, "Could not open specified IP Address: %s", this->configData->GetConfigDataString("Component_Communications", "JUDP_IP_Address").c_str()); - - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return false; - } - } - - // Timeout - if(this->configData->GetConfigDataString("Component_Communications", "JUDP_Timeout_Sec") == "") - { - socketTimeoutSec = JUDP_DEFAULT_COMPONENT_UDP_TIMEOUT_SEC; - } - else - { - socketTimeoutSec = this->configData->GetConfigDataDouble("Component_Communications", "JUDP_Timeout_Sec"); - } - - // TTL - if(this->configData->GetConfigDataString("Component_Communications", "JUDP_TTL") == "") - { - socketTTL = JUDP_DEFAULT_COMPONENT_TTL; - } - else - { - socketTTL = this->configData->GetConfigDataInt("Component_Communications", "JUDP_TTL"); - } - - // Multicast - if(this->configData->GetConfigDataString("Component_Communications", "JUDP_Multicast") == "") - { - this->multicast = JUDP_DEFAULT_COMPONENT_MULTICAST; - } - else - { - this->multicast = this->configData->GetConfigDataBool("Component_Communications", "JUDP_Multicast"); - } - - if(this->multicast) - { - // Multicast Group - if(this->configData->GetConfigDataString("Component_Communications", "JUDP_Multicast_Group") == "") - { - // Error. Component has no default Multicast group. - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, "No default Component Multicast Group and none defined."); - this->eventHandler->handleEvent(e); - - inetAddressDestroy(this->ipAddress); - return false; - } - else - { - multicastGroupString = this->configData->GetConfigDataString("Component_Communications", "JUDP_Multicast_Group"); - } - } - - // Header Compression - // No header compression for Component Interfaces - this->supportHeaderCompression = false; - break; - - default: - // Unknown type - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, "Unknown JudpInterface type. Cannot open socket."); - this->eventHandler->handleEvent(e); - return false; - } - - // Create Socket - this->socket = multicastSocketCreate(this->portNumber, ipAddress); - if(!this->socket) - { - // Error creating our socket - char errorString[128] = {0}; - char buf[24] = {0}; - - inetAddressToBuffer(this->ipAddress, buf, 24); - sprintf(errorString, "Could not open socket: %s:%d", buf, this->portNumber); - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - - inetAddressDestroy(this->ipAddress); - return false; - } - else - { - this->ipAddress->value = socket->address->value; - this->portNumber = socket->port; - } - inetAddressDestroy(this->ipAddress); - - // Setup Timeout - multicastSocketSetTimeout(this->socket, socketTimeoutSec); - - // Setup TTL - multicastSocketSetTTL(this->socket, socketTTL); - - // Setup Multicast - if(this->multicast) - { - this->multicastGroup = inetAddressGetByString((char *)multicastGroupString.c_str()); - if(multicastSocketJoinGroup(this->socket, this->multicastGroup) != 0) - { - // Error joining our group - char errorString[128] = {0}; - char buf[24] = {0}; - - inetAddressToString(this->multicastGroup, buf); - sprintf(errorString, "Could not open socket: %s:%d", buf, this->portNumber); - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return false; - } - - // Setup Loopback - multicastSocketSetLoopback(this->socket, LOOPBACK_DISABLED); - - // Setup Multicast UdpData - multicastData.addressValue = multicastGroup->value; - multicastData.port = this->socket->port; - - inetAddressDestroy(this->multicastGroup); - } - - return true; -} - -void JudpInterface::sendJausMessage(JudpTransportData data, JausMessage message) -{ - DatagramPacket packet = NULL; - int result; - - switch(this->type) - { - case SUBSYSTEM_INTERFACE: - case NODE_INTERFACE: - if(this->supportHeaderCompression) - { - sendCompressedMessage(data, message); - } - else - { - sendUncompressedMessage(data, message); - } - return; - - case COMPONENT_INTERFACE: - // Sends a JAUS Message with no transport header - packet = datagramPacketCreate(); - packet->bufferSizeBytes = (int) jausMessageSize(message); - packet->buffer = (unsigned char *) calloc(packet->bufferSizeBytes, 1); - packet->port = data.port; - packet->address->value = data.addressValue; - - if(jausMessageToBuffer(message, packet->buffer, packet->bufferSizeBytes)) - { - result = multicastSocketSend(this->socket, packet); - } - - free(packet->buffer); - datagramPacketDestroy(packet); - return; - - default: - char errorString[128] = {0}; - sprintf(errorString, "Unknown socket type %d\n", this->type); - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return; - } -} - -void JudpInterface::closeSocket(void) -{ - multicastSocketDestroy(this->socket); -} - -void JudpInterface::startRecvThread() -{ - pthread_attr_init(&this->recvThreadAttr); - pthread_attr_setdetachstate(&this->recvThreadAttr, PTHREAD_CREATE_JOINABLE); - this->recvThreadId = pthread_create(&this->recvThread, &this->recvThreadAttr, JudpRecvThread, this); - pthread_attr_destroy(&this->recvThreadAttr); -} - -void JudpInterface::stopRecvThread() -{ - pthread_join(this->recvThread, NULL); -} - -void JudpInterface::recvThreadRun() -{ - DatagramPacket packet; - JausMessage rxMessage; - JudpTransportData data; - int index = 0; - long bytesRecv = 0; - int bytesUnpacked = 0; - unsigned int bufferIndex = 0; - JudpHeaderCompressionData hcData; - - packet = datagramPacketCreate(); - packet->bufferSizeBytes = JUDP_MAX_PACKET_SIZE; - packet->buffer = (unsigned char *) calloc(packet->bufferSizeBytes, 1); - - while(this->running) - { - index = 0; - bytesRecv = multicastSocketReceive(this->socket, packet); - - if(bytesRecv > 0) - { - bufferIndex = 0; - if(packet->buffer[0] != JUDP_VERSION_NUMBER) - { - // Error, wrong JUDP version inbound - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Invalid JUDP version number in received message"); - this->eventHandler->handleEvent(e); - continue; - } - bufferIndex += 1; - - bytesUnpacked = this->headerCompressionDataFromBuffer(&hcData, packet->buffer + bufferIndex, packet->bufferSizeBytes - bufferIndex); - if(bytesUnpacked == 0) - { - // Error unpacking headerCompressionData (it creates an error event, doing so here would be redundant) - continue; - } - bufferIndex += bytesUnpacked; - - rxMessage = jausMessageCreate(); - if(hcData.flags == JUDP_HC_NO_COMPRESSION) - { - if(!receiveUncompressedMessage(rxMessage, packet->buffer + bufferIndex, packet->bufferSizeBytes - bufferIndex)) - { - // Error receiving message - jausMessageDestroy(rxMessage); - continue; - } - } - else - { - if(!receiveCompressedMessage(rxMessage, &hcData, packet->buffer + bufferIndex, packet->bufferSizeBytes - bufferIndex)) - { - // Error receiving message - jausMessageDestroy(rxMessage); - continue; - } - } - - // Add to transportMap - switch(this->type) - { - case SUBSYSTEM_INTERFACE: - data.addressValue = packet->address->value; - data.port = JUDP_DATA_PORT; - this->addressMap[rxMessage->source->subsystem] = data; - break; - - case NODE_INTERFACE: - data.addressValue = packet->address->value; - data.port = JUDP_DATA_PORT; - if(rxMessage->source->subsystem == mySubsystemId) - { - this->addressMap[rxMessage->source->node] = data; - } - else - { - this->subsystemGatewayData = data; - this->subsystemGatewayDiscovered = true; - } - break; - - case COMPONENT_INTERFACE: - data.addressValue = packet->address->value; - data.port = packet->port; - this->addressMap[jausAddressHash(rxMessage->source)] = data; - break; - - default: - // Unknown type - break; - } - - // Received message Event - JausMessage tempMessage = jausMessageClone(rxMessage); - JausMessageEvent *e = new JausMessageEvent(tempMessage, this, JausMessageEvent::Inbound); - this->eventHandler->handleEvent(e); - - // Send to Communications manager - this->commMngr->receiveJausMessage(rxMessage, this); - } - } - - free(packet->buffer); - datagramPacketDestroy(packet); -} - -void JudpInterface::sendCompressedMessage(JudpTransportData data, JausMessage message) -{ - //DatagramPacket packet = NULL; - //int result; - //int bufferIndex = 0; - - //packet = datagramPacketCreate(); - //packet->bufferSizeBytes = (int) jausMessageSize(message) + JUDP_PER_PACKET_HEADER_SIZE_BYTES + JUDP_PER_MESSAGE_HEADER_SIZE_BYTES; - //packet->buffer = (unsigned char *) calloc(packet->bufferSizeBytes, 1); - //packet->port = data.port; - //packet->address->value = data.addressValue; - // - //bufferIndex = 0; - //packet->buffer[0] = JUDP_VERSION_NUMBER; - //bufferIndex += 1; - - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Header Compression not yet supported!"); - this->eventHandler->handleEvent(e); -} - -void JudpInterface::sendUncompressedMessage(JudpTransportData data, JausMessage message) -{ - DatagramPacket packet = NULL; - int result; - int bufferIndex = 0; - unsigned int bytesPacked = 0; - JudpHeaderCompressionData hcData = {0}; - - packet = datagramPacketCreate(); - packet->bufferSizeBytes = (int) jausMessageSize(message) + JUDP_PER_PACKET_HEADER_SIZE_BYTES + JUDP_PER_MESSAGE_HEADER_SIZE_BYTES; - packet->buffer = (unsigned char *) calloc(packet->bufferSizeBytes, 1); - packet->port = data.port; - packet->address->value = data.addressValue; - - bufferIndex = 0; - packet->buffer[0] = JUDP_VERSION_NUMBER; - bufferIndex += 1; - - hcData.flags = JUDP_HC_NO_COMPRESSION; - hcData.headerNumber = 0; - hcData.length = 0; - hcData.messageLength = message->dataSize + JAUS_HEADER_SIZE_BYTES; - bytesPacked += headerCompressionDataToBuffer(&hcData, packet->buffer+bufferIndex, packet->bufferSizeBytes - bufferIndex); - if(bytesPacked == 0) - { - free(packet->buffer); - datagramPacketDestroy(packet); - return; - } - bufferIndex += bytesPacked; - - if(jausMessageToBuffer(message, packet->buffer + bufferIndex, packet->bufferSizeBytes - bufferIndex)) - { - result = multicastSocketSend(this->socket, packet); - JausMessage tempMessage = jausMessageClone(message); - JausMessageEvent *e = new JausMessageEvent(tempMessage, this, JausMessageEvent::Outbound); - this->eventHandler->handleEvent(e); - } - - free(packet->buffer); - datagramPacketDestroy(packet); -} - - -bool JudpInterface::receiveUncompressedMessage(JausMessage rxMessage, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - return jausMessageFromBuffer(rxMessage, buffer, bufferSizeBytes)? true : false; -} - -bool JudpInterface::receiveCompressedMessage(JausMessage rxMessage, JudpHeaderCompressionData *hcData, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - ErrorEvent *e; - - switch(hcData->flags) - { - case JUDP_HC_ENGAGE_COMPRESSION: - // No support for Header Compression, but we can still receive these messages - return jausMessageFromBuffer(rxMessage, buffer, bufferSizeBytes)? true : false; - - case JUDP_HC_COMPRESSION_ACKNOWLEDGE: - case JUDP_HC_COMPRESSED_MESSAGE: - e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Header Compression not yet supported!"); - this->eventHandler->handleEvent(e); - return false; - - default: - e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Unknown Header Compression Flag!"); - this->eventHandler->handleEvent(e); - return false; - } -} - -unsigned int JudpInterface::headerCompressionDataToBuffer(JudpHeaderCompressionData *hcData, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JUDP_PER_MESSAGE_HEADER_SIZE_BYTES) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Insufficient Size for Per Message Header"); - this->eventHandler->handleEvent(e); - return 0; - } - - buffer[0] = (unsigned char) (hcData->headerNumber); - buffer[1] = (unsigned char) (((hcData->length & 0x3F) << 6) | (hcData->flags & 0x03)); - - // NOTE: The messageLength member is BIG ENDIAN, this is different for other JAUS messages - buffer[2] = (unsigned char) ((hcData->messageLength & 0xFF00) >> 8); - buffer[3] = (unsigned char) (hcData->messageLength & 0xFF); - - return JUDP_PER_MESSAGE_HEADER_SIZE_BYTES; -} - -unsigned int JudpInterface::headerCompressionDataFromBuffer(JudpHeaderCompressionData *hcData, unsigned char *buffer, unsigned int bufferSizeBytes) -{ - if(bufferSizeBytes < JUDP_PER_MESSAGE_HEADER_SIZE_BYTES) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Insufficient Size for Per Message Header"); - this->eventHandler->handleEvent(e); - return 0; - } - - hcData->headerNumber = buffer[0]; - hcData->length = (buffer[1] >> 2) & 0x3F; - hcData->flags = (buffer[1] & 0x03); - hcData->messageLength = buffer[3] + (buffer[2] << 8); - - return JUDP_PER_MESSAGE_HEADER_SIZE_BYTES; -} - -void *JudpRecvThread(void *obj) -{ - JudpInterface *judpInterface = (JudpInterface *)obj; - judpInterface->recvThreadRun(); - return NULL; -} diff --git a/lib/openjaus/libopenJaus/src/nodeManager/LocalComponent.cpp b/lib/openjaus/libopenJaus/src/nodeManager/LocalComponent.cpp deleted file mode 100644 index 3600cc5f66e99a0274c1b0ddae8b9cc556a0ba76..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/LocalComponent.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: LocalComponent.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: Defines the common fuctionality of local components. -// Used by the NodeManagerComponent and CommunicatorComponent classes. - -#include "nodeManager/LocalComponent.h" -#include "utils/timeval.h" - -void LocalComponent::run() -{ - struct timespec timeout; - struct timeval now; - - if(!this->cmpt) - { - // ERROR: This cannot be called if we haven't yet constructed our component - // TODO: Throw an exception? Log an error. - return; - } - - this->startupState(); - this->cmpt->state = JAUS_INITIALIZE_STATE; - - // Lock our mutex - pthread_mutex_lock(&this->threadMutex); - - // prepare new timeout value. - // Note that we need an absolute time. - gettimeofday(&now, NULL); - timeout.tv_sec = now.tv_sec; - - // timeval uses micro-seconds. - // timespec uses nano-seconds. - // 1 micro-second = 1000 nano-seconds. - timeout.tv_nsec = (now.tv_usec * 1000) + (long)(1e9 / this->cmptRateHz); - - while(this->running) - { - while(timeout.tv_nsec > 1e9) - { - timeout.tv_nsec -= (long)1e9; - timeout.tv_sec++; - } - - int rc = pthread_cond_timedwait(&this->threadConditional, &this->threadMutex, &timeout); - switch(rc) - { - case 0: // Conditional Signal - // Check the send queue - while(!this->queue.isEmpty()) - { - // Pop a packet off the queue and send it off - processMessage(queue.pop()); - - // Check if we need to run our state thread! - gettimeofday(&now, NULL); - if( now.tv_sec > timeout.tv_sec || (now.tv_usec*1000) > timeout.tv_nsec) - { - break; - } - } - break; - - case ETIMEDOUT: // our time is up - // Capture time now, that way we get a constant deltaTime from beginning to beginning - gettimeofday(&now, NULL); - - switch(cmpt->state) - { - case JAUS_INITIALIZE_STATE: - intializeState(); - break; - - case JAUS_STANDBY_STATE: - standbyState(); - break; - - case JAUS_READY_STATE: - readyState(); - break; - - case JAUS_EMERGENCY_STATE: - emergencyState(); - break; - - case JAUS_FAILURE_STATE: - failureState(); - break; - - default: - //do nothing - break; - } - allState(); - - // prepare new timeout value. - // Note that we need an absolute time. - timeout.tv_sec = now.tv_sec; - - // timeval uses micro-seconds. - // timespec uses nano-seconds. - // 1 micro-second = 1000 nano-seconds. - timeout.tv_nsec = (now.tv_usec * 1000) + (long)(1e9 / this->cmptRateHz); - - while(!this->queue.isEmpty()) - { - // Pop a packet off the queue and send it off - processMessage(queue.pop()); - - // Check if we need to run our state thread! - gettimeofday(&now, NULL); - if( now.tv_sec > timeout.tv_sec || (now.tv_usec*1000) > timeout.tv_nsec) - { - break; - } - } - break; - - default: - // Some other error occured - // TODO: Log error. - gettimeofday(&now, NULL); - - // prepare new timeout value. - // Note that we need an absolute time. - timeout.tv_sec = now.tv_sec; - - // timeval uses micro-seconds. - // timespec uses nano-seconds. - // 1 micro-second = 1000 nano-seconds. - timeout.tv_nsec = (now.tv_usec * 1000) + (long)(1e9 / this->cmptRateHz); - break; - } - } - - while(!this->queue.isEmpty()) - { - // Pop a packet off the queue and send it off - processMessage(queue.pop()); - } - - pthread_mutex_unlock(&this->threadMutex); - - shutdownState(); -} - diff --git a/lib/openjaus/libopenJaus/src/nodeManager/MessageRouter.cpp b/lib/openjaus/libopenJaus/src/nodeManager/MessageRouter.cpp deleted file mode 100644 index 8ca97f2d37fafb356e502ec42f41b73d2314c3d9..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/MessageRouter.cpp +++ /dev/null @@ -1,395 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: MessageRouter.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) and Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: Defines the functionality of the message routing service. -// This behavior is consistent with tables developed by D. Kent and T. Galluzzo - -#include "nodeManager/MessageRouter.h" -#include "nodeManager/JausSubsystemCommunicationManager.h" -#include "nodeManager/JausNodeCommunicationManager.h" -#include "nodeManager/JausComponentCommunicationManager.h" -#include "nodeManager/events/ErrorEvent.h" - -MessageRouter::MessageRouter(FileLoader *configData, SystemTree *sysTree, EventHandler *handler) -{ - this->systemTree = sysTree; - this->configData = configData; - this->eventHandler = handler; - - // NOTE: These two values should exist in the properties file and should be checked - // in the NodeManager class prior to constructing this object - mySubsystemId = configData->GetConfigDataInt("JAUS", "SubsystemId"); - if(mySubsystemId < JAUS_MINIMUM_SUBSYSTEM_ID || mySubsystemId > JAUS_MAXIMUM_SUBSYSTEM_ID) - { - // Invalid ID - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, "Invalid Subsystem Id"); - this->eventHandler->handleEvent(e); - mySubsystemId = JAUS_INVALID_SUBSYSTEM_ID; - return; - } - - myNodeId = configData->GetConfigDataInt("JAUS", "NodeId"); - if(myNodeId < JAUS_MINIMUM_NODE_ID || myNodeId > JAUS_MAXIMUM_NODE_ID) - { - // Invalid ID - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, "Invalid Node Id"); - this->eventHandler->handleEvent(e); - myNodeId= JAUS_INVALID_NODE_ID; - return; - } - - this->subsComms = new JausSubsystemCommunicationManager(configData, this, systemTree, handler); - - try - { - this->nodeComms = new JausNodeCommunicationManager(configData, this, systemTree, handler); - } - catch(...) - { - delete this->subsComms; - throw; - } - - try - { - this->cmptComms = new JausComponentCommunicationManager(configData, this, systemTree, handler); - } - catch(...) - { - delete this->subsComms; - delete this->nodeComms; - throw; - } - - this->subsComms->startInterfaces(); - this->nodeComms->startInterfaces(); - this->cmptComms->startInterfaces(); -} - -MessageRouter::~MessageRouter(void) -{ - this->cmptComms->stopInterfaces(); - this->nodeComms->stopInterfaces(); - this->subsComms->stopInterfaces(); - - delete subsComms; - delete nodeComms; - delete cmptComms; -} - -bool MessageRouter::routeSubsystemSourceMessage(JausMessage message) -{ - // This complies with the MessageRouter Subsystem Source Table v2.0 - if(!message) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage"); - this->eventHandler->handleEvent(e); - return false; - } - - if(message->source->subsystem == mySubsystemId) - { - // ERROR: Message from this subsystem has entered the subsystemSource method - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message from this Subsystem has entered the SubsystemSource method."); - this->eventHandler->handleEvent(e); - - jausMessageDestroy(message); - return false; - } - - if( message->destination->subsystem != mySubsystemId && - message->destination->subsystem != JAUS_BROADCAST_SUBSYSTEM_ID) - { - // ERROR: Message not for this Subsystem has entered the subsystemSource method - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message not for this Subsystem has entered the SubsystemSource method."); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - if(message->destination->node == JAUS_BROADCAST_NODE_ID) - { - // Have to clone the JausMessage b/c I am sending it in two directions - nodeComms->sendJausMessage(jausMessageClone(message)); - cmptComms->sendJausMessage(message); - return true; - } - else if(message->destination->node == myNodeId) - { - cmptComms->sendJausMessage(message); - return true; - } - else - { - nodeComms->sendJausMessage(message); - return true; - } - return true; -} - -bool MessageRouter::routeNodeSourceMessage(JausMessage message) -{ - // This complies with the MessageRouter Node Source Table v2.0 - if(!message) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage"); - this->eventHandler->handleEvent(e); - return false; - } - - if(message->source->subsystem == mySubsystemId) - { - if(message->source->node == myNodeId) - { - // ERROR: Message from a local component has entered through the nodeSource method - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message from a local component has entered through the NodeSource method"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - else - { - if(message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID) - { - if( message->destination->node == JAUS_BROADCAST_NODE_ID || - message->destination->node == myNodeId) - { - // Send to both subsComms & cmptComms - // Clone on one of them - subsComms->sendJausMessage(jausMessageClone(message)); - cmptComms->sendJausMessage(message); - return true; - } - else - { - subsComms->sendJausMessage(message); - return true; - } - } - else if(message->destination->subsystem == mySubsystemId) - { - if( message->destination->node != myNodeId && - message->destination->node != JAUS_BROADCAST_NODE_ID) - { - // ERROR: Message for another node on this subsystem recv'd through NodeComms - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message for another Node on this Subsystem recv'd through NodeComms"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - else - { - cmptComms->sendJausMessage(message); - return true; - } - } - else - { - subsComms->sendJausMessage(message); - return true; - } - } - } - else //message->source->subsystem != mySubsystemId - { - if( message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID || - message->destination->subsystem == mySubsystemId) - { - if( message->destination->node == JAUS_BROADCAST_NODE_ID || - message->destination->node == myNodeId) - { - cmptComms->sendJausMessage(message); - return true; - } - else - { - // ERROR: Message not for this Node recv'd through nodeComms - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message not for this Node recv'd through NodeComms"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - } - else - { - // ERROR: Message not for this Subs recv'd through nodeComms - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message not for this Subs recv'd through NodeComms"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - } -} - -bool MessageRouter::routeComponentSourceMessage(JausMessage message) -{ - - // This complies with the MessageRouter Component Source Table v2.0 - if(!message) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage"); - this->eventHandler->handleEvent(e); - return false; - } - - //char buf[80] = {0}; - //printf("routeCmptMsg=> "); - //jausAddressToString(message->source, buf); - //printf("Routing %s from %s", jausMessageCommandCodeString(message), buf); - //jausAddressToString(message->destination, buf); - //printf(" to %s\n", buf); - - if(message->source->subsystem != mySubsystemId) - { - // ERROR: Message with a different source subsystem has come in through cmptComms - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message with a different source subsystem has come in through cmptComms"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - if(message->source->node != myNodeId) - { - // ERROR: Message with a different source node has come in through cmptComms - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message with a different source node has come in through cmptComms"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - if(message->destination->subsystem == mySubsystemId) - { - if(message->destination->node == myNodeId) - { - // ERROR: Message for this node has escaped the cmptComms! Should not happen! - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Message for this node has escaped cmptComms"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - else - { - nodeComms->sendJausMessage(message); - return true; - } - } - else - { - sendToCommunicator(message); - return true; - } -} - -bool MessageRouter::sendToCommunicator(JausMessage message) -{ - // This conforms to the routing table in MsgRouter Routing Tables SendToCommunicator v2.0 - if(!message) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage"); - this->eventHandler->handleEvent(e); - return false; - } - - if(message->source->subsystem != mySubsystemId) - { - // ERROR: Messages not from mySubs should not go through this method! - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Messages not from mySubs should not go through this method!"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - if(message->destination->subsystem == mySubsystemId) - { - // ERROR: Messages for mySubs should not go through this method! - ErrorEvent *e = new ErrorEvent(ErrorEvent::Routing, __FUNCTION__, __LINE__, "Messages for mySubs should not go through this method!"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - if(this->subsComms->isEnabled()) - { - if(message->destination->subsystem == JAUS_BROADCAST_SUBSYSTEM_ID) - { - if(message->destination->node == myNodeId) - { - subsComms->sendJausMessage(message); - return true; - } - else - { - // Send to both subsComms & nodeComms - // Clone once - subsComms->sendJausMessage(jausMessageClone(message)); - nodeComms->sendJausMessage(message); - return true; - } - } - else - { - subsComms->sendJausMessage(message); - return true; - } - } - else - { - nodeComms->sendJausMessage(message); - return true; - } -} - -bool MessageRouter::subsystemCommunicationEnabled() -{ - return this->subsComms->isEnabled(); -} - -bool MessageRouter::nodeCommunicationEnabled() -{ - return this->nodeComms->isEnabled(); -} - -bool MessageRouter::componentCommunicationEnabled() -{ - return this->cmptComms->isEnabled(); -} - - diff --git a/lib/openjaus/libopenJaus/src/nodeManager/NodeManager.cpp b/lib/openjaus/libopenJaus/src/nodeManager/NodeManager.cpp deleted file mode 100644 index c990ff81ac1362427579a7eb1a181a0cabd689ac..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/NodeManager.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: NodeManager.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: Wrapper class for the Node Manager as a whole. Provides user interface to create and run a Node Manager. - -#include -#include "nodeManager/NodeManager.h" - - -NodeManager::NodeManager(FileLoader *configData, EventHandler *handler) -{ - this->registerEventHandler(handler); - - // Read subsystem id config - int subsystemId = configData->GetConfigDataInt("JAUS", "SubsystemId"); - if(subsystemId < JAUS_MINIMUM_SUBSYSTEM_ID || subsystemId > JAUS_MAXIMUM_SUBSYSTEM_ID) - { - throw "NodeManager: Config file [JAUS] SubsystemId is invalid\n"; - } - - // Read node id config - int nodeId = configData->GetConfigDataInt("JAUS", "NodeId"); - if(nodeId < JAUS_MINIMUM_NODE_ID || nodeId > JAUS_MAXIMUM_NODE_ID) - { - throw "NodeManager: Config file [JAUS] NodeId is invalid\n"; - } - - // Create this subsystem - this->subsystem = jausSubsystemCreate(); - if(!subsystem) - { - throw "NodeManager: Could not create subsystem\n"; - } - - // Create this node - this->node = jausNodeCreate(); - if(!node) - { - throw "NodeManager: Could not create node\n"; - } - - this->subsystem->id = subsystemId; - size_t identificationLength = strlen(configData->GetConfigDataString("JAUS", "Subsystem_Identification").c_str()) + 1; - this->subsystem->identification = (char *) malloc(identificationLength); - sprintf(this->subsystem->identification, configData->GetConfigDataString("JAUS", "Subsystem_Identification").c_str()); - - this->node->id = nodeId; - identificationLength = strlen(configData->GetConfigDataString("JAUS", "Node_Identification").c_str()) + 1; - this->node->identification = (char *) malloc(identificationLength); - sprintf(this->node->identification, configData->GetConfigDataString("JAUS", "Node_Identification").c_str()); - jausArrayAdd(this->subsystem->nodes, this->node); - - // TODO: Check our config file parameters - - // Initialize our eventHandler list - eventHandlers.empty(); - - // Create our systemTable and add our subsystem - this->systemTree = new SystemTree(configData, this); - this->systemTree->addSubsystem(subsystem); - - // Create our MsgRouter - try - { - this->msgRouter = new MessageRouter(configData, systemTree, this); - } - catch(...) - { - jausSubsystemDestroy(subsystem); - delete systemTree; - throw; - } -} - -NodeManager::~NodeManager(void) -{ - jausSubsystemDestroy(subsystem); - - delete msgRouter; - delete systemTree; -} - -std::string NodeManager::systemTreeToString() -{ - return systemTree->toString(); -} - -std::string NodeManager::systemTreeToDetailedString() -{ - return systemTree->toDetailedString(); -} - -bool NodeManager::registerEventHandler(EventHandler *handler) -{ - if(handler) - { - this->eventHandlers.push_back(handler); - return true; - } - return false; -} - -void NodeManager::handleEvent(NodeManagerEvent *e) -{ - // Send to all registered handlers - std::list ::iterator iter; - for(iter = eventHandlers.begin(); iter != eventHandlers.end(); iter++) - { - (*iter)->handleEvent(e->cloneEvent()); - } - delete e; -} - diff --git a/lib/openjaus/libopenJaus/src/nodeManager/NodeManagerComponent.cpp b/lib/openjaus/libopenJaus/src/nodeManager/NodeManagerComponent.cpp deleted file mode 100644 index 995a6c7e1f11026a8a6a3ccfb0a90802ed8ca6f1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/NodeManagerComponent.cpp +++ /dev/null @@ -1,2292 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: NodeManagerComponent.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the behavior of the Node Manager JAUS Component. -// It is based on the LocalComponent virtual class. - -#include "nodeManager/NodeManagerComponent.h" -#include "nodeManager/JausComponentCommunicationManager.h" -#include "nodeManager/events/SystemTreeEvent.h" -#include "nodeManager/events/ErrorEvent.h" -#include "nodeManager/events/DebugEvent.h" -#include "nodeManager/EventHandler.h" -#include "nodeManager/SystemTree.h" -#include "jaus.h" -#include "utils/timeLib.h" - -#define _USE_MATH_DEFINES -#include - -NodeManagerComponent::NodeManagerComponent(FileLoader *configData, EventHandler *handler, JausComponentCommunicationManager *cmptComms) -{ - int subsystemId, nodeId; - - this->eventHandler = handler; - - if(configData == NULL) - { - // OK, don't do this. This is bad. - throw "NodeManagerComponent: configData is NULL"; - return; - } - - if(cmptComms == NULL) - { - // OK, don't do this. This is bad. - throw "NodeManagerComponent: cmptComms is NULL"; - return; - } - - this->type = COMPONENT_INTERFACE; - this->commMngr = cmptComms; - this->configData = configData; - this->name = "OpenJAUS Node Manager"; - this->cmptRateHz = NM_RATE_HZ; - this->systemTree = cmptComms->getSystemTree(); - this->systemTree->registerEventHandler(this); - for(int i = 0; i < MAXIMUM_EVENT_ID; i++) - { - eventId[i] = false; - } - - // NOTE: These two values should exist in the properties file and should be checked - // in the NodeManager class prior to constructing this object - subsystemId = configData->GetConfigDataInt("JAUS", "SubsystemId"); - if(subsystemId < JAUS_MINIMUM_SUBSYSTEM_ID || subsystemId > JAUS_MAXIMUM_SUBSYSTEM_ID) - { - // Invalid ID - throw "NodeManagerComponent: Invalid SubsystemId"; - return; - } - - nodeId = configData->GetConfigDataInt("JAUS", "NodeId"); - if(nodeId < JAUS_MINIMUM_NODE_ID || nodeId > JAUS_MAXIMUM_NODE_ID) - { - // Invalid ID - throw "NodeManagerComponent: Invalid NodeId"; - return; - } - - this->cmpt = jausComponentCreate(); - if(!this->cmpt) - { - throw "NodeManagerComponent: Cannot create component"; - return; - } - - this->cmpt->address->subsystem = subsystemId; - this->cmpt->address->node = nodeId; - this->cmpt->address->component = JAUS_NODE_MANAGER; - this->cmpt->address->instance = JAUS_MINIMUM_INSTANCE_ID; - this->setupJausServices(); - - this->cmpt->identification = (char *)calloc(strlen(this->name.c_str()) + 1, sizeof(char)); - strcpy(this->cmpt->identification, this->name.c_str()); -} - -NodeManagerComponent::~NodeManagerComponent(void) -{ - HASH_MAP ::iterator iterator; - - if(running) - { - this->stopInterface(); - } - - jausComponentDestroy(this->cmpt); - - for(iterator = subsystemChangeList.begin(); iterator != subsystemChangeList.end(); iterator++) - { - jausAddressDestroy(iterator->second); - } - - for(iterator = nodeChangeList.begin(); iterator != nodeChangeList.end(); iterator++) - { - jausAddressDestroy(iterator->second); - } -} - -bool NodeManagerComponent::startInterface() -{ - // Set our thread control flag to true - this->running = true; - - // Setup our pThread - this->startThread(); - - if(!systemTree->addComponent(this->cmpt->address, this->cmpt)) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, "Cannot add Node Manager component"); - this->eventHandler->handleEvent(e); - return false; - } - - return true; -} - -bool NodeManagerComponent::stopInterface() -{ - // Send our shutdown events - sendNodeShutdownEvents(); - sendSubsystemShutdownEvents(); - - // Set out thread control flag to false - this->running = false; - - // Stop our pThread - this->stopThread(); - - return true; -} - -bool NodeManagerComponent::processMessage(JausMessage message) -{ - if(!message || !message->destination) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::NullPointer, __FUNCTION__, __LINE__, "Invalid JausMessage."); - this->eventHandler->handleEvent(e); - return false; - } - - switch(message->commandCode) - { - case JAUS_SET_COMPONENT_AUTHORITY: - case JAUS_SHUTDOWN: - case JAUS_STANDBY: - case JAUS_RESUME: - case JAUS_RESET: - case JAUS_SET_EMERGENCY: - case JAUS_CLEAR_EMERGENCY: - // These messages are ignored! - jausMessageDestroy(message); - return true; - - case JAUS_CREATE_SERVICE_CONNECTION: - return processCreateServiceConnection(message); - - case JAUS_ACTIVATE_SERVICE_CONNECTION: - return processActivateServiceConnection(message); - - case JAUS_SUSPEND_SERVICE_CONNECTION: - return processSuspendServiceConnection(message); - - case JAUS_TERMINATE_SERVICE_CONNECTION: - return processTerminateServiceConnection(message); - - case JAUS_REQUEST_COMPONENT_CONTROL: - return processRequestComponentControl(message); - - case JAUS_QUERY_COMPONENT_AUTHORITY: - return processQueryComponentAuthority(message); - - case JAUS_QUERY_COMPONENT_STATUS: - return processQueryComponentStatus(message); - - case JAUS_QUERY_HEARTBEAT_PULSE: - return processQueryHeartbeatPulse(message); - - case JAUS_REPORT_HEARTBEAT_PULSE: - return processReportHeartbeatPulse(message); - - case JAUS_QUERY_CONFIGURATION: - return processQueryConfiguration(message); - - case JAUS_QUERY_IDENTIFICATION: - return processQueryIdentification(message); - - case JAUS_QUERY_SERVICES: - return processQueryServices(message); - - case JAUS_REPORT_CONFIGURATION: - return processReportConfiguration(message); - - case JAUS_REPORT_IDENTIFICATION: - return processReportIdentification(message); - - case JAUS_REPORT_SERVICES: - return processReportServices(message); - - case JAUS_CANCEL_EVENT: - return processCancelEvent(message); - - case JAUS_CONFIRM_EVENT_REQUEST: - return processConfirmEvent(message); - - case JAUS_CREATE_EVENT: - return processCreateEvent(message); - - case JAUS_EVENT: - return processEvent(message); - - default: - // Unhandled message received by node manager component - jausMessageDestroy(message); - return false; - } -} - -std::string NodeManagerComponent::toString() -{ - return "Node Manager Component"; -} - -JausAddress NodeManagerComponent::checkInLocalComponent(int cmptId) -{ - JausComponent component = jausComponentCreate(); - if(!component) return NULL; - - // Setup query address - component->address->subsystem = this->cmpt->address->subsystem; - component->address->node = this->cmpt->address->node; - component->address->component = cmptId; - component->address->instance = 0; - - // Query SystemTree for next valid instance ID - component->address->instance = this->getCommunicationManager()->getSystemTree()->getNextInstanceId(component->address); - - // Check returned value - if(component->address->instance == JAUS_INVALID_INSTANCE_ID) - { - jausComponentDestroy(component); - return NULL; - } - else - { - if(this->commMngr->getSystemTree()->addComponent(component->address, component)) - { - JausAddress address = jausAddressClone(component->address); - jausComponentDestroy(component); - - sendNodeChangedEvents(); - sendSubsystemChangedEvents(); - return address; - } - else - { - jausComponentDestroy(component); - return NULL; - } - } -} - -void NodeManagerComponent::checkOutLocalComponent(JausAddress address) -{ - return checkOutLocalComponent(address->subsystem, address->node, address->component, address->instance); -} - -void NodeManagerComponent::checkOutLocalComponent(int subsId, int nodeId, int cmptId, int instId) -{ - if(systemTree->removeComponent(subsId, nodeId, cmptId, instId)) - { - sendNodeChangedEvents(); - sendSubsystemChangedEvents(); - } -} - -void NodeManagerComponent::startupState() -{ - -} - -void NodeManagerComponent::intializeState() -{ - // Nothing to do - this->cmpt->state = JAUS_READY_STATE; -} - -void NodeManagerComponent::standbyState() -{ - // Nothing to do -} - -void NodeManagerComponent::readyState() -{ - // Nothing to do -} - -void NodeManagerComponent::emergencyState() -{ - // Nothing to do -} - -void NodeManagerComponent::failureState() -{ - // Nothing to do -} - -void NodeManagerComponent::shutdownState() -{ - // Nothing to do -} - -void NodeManagerComponent::allState() -{ - static double refreshTime = 0; - generateHeartbeats(); - if(ojGetTimeSec() >= refreshTime) - { - systemTree->refresh(); - refreshTime = ojGetTimeSec() + REFRESH_TIME_SEC; - } - - // TODO: Check for serviceConnections -} - -bool NodeManagerComponent::processReportConfiguration(JausMessage message) -{ - // This function follows the flowchart designed for NM 2.0 by D. Kent and T. Galluzzo - ReportConfigurationMessage reportConf = NULL; - - reportConf = reportConfigurationMessageFromJausMessage(message); - if(!reportConf) - { - // Error unpacking the reportConf - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot unpack ReportConf"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - // Has Subs? - if(!systemTree->hasSubsystem(reportConf->source)) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Received ReportConf from unknown subsystem"); - this->eventHandler->handleEvent(e); - reportConfigurationMessageDestroy(reportConf); - jausMessageDestroy(message); - return false; - } - - // My Subs? - if(reportConf->source->subsystem != this->cmpt->address->subsystem) - { - // Test for special case - if(reportConf->subsystem->nodes->elementCount == 0) - { - // Special Case: This is an empty subsystem report, this means that the source subsystem is going offline - systemTree->removeSubsystem(reportConf->source); - reportConfigurationMessageDestroy(reportConf); - jausMessageDestroy(message); - return true; - } - - systemTree->replaceSubsystem(reportConf->source, reportConf->subsystem); - - JausSubsystem subs = systemTree->getSubsystem(reportConf->source); - - for(int i = 0; i < subs->nodes->elementCount; i++) - { - JausNode node = (JausNode) subs->nodes->elementData[i]; - - if(!jausNodeHasIdentification(node)) - { - JausAddress address = jausAddressCreate(); - if(!address) - { - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot create address"); - this->eventHandler->handleEvent(e); - reportConfigurationMessageDestroy(reportConf); - jausMessageDestroy(message); - return false; - } - address->subsystem = reportConf->source->subsystem; - address->node = reportConf->source->node; - address->component = JAUS_NODE_MANAGER; - address->instance = 1; - - sendQueryNodeIdentification(address); - jausAddressDestroy(address); - } - - for(int j = 0; j < node->components->elementCount; j++) - { - JausComponent cmpt = (JausComponent) node->components->elementData[j]; - - if(!jausComponentHasIdentification(cmpt)) - { - sendQueryComponentIdentification(cmpt->address); - } - - if(!jausComponentHasServices(cmpt)) - { - sendQueryComponentServices(cmpt->address); - } - } // End For(Components) - } // End For(Nodes) - - jausSubsystemDestroy(subs); - reportConfigurationMessageDestroy(reportConf); - jausMessageDestroy(message); - return true; - } // End !MySubs? - - if(!systemTree->hasNode(reportConf->source)) - { - // Report Conf from unknown node! This is an unsolicited report - ErrorEvent *e = new ErrorEvent(ErrorEvent::Message, __FUNCTION__, __LINE__, "Report Conf from unknown node! This is an unsolicited report"); - this->eventHandler->handleEvent(e); - reportConfigurationMessageDestroy(reportConf); - jausMessageDestroy(message); - return true; - } - - // This is a node-level report - // Should only have 1 node attached! - if(reportConf->subsystem->nodes->elementCount > 1) - { - // Warning - ErrorEvent *e = new ErrorEvent(ErrorEvent::Warning, __FUNCTION__, __LINE__, "Node-level Report Conf with more than 1 node included. Ignoring other nodes."); - this->eventHandler->handleEvent(e); - } - - JausNode node = (JausNode) reportConf->subsystem->nodes->elementData[0]; - - // Test for special case - if(node->components->elementCount == 0) - { - // Special Case: This is an empty node report, this means that the source node is going offline - systemTree->removeNode(reportConf->source); - reportConfigurationMessageDestroy(reportConf); - jausMessageDestroy(message); - return true; - } - - // Replace Node - systemTree->replaceNode(reportConf->source, node); - - for(int i = 0; i < node->components->elementCount; i++) - { - JausComponent cmpt = (JausComponent) node->components->elementData[i]; - - if(!jausComponentHasIdentification(cmpt)) - { - sendQueryComponentIdentification(cmpt->address); - } - - if(!jausComponentHasServices(cmpt)) - { - sendQueryComponentServices(cmpt->address); - } - } - - // Send subs changed events - sendSubsystemChangedEvents(); - - reportConfigurationMessageDestroy(reportConf); - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processReportIdentification(JausMessage message) -{ - // This function follows the flowchart designed for NM 2.0 by D. Kent and T. Galluzzo - ReportIdentificationMessage reportId = NULL; - - reportId = reportIdentificationMessageFromJausMessage(message); - if(!reportId) - { - // Error unpacking the reportId msg - // TODO: Log Error. Throw Exception? - jausMessageDestroy(message); - return false; - } - - switch(reportId->queryType) - { - case JAUS_QUERY_FIELD_SYSTEM_IDENTITY: - // We don't care about this (actually we never ask for this, so this shouldn't happen) - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return true; - - case JAUS_QUERY_FIELD_SS_IDENTITY: - // Has Subs? - if(!systemTree->hasSubsystem(reportId->source)) - { - // Report ID from unknown Subsystem - // TODO: Log Error. Throw Exception - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return false; - } - - // Add Identification - systemTree->setSubsystemIdentification(reportId->source, reportId->identification); - - // Query Subs Conf & Setup event - sendQuerySubsystemConfiguration(reportId->source, true); - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return true; - - case JAUS_QUERY_FIELD_NODE_IDENTITY: - // Has Node? - if(!systemTree->hasNode(reportId->source)) - { - // Report ID from unknown Node - // TODO: Log Error. Throw Exception - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return false; - } - - // Add Identification - systemTree->setNodeIdentification(reportId->source, reportId->identification); - - // Query Subs Conf & Setup event - sendQueryNodeConfiguration(reportId->source, true); - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return true; - - case JAUS_QUERY_FIELD_COMPONENT_IDENTITY: - // Has Cmpt? - if(!systemTree->hasComponent(reportId->source)) - { - // Report ID from unknown Component - // TODO: Log Error. Throw Exception - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return false; - } - - // Add Identification - systemTree->setComponentIdentification(reportId->source, reportId->identification); - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return true; - - default: - // TODO: Log Error. Throw Exception. - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return true; - } - - reportIdentificationMessageDestroy(reportId); - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processReportServices(JausMessage message) -{ - ReportServicesMessage reportServices = NULL; - - reportServices = reportServicesMessageFromJausMessage(message); - if(!reportServices) - { - // TODO: Log error. Throw Exception. - jausMessageDestroy(message); - return false; - } - - if(systemTree->hasComponent(reportServices->source)) - { - systemTree->setComponentServices(reportServices->source, reportServices->jausServices); - } - - reportServicesMessageDestroy(reportServices); - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processReportHeartbeatPulse(JausMessage message) -{ - // This function follows the flowchart designed for NM 2.0 by D. Kent and T. Galluzzo - char buf[256]; - sprintf(buf, "Process HB from: %d.%d.%d.%d", message->source->subsystem, message->source->node, message->source->component, message->source->instance); - DebugEvent *e = new DebugEvent("HB", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - - // Has Subs? - if(!systemTree->hasSubsystem(message->source)) - { - // Add Subs - systemTree->addSubsystem(message->source, NULL); - - // Query SubsId - sendQuerySubsystemIdentification(message->source); - jausMessageDestroy(message); - return true; - } - - // Update Subsystem Timestamp - systemTree->updateSubsystemTimestamp(message->source); - - // Has SubsId? - if(!systemTree->hasSubsystemIdentification(message->source)) - { - // Query SubsId - sendQuerySubsystemIdentification(message->source); - jausMessageDestroy(message); - return true; - } - - // My Subs? - if(message->source->subsystem != this->cmpt->address->subsystem) - { - // Has SubsConf? - if(!systemTree->hasSubsystemConfiguration(message->source)) - { - sendQuerySubsystemConfiguration(message->source, true); - jausMessageDestroy(message); - return true; - } - - JausSubsystem subs = systemTree->getSubsystem(message->source); - if(!subs) - { - // TODO: Throw Exception. Log Error. - jausMessageDestroy(message); - return false; - } - - for(int i = 0; i < subs->nodes->elementCount; i++) - { - JausNode node = (JausNode) subs->nodes->elementData[i]; - - if(!jausNodeHasIdentification(node)) - { - JausAddress address = jausAddressCreate(); - if(!address) - { - // TODO: Throw Exception. Log Error. - jausSubsystemDestroy(subs); - jausMessageDestroy(message); - return false; - } - address->subsystem = message->source->subsystem; - address->node = node->id; - address->component = JAUS_NODE_MANAGER; - address->instance = 1; - - sendQueryNodeIdentification(address); - jausAddressDestroy(address); - } - - for(int j = 0; j < node->components->elementCount; j++) - { - JausComponent cmpt = (JausComponent) node->components->elementData[j]; - - if(!jausComponentHasIdentification(cmpt)) - { - sendQueryComponentIdentification(cmpt->address); - } - - if(!jausComponentHasServices(cmpt)) - { - sendQueryComponentServices(cmpt->address); - } - } // end For(Components) - } // end For(Nodes) - - jausSubsystemDestroy(subs); - jausMessageDestroy(message); - return true; - } // End !MySubs - - // Has Node? - if(!systemTree->hasNode(message->source)) - { - // Add Node - systemTree->addNode(message->source, NULL); - - // Query NodeID - // Setup Query Address - JausAddress address = jausAddressCreate(); - if(!address) - { - // TODO: Throw Exception. Log Error. - jausMessageDestroy(message); - return false; - } - address->subsystem = message->source->subsystem; - address->node = message->source->node; - address->component = JAUS_NODE_MANAGER; - address->instance = 1; - - // Query Node ID - sendQueryNodeIdentification(address); - jausAddressDestroy(address); - jausMessageDestroy(message); - return true; - } - - // Update Node Timestamp - systemTree->updateNodeTimestamp(message->source); - - // Has NodeId? - if(!systemTree->hasNodeIdentification(message->source)) - { - // Query NodeID - // Setup Query Address - JausAddress address = jausAddressCreate(); - if(!address) - { - // TODO: Throw Exception. Log Error. - jausMessageDestroy(message); - return false; - } - address->subsystem = message->source->subsystem; - address->node = message->source->node; - address->component = JAUS_NODE_MANAGER; - address->instance = 1; - - // Query Node ID - sendQueryNodeIdentification(address); - jausAddressDestroy(address); - jausMessageDestroy(message); - return true; - } - - // My Node? - if(message->source->node != this->cmpt->address->node) - { - // Has NodeConf? - if(!systemTree->hasNodeConfiguration(message->source)) - { - // Query NodeConf - JausAddress address = jausAddressCreate(); - if(!address) - { - // TODO: Throw Exception. Log Error. - jausMessageDestroy(message); - return false; - } - address->subsystem = message->source->subsystem; - address->node = message->source->node; - address->component = JAUS_NODE_MANAGER; - address->instance = 1; - - sendQueryNodeConfiguration(address, true); - jausAddressDestroy(address); - jausMessageDestroy(message); - return true; - } - else - { - JausNode node = systemTree->getNode(message->source); - - // Check for component ID and Services - for(int i = 0; i < node->components->elementCount; i++) - { - JausComponent cmpt = (JausComponent) node->components->elementData[i]; - if(!jausComponentHasIdentification(cmpt)) - { - sendQueryComponentIdentification(cmpt->address); - } - - if(!jausComponentHasServices(cmpt)) - { - sendQueryComponentServices(cmpt->address); - } - } - - jausNodeDestroy(node); - jausMessageDestroy(message); - return false; - } - }// End !MyNode - - // Has Component? - if(!systemTree->hasComponent(message->source)) - { - // Add Component - systemTree->addComponent(message->source, NULL); - } - else - { - // Update Component Timestamp - systemTree->updateComponentTimestamp(message->source); - } - - if(!systemTree->hasComponentIdentification(message->source)) - { - //printf("Send Query Cmpt Id\n"); - sendQueryComponentIdentification(message->source); - } - - if(!systemTree->hasComponentServices(message->source)) - { - //printf("Send Query Cmpt Services\n"); - sendQueryComponentServices(message->source); - } - - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processCreateEvent(JausMessage message) -{ - // Only support Configuration Changed events - CreateEventMessage createEvent = NULL; - QueryConfigurationMessage queryConf = NULL; - ConfirmEventRequestMessage confirmEventRequest = NULL; - JausMessage txMessage = NULL; - int nextEventId = -1; - HASH_MAP ::iterator iterator; - - confirmEventRequest = confirmEventRequestMessageCreate(); - if(!confirmEventRequest) - { - //TODO: Log Error. Throw Exception - jausMessageDestroy(message); - return false; - } - jausAddressCopy(confirmEventRequest->destination, message->source); - jausAddressCopy(confirmEventRequest->source, cmpt->address); - - createEvent = createEventMessageFromJausMessage(message); - if(!createEvent) - { - //TODO: Log Error. Throw Exception - confirmEventRequest->responseCode = INVALID_EVENT_RESPONSE; - txMessage = confirmEventRequestMessageToJausMessage(confirmEventRequest); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - confirmEventRequestMessageDestroy(confirmEventRequest); - jausMessageDestroy(message); - return false; - } - - if(createEvent->reportMessageCode != JAUS_REPORT_CONFIGURATION) - { - // Currently the NM only supports configuration changed events - confirmEventRequest->responseCode = MESSAGE_UNSUPPORTED_RESPONSE; - txMessage = confirmEventRequestMessageToJausMessage(confirmEventRequest); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - confirmEventRequestMessageDestroy(confirmEventRequest); - - char buf[256]; - sprintf(buf, "Rejected event from %d.%d.%d.%d. Unsupported command code (0x%04X)", createEvent->source->subsystem, createEvent->source->node, createEvent->source->component, createEvent->source->instance, createEvent->reportMessageCode); - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - - jausMessageDestroy(message); - return false; - } - confirmEventRequest->messageCode = JAUS_REPORT_CONFIGURATION; - - queryConf = queryConfigurationMessageFromJausMessage(createEvent->queryMessage); - if(!queryConf) - { - // ERROR: Cannot unpack query message - // TODO: Log Error. Throw Exception - confirmEventRequest->responseCode = INVALID_EVENT_RESPONSE; - txMessage = confirmEventRequestMessageToJausMessage(confirmEventRequest); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - confirmEventRequestMessageDestroy(confirmEventRequest); - jausMessageDestroy(message); - return false; - } - - switch(queryConf->queryField) - { - case JAUS_SUBSYSTEM_CONFIGURATION: - for(iterator = subsystemChangeList.begin(); iterator != subsystemChangeList.end(); iterator++) - { - if(jausAddressEqual(createEvent->source, iterator->second)) - { - // Event already created - confirmEventRequest->responseCode = SUCCESSFUL_RESPONSE; - confirmEventRequest->eventId = iterator->first; - break; - } - } - - nextEventId = getNextEventId(); - if(nextEventId >= 0) - { - confirmEventRequest->eventId = (JausByte) nextEventId; - eventId[nextEventId] = true; - subsystemChangeList[nextEventId] = jausAddressClone(createEvent->source); - confirmEventRequest->responseCode = SUCCESSFUL_RESPONSE; - - char buf[256]; - sprintf(buf, "Added Subsystem Configuration event for %d.%d.%d.%d.", createEvent->source->subsystem, createEvent->source->node, createEvent->source->component, createEvent->source->instance); - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - else - { - confirmEventRequest->responseCode = CONNECTION_REFUSED_RESPONSE; - confirmEventRequest->eventId = 0; - - char buf[256]; -// sprintf(buf, "Rejected event from %d.%d.%d.%d. No available Event Ids.", createEvent->source->subsystem, createEvent->source->node, createEvent->source->component, createEvent->source->instance, createEvent->reportMessageCode); //NMJ - sprintf(buf, "Rejected event from %d.%d.%d.%d. No available Event Ids.", createEvent->source->subsystem, createEvent->source->node, createEvent->source->component, createEvent->source->instance); // NMJ - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - break; - - case JAUS_NODE_CONFIGURATION: - for(iterator = nodeChangeList.begin(); iterator != nodeChangeList.end(); iterator++) - { - if(jausAddressEqual(createEvent->source, iterator->second)) - { - // Event already created - confirmEventRequest->responseCode = SUCCESSFUL_RESPONSE; - confirmEventRequest->eventId = iterator->first; - break; - } - } - - nextEventId = getNextEventId(); - if(nextEventId >= 0) - { - confirmEventRequest->eventId = (JausByte) nextEventId; - eventId[nextEventId] = true; - nodeChangeList[nextEventId] = jausAddressClone(createEvent->source); - confirmEventRequest->responseCode = SUCCESSFUL_RESPONSE; - - char buf[256]; - sprintf(buf, "Added Node Configuration event for %d.%d.%d.%d.", createEvent->source->subsystem, createEvent->source->node, createEvent->source->component, createEvent->source->instance); - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - else - { - confirmEventRequest->responseCode = CONNECTION_REFUSED_RESPONSE; - confirmEventRequest->eventId = 0; - - char buf[256]; -// sprintf(buf, "Rejected event from %d.%d.%d.%d. No available Event Ids.", createEvent->source->subsystem, createEvent->source->node, createEvent->source->component, createEvent->source->instance, createEvent->reportMessageCode); // NMJ - sprintf(buf, "Rejected event from %d.%d.%d.%d. No available Event Ids.", createEvent->source->subsystem, createEvent->source->node, createEvent->source->component, createEvent->source->instance); - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - break; - - default: - // TODO: Log Error. Throw Exception. - // Unknown Query Type - confirmEventRequest->responseCode = INVALID_EVENT_RESPONSE; - txMessage = confirmEventRequestMessageToJausMessage(confirmEventRequest); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - confirmEventRequestMessageDestroy(confirmEventRequest); - jausMessageDestroy(message); - return false; - } - - // Send response - txMessage = confirmEventRequestMessageToJausMessage(confirmEventRequest); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - confirmEventRequestMessageDestroy(confirmEventRequest); - queryConfigurationMessageDestroy(queryConf); - createEventMessageDestroy(createEvent); - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processCancelEvent(JausMessage message) -{ - CancelEventMessage cancelEvent = NULL; - - cancelEvent = cancelEventMessageFromJausMessage(message); - if(!cancelEvent) - { - // Error unpacking message - // TODO: Throw Exception. Log Error. - jausMessageDestroy(message); - return false; - } - - if(cancelEvent->messageCode == JAUS_QUERY_CONFIGURATION) - { - if(eventId[cancelEvent->eventId]) - { - eventId[cancelEvent->eventId] = false; - - if(subsystemChangeList.find(cancelEvent->eventId) != subsystemChangeList.end()) - { - // Remove that element - subsystemChangeList.erase(subsystemChangeList.find(cancelEvent->eventId)); - } - else if(nodeChangeList.find(cancelEvent->eventId) != nodeChangeList.end()) - { - // Remove that element - nodeChangeList.erase(nodeChangeList.find(cancelEvent->eventId)); - } - } - } - - cancelEventMessageDestroy(cancelEvent); - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processCreateServiceConnection(JausMessage message) -{ - // Not implemented right now - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processActivateServiceConnection(JausMessage message) -{ - // Not Implemented right now - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processSuspendServiceConnection(JausMessage message) -{ - // Not Implemented right now - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processTerminateServiceConnection(JausMessage message) -{ - // Not Implemented right now - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processRequestComponentControl(JausMessage message) -{ - RequestComponentControlMessage requestComponentControl = NULL; - RejectComponentControlMessage rejectComponentControl = NULL; - ConfirmComponentControlMessage confirmComponentControl = NULL; - JausMessage txMessage = NULL; - - requestComponentControl = requestComponentControlMessageFromJausMessage(message); - if(!requestComponentControl) - { - // Error unpacking message - // TODO: Log Error. Throw Exception - jausMessageDestroy(message); - return false; - } - - if(cmpt->controller.active) - { - if(requestComponentControl->authorityCode > cmpt->controller.authority) // Test for higher authority - { - // Terminate control of current component - rejectComponentControl = rejectComponentControlMessageCreate(); - jausAddressCopy(rejectComponentControl->source, cmpt->address); - jausAddressCopy(rejectComponentControl->destination, cmpt->controller.address); - txMessage = rejectComponentControlMessageToJausMessage(rejectComponentControl); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - // Accept control of new component - confirmComponentControl = confirmComponentControlMessageCreate(); - jausAddressCopy(confirmComponentControl->source, cmpt->address); - jausAddressCopy(confirmComponentControl->destination, message->source); - confirmComponentControl->responseCode = JAUS_CONTROL_ACCEPTED; - txMessage = confirmComponentControlMessageToJausMessage(confirmComponentControl); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - // Update cmpt controller information - jausAddressCopy(cmpt->controller.address, message->source); - cmpt->controller.authority = requestComponentControl->authorityCode; - - rejectComponentControlMessageDestroy(rejectComponentControl); - confirmComponentControlMessageDestroy(confirmComponentControl); - } - else - { - if(!jausAddressEqual(message->source, cmpt->controller.address)) - { - rejectComponentControl = rejectComponentControlMessageCreate(); - jausAddressCopy(rejectComponentControl->source, cmpt->address); - jausAddressCopy(rejectComponentControl->destination, message->source); - txMessage = rejectComponentControlMessageToJausMessage(rejectComponentControl); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - rejectComponentControlMessageDestroy(rejectComponentControl); - } - else - { - // Reaccept control of new component - confirmComponentControl = confirmComponentControlMessageCreate(); - jausAddressCopy(confirmComponentControl->source, cmpt->address); - jausAddressCopy(confirmComponentControl->destination, message->source); - confirmComponentControl->responseCode = JAUS_CONTROL_ACCEPTED; - txMessage = confirmComponentControlMessageToJausMessage(confirmComponentControl); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - confirmComponentControlMessageDestroy(confirmComponentControl); - } - } - } - else // Not currently under component control, so give control - { - confirmComponentControl = confirmComponentControlMessageCreate(); - jausAddressCopy(confirmComponentControl->source, cmpt->address); - jausAddressCopy(confirmComponentControl->destination, message->source); - confirmComponentControl->responseCode = JAUS_CONTROL_ACCEPTED; - txMessage = confirmComponentControlMessageToJausMessage(confirmComponentControl); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - jausAddressCopy(cmpt->controller.address, message->source); - cmpt->controller.authority = requestComponentControl->authorityCode; - cmpt->controller.active = JAUS_TRUE; - - confirmComponentControlMessageDestroy(confirmComponentControl); - } - - requestComponentControlMessageDestroy(requestComponentControl); - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processQueryComponentAuthority(JausMessage message) -{ - ReportComponentAuthorityMessage report = NULL; - JausMessage txMessage = NULL; - - report = reportComponentAuthorityMessageCreate(); - if(!report) - { - // TODO: Throw Exception. Log Error. - jausMessageDestroy(message); - return false; - } - - jausAddressCopy(report->source, cmpt->address); - jausAddressCopy(report->destination, message->source); - report->authorityCode = cmpt->authority; - - txMessage = reportComponentAuthorityMessageToJausMessage(report); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportComponentAuthorityMessageDestroy(report); - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processQueryComponentStatus(JausMessage message) -{ - ReportComponentStatusMessage reportComponentStatus = NULL; - JausMessage txMessage = NULL; - - - reportComponentStatus = reportComponentStatusMessageCreate(); - jausAddressCopy(reportComponentStatus->source, cmpt->address); - jausAddressCopy(reportComponentStatus->destination, message->source); - reportComponentStatus->primaryStatusCode = cmpt->state; - - txMessage = reportComponentStatusMessageToJausMessage(reportComponentStatus); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportComponentStatusMessageDestroy(reportComponentStatus); - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processQueryHeartbeatPulse(JausMessage message) -{ - - JausMessage txMessage = NULL; - ReportHeartbeatPulseMessage reportHeartbeat = NULL; - - reportHeartbeat = reportHeartbeatPulseMessageCreate(); - if(!reportHeartbeat) - { - // TODO: Log Error. Throw Exception. - jausMessageDestroy(message); - return false; - } - - jausAddressCopy(reportHeartbeat->source, cmpt->address); - jausAddressCopy(reportHeartbeat->destination, message->source); - txMessage = reportHeartbeatPulseMessageToJausMessage(reportHeartbeat); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processQueryConfiguration(JausMessage message) -{ - QueryConfigurationMessage queryConf = NULL; - ReportConfigurationMessage reportConf = NULL; - JausMessage txMessage = NULL; - JausNode node = NULL; - - queryConf = queryConfigurationMessageFromJausMessage(message); - if(!queryConf) - { - // TODO: Log Error. Throw Exception. - // Error unpacking message - jausMessageDestroy(message); - return false; - } - - switch(queryConf->queryField) - { - case JAUS_SUBSYSTEM_CONFIGURATION: - // Subsystem Configuration requests should go to the Communicator! - // This is included for backwards compatibility and other implementation support - if(this->commMngr->getMessageRouter()->subsystemCommunicationEnabled()) - { - reportConf = reportConfigurationMessageCreate(); - if(!reportConf) - { - // TODO: Log Error. Throw Exception - queryConfigurationMessageDestroy(queryConf); - jausMessageDestroy(message); - return false; - } - - // Remove the subsystem created by the constructor - jausSubsystemDestroy(reportConf->subsystem); - - // This call to the systemTree returns a copy, so safe to set this pointer to it - reportConf->subsystem = systemTree->getSubsystem(this->cmpt->address->subsystem); - if(reportConf->subsystem) - { - txMessage = reportConfigurationMessageToJausMessage(reportConf); - jausAddressCopy(txMessage->source, cmpt->address); - jausAddressCopy(txMessage->destination, reportConf->source); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - } - - reportConfigurationMessageDestroy(reportConf); - queryConfigurationMessageDestroy(queryConf); - jausMessageDestroy(message); - return true; - } - else - { - // This NM is not connected to the subsystem network, - // therefore no one should be asking us for subsystem configuration - // TODO: Log Error. Throw Exception. - queryConfigurationMessageDestroy(queryConf); - jausMessageDestroy(message); - return false; - } - - case JAUS_NODE_CONFIGURATION: - reportConf = reportConfigurationMessageCreate(); - if(!reportConf) - { - // TODO: Log Error. Throw Exception - queryConfigurationMessageDestroy(queryConf); - jausMessageDestroy(message); - return false; - } - - // This call to the systemTree returns a copy, so safe to set this pointer to it - node = systemTree->getNode(this->cmpt->address->subsystem, this->cmpt->address->node); - if(node) - { - jausArrayAdd(reportConf->subsystem->nodes, node); - } - - txMessage = reportConfigurationMessageToJausMessage(reportConf); - jausAddressCopy(txMessage->source, cmpt->address); - jausAddressCopy(txMessage->destination, queryConf->source); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportConfigurationMessageDestroy(reportConf); - queryConfigurationMessageDestroy(queryConf); - jausMessageDestroy(message); - return true; - - default: - // TODO: Log Error. Throw Exception. - // Unknown query type - queryConfigurationMessageDestroy(queryConf); - jausMessageDestroy(message); - return false; - } -} - -bool NodeManagerComponent::processQueryIdentification(JausMessage message) -{ - QueryIdentificationMessage queryId = NULL; - ReportIdentificationMessage reportId = NULL; - JausMessage txMessage = NULL; - char *identification = NULL; - - queryId = queryIdentificationMessageFromJausMessage(message); - if(!queryId) - { - // TODO: Log Error. Throw Exception. - // Error unpacking message - jausMessageDestroy(message); - return false; - } - - switch(queryId->queryField) - { - case JAUS_QUERY_FIELD_SS_IDENTITY: - // Subsystem Configuration requests should go to the Communicator! - // This is included for backwards compatibility and other implementation support - if(this->commMngr->getMessageRouter()->subsystemCommunicationEnabled()) - { - reportId = reportIdentificationMessageCreate(); - if(!reportId) - { - // TODO: Log Error. Throw Exception - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return false; - } - - identification = systemTree->getSubsystemIdentification(cmpt->address); - if(strlen(identification) < JAUS_IDENTIFICATION_LENGTH_BYTES) - { - sprintf(reportId->identification, "%s", identification); - } - else - { - memcpy(reportId->identification, identification, JAUS_IDENTIFICATION_LENGTH_BYTES-1); - reportId->identification[JAUS_IDENTIFICATION_LENGTH_BYTES-1] = 0; - } - - reportId->queryType = JAUS_QUERY_FIELD_SS_IDENTITY; - jausAddressCopy(reportId->source, cmpt->address); - jausAddressCopy(reportId->destination, queryId->source); - txMessage = reportIdentificationMessageToJausMessage(reportId); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportIdentificationMessageDestroy(reportId); - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return true; - } - else - { - // This NM is not connected to the subsystem network, - // therefore no one should be asking us for subsystem configuration - // TODO: Log Error. Throw Exception. - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return false; - } - case JAUS_QUERY_FIELD_NODE_IDENTITY: - reportId = reportIdentificationMessageCreate(); - if(!reportId) - { - // TODO: Log Error. Throw Exception - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return false; - } - - identification = systemTree->getNodeIdentification(cmpt->address); - if(strlen(identification) < JAUS_IDENTIFICATION_LENGTH_BYTES) - { - sprintf(reportId->identification, "%s", identification); - } - else - { - memcpy(reportId->identification, identification, JAUS_IDENTIFICATION_LENGTH_BYTES-1); - reportId->identification[JAUS_IDENTIFICATION_LENGTH_BYTES-1] = 0; - } - free(identification); - - reportId->queryType = JAUS_QUERY_FIELD_NODE_IDENTITY; - txMessage = reportIdentificationMessageToJausMessage(reportId); - jausAddressCopy(txMessage->source, cmpt->address); - jausAddressCopy(txMessage->destination, queryId->source); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportIdentificationMessageDestroy(reportId); - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return true; - - case JAUS_QUERY_FIELD_COMPONENT_IDENTITY: - reportId = reportIdentificationMessageCreate(); - if(!reportId) - { - // TODO: Log Error. Throw Exception - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return false; - } - - identification = cmpt->identification; - if(strlen(identification) < JAUS_IDENTIFICATION_LENGTH_BYTES) - { - sprintf(reportId->identification, "%s", identification); - } - else - { - memcpy(reportId->identification, identification, JAUS_IDENTIFICATION_LENGTH_BYTES-1); - reportId->identification[JAUS_IDENTIFICATION_LENGTH_BYTES-1] = 0; - } - - reportId->queryType = JAUS_QUERY_FIELD_COMPONENT_IDENTITY; - txMessage = reportIdentificationMessageToJausMessage(reportId); - jausAddressCopy(txMessage->source, cmpt->address); - jausAddressCopy(txMessage->destination, queryId->source); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportIdentificationMessageDestroy(reportId); - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return true; - - default: - queryIdentificationMessageDestroy(queryId); - jausMessageDestroy(message); - return false; - } -} - -bool NodeManagerComponent::processQueryServices(JausMessage message) -{ - QueryServicesMessage queryServices = NULL; - ReportServicesMessage reportServices = NULL; - JausMessage txMessage = NULL; - - - queryServices = queryServicesMessageFromJausMessage(message); - if(!queryServices) - { - // TODO: Log Error. Throw Exception. - jausMessageDestroy(message); - return false; - } - - // Respond with our services - reportServices = reportServicesMessageCreate(); - if(!reportServices) - { - // TODO: Log Error. Throw Exception. - queryServicesMessageDestroy(queryServices); - jausMessageDestroy(message); - return false; - } - - jausAddressCopy(reportServices->destination, message->source); - jausAddressCopy(reportServices->source, cmpt->address); - jausServicesDestroy(reportServices->jausServices); - reportServices->jausServices = jausServicesClone(cmpt->services); - - txMessage = reportServicesMessageToJausMessage(reportServices); - if(txMessage) - { - this->commMngr->receiveJausMessage(txMessage, this); - } - - reportServicesMessageDestroy(reportServices); - queryServicesMessageDestroy(queryServices); - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processConfirmEvent(JausMessage message) -{ - // Not currently implemented - jausMessageDestroy(message); - return true; -} - -bool NodeManagerComponent::processEvent(JausMessage message) -{ - EventMessage eventMessage; - - eventMessage = eventMessageFromJausMessage(message); - if(!eventMessage) - { - // Error unpacking the eventMessage - ErrorEvent *e = new ErrorEvent(ErrorEvent::Memory, __FUNCTION__, __LINE__, "Cannot unpack EventMessage!"); - this->eventHandler->handleEvent(e); - jausMessageDestroy(message); - return false; - } - - processMessage(jausMessageClone(eventMessage->reportMessage)); - eventMessageDestroy(eventMessage); - jausMessageDestroy(message); - return true; -} - -void NodeManagerComponent::sendNodeChangedEvents() -{ - ReportConfigurationMessage reportConf = NULL; - JausMessage txMessage = NULL; - EventMessage eventMessage = NULL; - HASH_MAP ::iterator iterator; - - JausNode thisNode = systemTree->getNode(this->cmpt->address); - if(!thisNode) - { - // TODO: Record an error. Throw Exception - return; - } - - reportConf = reportConfigurationMessageCreate(); - if(!reportConf) - { - // TODO: Record an error. Throw Exception - jausNodeDestroy(thisNode); - return; - } - jausArrayAdd(reportConf->subsystem->nodes, (void *)thisNode); - - eventMessage = eventMessageCreate(); - if(!eventMessage) - { - // TODO: Record an error. Throw Exception - reportConfigurationMessageDestroy(reportConf); - return; - } - - eventMessage->reportMessage = reportConfigurationMessageToJausMessage(reportConf); - if(!eventMessage->reportMessage) - { - // TODO: Record an error. Throw Exception - reportConfigurationMessageDestroy(reportConf); - eventMessageDestroy(eventMessage); - return; - } - jausAddressCopy(eventMessage->source, cmpt->address); - - // TODO: Go through nodeChangeList looking for dead addresses - for(iterator = nodeChangeList.begin(); iterator != nodeChangeList.end(); iterator++) - { - eventMessage->eventId = iterator->first; - jausAddressCopy(eventMessage->destination, iterator->second); - txMessage = eventMessageToJausMessage(eventMessage); - this->commMngr->receiveJausMessage(jausMessageClone(txMessage), this); - - char buf[256]; - sprintf(buf, "Send Node Changed event to %d.%d.%d.%d.", txMessage->destination->subsystem, txMessage->destination->node, txMessage->destination->component, txMessage->destination->instance); - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - - eventMessageDestroy(eventMessage); // NMJ - jausMessageDestroy(txMessage); - reportConfigurationMessageDestroy(reportConf); -} - -void NodeManagerComponent::sendSubsystemChangedEvents() -{ - ReportConfigurationMessage reportConf = NULL; - JausMessage txMessage = NULL; - EventMessage eventMessage = NULL; - HASH_MAP ::iterator iterator; - - JausSubsystem thisSubs = systemTree->getSubsystem(this->cmpt->address); - if(!thisSubs) - { - // TODO: Record an error. Throw Exception - return; - } - - reportConf = reportConfigurationMessageCreate(); - if(!reportConf) - { - // TODO: Record an error. Throw Exception - jausSubsystemDestroy(thisSubs); - return; - } - jausSubsystemDestroy(reportConf->subsystem); - reportConf->subsystem = thisSubs; - - eventMessage = eventMessageCreate(); - if(!eventMessage) - { - // TODO: Record an error. Throw Exception - reportConfigurationMessageDestroy(reportConf); - return; - } - - eventMessage->reportMessage = reportConfigurationMessageToJausMessage(reportConf); - if(!eventMessage->reportMessage) - { - // TODO: Record an error. Throw Exception - reportConfigurationMessageDestroy(reportConf); - eventMessageDestroy(eventMessage); - return; - } - jausAddressCopy(eventMessage->source, cmpt->address); - - // TODO: check subsystemChangeList for dead addresses - for(iterator = subsystemChangeList.begin(); iterator != subsystemChangeList.end(); iterator++) - { - eventMessage->eventId = iterator->first; - jausAddressCopy(eventMessage->destination, iterator->second); - txMessage = eventMessageToJausMessage(eventMessage); - this->commMngr->receiveJausMessage(jausMessageClone(txMessage), this); - - char buf[256]; - sprintf(buf, "Send Subs Changed event to %d.%d.%d.%d.", txMessage->destination->subsystem, txMessage->destination->node, txMessage->destination->component, txMessage->destination->instance); - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - - eventMessageDestroy(eventMessage); - jausMessageDestroy(txMessage); - reportConfigurationMessageDestroy(reportConf); -} - -void NodeManagerComponent::sendNodeShutdownEvents() -{ - ReportConfigurationMessage reportConf = NULL; - JausMessage txMessage = NULL; - EventMessage eventMessage = NULL; - HASH_MAP ::iterator iterator; - - reportConf = reportConfigurationMessageCreate(); - if(!reportConf) - { - // TODO: Record an error. Throw Exception - return; - } - - JausNode emptyNode = jausNodeCreate(); - if(!emptyNode) - { - // TODO: Record an error. Throw Exception - reportConfigurationMessageDestroy(reportConf); - return; - } - emptyNode->id = this->cmpt->address->node; - jausArrayAdd(reportConf->subsystem->nodes, (void *)emptyNode); - - eventMessage = eventMessageCreate(); - if(!eventMessage) - { - // TODO: Record an error. Throw Exception - reportConfigurationMessageDestroy(reportConf); - return; - } - - eventMessage->reportMessage = reportConfigurationMessageToJausMessage(reportConf); - if(!eventMessage->reportMessage) - { - // TODO: Record an error. Throw Exception - reportConfigurationMessageDestroy(reportConf); - eventMessageDestroy(eventMessage); - return; - } - jausAddressCopy(eventMessage->source, cmpt->address); - - // TODO: Go through nodeChangeList looking for dead addresses - for(iterator = nodeChangeList.begin(); iterator != nodeChangeList.end(); iterator++) - { - eventMessage->eventId = iterator->first; - jausAddressCopy(eventMessage->destination, iterator->second); - txMessage = eventMessageToJausMessage(eventMessage); - this->commMngr->receiveJausMessage(jausMessageClone(txMessage), this); - - char buf[256]; - sprintf(buf, "Send Node Shutdown event to %d.%d.%d.%d.", txMessage->destination->subsystem, txMessage->destination->node, txMessage->destination->component, txMessage->destination->instance); - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - - eventMessageDestroy(eventMessage); - jausMessageDestroy(txMessage); - reportConfigurationMessageDestroy(reportConf); -} - -void NodeManagerComponent::sendSubsystemShutdownEvents() -{ - ReportConfigurationMessage reportConf = NULL; - JausMessage txMessage = NULL; - EventMessage eventMessage = NULL; - HASH_MAP ::iterator iterator; - - reportConf = reportConfigurationMessageCreate(); - if(!reportConf) - { - // TODO: Record an error. Throw Exception - return; - } - - // Empty Subsystem for message - JausSubsystem emptySubs = jausSubsystemCreate(); - if(!emptySubs) - { - // TODO: Record an error. Throw Exception - reportConfigurationMessageDestroy(reportConf); - return; - } - emptySubs->id = this->cmpt->address->subsystem; - - jausSubsystemDestroy(reportConf->subsystem); - reportConf->subsystem = emptySubs; - eventMessage = eventMessageCreate(); - if(!eventMessage) - { - // TODO: Record an error. Throw Exception - reportConfigurationMessageDestroy(reportConf); - return; - } - - eventMessage->reportMessage = reportConfigurationMessageToJausMessage(reportConf); - if(!eventMessage->reportMessage) - { - // TODO: Record an error. Throw Exception - reportConfigurationMessageDestroy(reportConf); - eventMessageDestroy(eventMessage); - return; - } - jausAddressCopy(eventMessage->source, cmpt->address); - - // TODO: check subsystemChangeList for dead addresses - for(iterator = subsystemChangeList.begin(); iterator != subsystemChangeList.end(); iterator++) - { - eventMessage->eventId = iterator->first; - jausAddressCopy(eventMessage->destination, iterator->second); - txMessage = eventMessageToJausMessage(eventMessage); - this->commMngr->receiveJausMessage(jausMessageClone(txMessage), this); - - char buf[256]; - sprintf(buf, "Send Subs Shutdown event to %d.%d.%d.%d.", txMessage->destination->subsystem, txMessage->destination->node, txMessage->destination->component, txMessage->destination->instance); - DebugEvent *e = new DebugEvent("Event", __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - } - - eventMessageDestroy(eventMessage); - jausMessageDestroy(txMessage); - reportConfigurationMessageDestroy(reportConf); -} - -void NodeManagerComponent::generateHeartbeats() -{ - static double nextSendTime = ojGetTimeSec(); - ReportHeartbeatPulseMessage heartbeat; - JausMessage nodeHeartbeat; - JausMessage cmptHeartbeat; - - if(ojGetTimeSec() >= nextSendTime) - { - heartbeat = reportHeartbeatPulseMessageCreate(); - if(!heartbeat) - { - // Error constructing message - // TODO: Log Error. - return; - } - jausAddressCopy(heartbeat->source, cmpt->address); - - nodeHeartbeat = reportHeartbeatPulseMessageToJausMessage(heartbeat); - if(!nodeHeartbeat) - { - // Error constructing message - // TODO: Log Error. - reportHeartbeatPulseMessageDestroy(heartbeat); - return; - } - - cmptHeartbeat = reportHeartbeatPulseMessageToJausMessage(heartbeat); - if(!cmptHeartbeat) - { - // Error constructing message - // TODO: Log Error. - jausMessageDestroy(nodeHeartbeat); - reportHeartbeatPulseMessageDestroy(heartbeat); - return; - } - - // Send Heartbeat to other node managers on this subsystem - nodeHeartbeat->destination->subsystem = cmpt->address->subsystem; - nodeHeartbeat->destination->node = JAUS_BROADCAST_NODE_ID; - nodeHeartbeat->destination->component = JAUS_NODE_MANAGER_COMPONENT; - nodeHeartbeat->destination->instance = 1; - this->commMngr->receiveJausMessage(nodeHeartbeat, this); - - // Send Heartbeat to components on this node - cmptHeartbeat->destination->subsystem = cmpt->address->subsystem; - cmptHeartbeat->destination->node = cmpt->address->node; - cmptHeartbeat->destination->component = JAUS_BROADCAST_COMPONENT_ID; - cmptHeartbeat->destination->instance = JAUS_BROADCAST_INSTANCE_ID; - this->commMngr->receiveJausMessage(cmptHeartbeat, this); - - nextSendTime = ojGetTimeSec() + 1.0; - reportHeartbeatPulseMessageDestroy(heartbeat); - } -} - -bool NodeManagerComponent::sendQueryNodeIdentification(JausAddress address) -{ - QueryIdentificationMessage queryId = NULL; - JausMessage txMessage = NULL; - - // TODO: Check timeout and request limit - if( systemTree->hasNode(address) && - !systemTree->hasNodeIdentification(address)) - { - // Create query message - queryId = queryIdentificationMessageCreate(); - if(!queryId) - { - // Constructor Failed - return false; - } - - queryId->queryField = JAUS_QUERY_FIELD_NODE_IDENTITY; - txMessage = queryIdentificationMessageToJausMessage(queryId); - if(!txMessage) - { - // ToJausMessage Failed - queryIdentificationMessageDestroy(queryId); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - queryIdentificationMessageDestroy(queryId); - return true; - } - return false; -} - -bool NodeManagerComponent::sendQuerySubsystemIdentification(JausAddress address) -{ - QueryIdentificationMessage queryId = NULL; - JausMessage txMessage = NULL; - - // TODO: Check timeout and request limit - if( systemTree->hasSubsystem(address) && - !systemTree->hasSubsystemIdentification(address)) - { - // Create query message - queryId = queryIdentificationMessageCreate(); - if(!queryId) - { - // Constructor Failed - return false; - } - - queryId->queryField = JAUS_QUERY_FIELD_SS_IDENTITY; - txMessage = queryIdentificationMessageToJausMessage(queryId); - if(!txMessage) - { - // ToJausMessage Failed - queryIdentificationMessageDestroy(queryId); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - queryIdentificationMessageDestroy(queryId); - return true; - } - return false; -} - -bool NodeManagerComponent::sendQueryComponentIdentification(JausAddress address) -{ - QueryIdentificationMessage queryId = NULL; - JausMessage txMessage = NULL; - - // TODO: Check timeout and request limit - if(systemTree->hasComponent(address) && - !systemTree->hasComponentIdentification(address)) - { - // Create query message - queryId = queryIdentificationMessageCreate(); - if(!queryId) - { - // Constructor Failed - return false; - } - - queryId->queryField = JAUS_QUERY_FIELD_COMPONENT_IDENTITY; - txMessage = queryIdentificationMessageToJausMessage(queryId); - if(!txMessage) - { - // ToJausMessage Failed - queryIdentificationMessageDestroy(queryId); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - queryIdentificationMessageDestroy(queryId); - return true; - } - return false; -} - -bool NodeManagerComponent::sendQueryComponentServices(JausAddress address) -{ - QueryServicesMessage query = NULL; - JausMessage txMessage = NULL; - - // TODO: Check timeout and request limit - if( systemTree->hasComponent(address) && - !systemTree->hasComponentServices(address)) - { - // Create query message - query = queryServicesMessageCreate(); - if(!query) - { - // Constructor Failed - return false; - } - - txMessage = queryServicesMessageToJausMessage(query); - if(!txMessage) - { - // ToJausMessage Failed - queryServicesMessageDestroy(query); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - queryServicesMessageDestroy(query); - return true; - } - return false; -} - -bool NodeManagerComponent::sendQueryNodeConfiguration(JausAddress address, bool createEvent) -{ - QueryConfigurationMessage query = NULL; - JausMessage txMessage = NULL; - CreateEventMessage createEventMsg = NULL; - - // TODO: Check timeout and request limit - if( systemTree->hasNode(address) && - !systemTree->hasNodeConfiguration(address)) - { - // Create query message - query = queryConfigurationMessageCreate(); - if(!query) - { - // Constructor Failed - return false; - } - query->queryField = JAUS_NODE_CONFIGURATION; - - txMessage = queryConfigurationMessageToJausMessage(query); - if(!txMessage) - { - // ToJausMessage Failed - queryConfigurationMessageDestroy(query); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - - if(createEvent) - { - createEventMsg = createEventMessageCreate(); - if(!createEventMsg) - { - queryConfigurationMessageDestroy(query); - return false; - } - - // Setup Create Event PV - createEventMsg->presenceVector = 0; - jausByteSetBit(&createEventMsg->presenceVector, CREATE_EVENT_PV_QUERY_MESSAGE_BIT); - - createEventMsg->reportMessageCode = jausMessageGetComplimentaryCommandCode(query->commandCode); - createEventMsg->eventType = EVENT_EVERY_CHANGE_TYPE; - createEventMsg->queryMessage = queryConfigurationMessageToJausMessage(query); - if(!createEventMsg->queryMessage) - { - // Problem with queryConfigurationMessageToJausMessage - createEventMessageDestroy(createEventMsg); - queryConfigurationMessageDestroy(query); - return false; - } - - txMessage = createEventMessageToJausMessage(createEventMsg); - if(!txMessage) - { - // Problem with createEventMsgMessageToJausMessage - createEventMessageDestroy(createEventMsg); - queryConfigurationMessageDestroy(query); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - - createEventMessageDestroy(createEventMsg); - } - - queryConfigurationMessageDestroy(query); - return true; - } - return false; -} - -bool NodeManagerComponent::sendQuerySubsystemConfiguration(JausAddress address, bool createEvent) -{ - QueryConfigurationMessage query = NULL; - JausMessage txMessage = NULL; - CreateEventMessage createEventMsg = NULL; - - // TODO: Check timeout and request limit - if( systemTree->hasSubsystem(address) && - !systemTree->hasSubsystemConfiguration(address)) - { - // Create query message - query = queryConfigurationMessageCreate(); - if(!query) - { - // Constructor Failed - return false; - } - query->queryField = JAUS_SUBSYSTEM_CONFIGURATION; - - txMessage = queryConfigurationMessageToJausMessage(query); - if(!txMessage) - { - // ToJausMessage Failed - queryConfigurationMessageDestroy(query); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); // Send Query Node Configuration - - if(createEvent) - { - createEventMsg = createEventMessageCreate(); - if(!createEventMsg) - { - queryConfigurationMessageDestroy(query); - return false; - } - - // Setup Create Event PV - createEventMsg->presenceVector = 0; - jausByteSetBit(&createEventMsg->presenceVector, CREATE_EVENT_PV_QUERY_MESSAGE_BIT); - - createEventMsg->reportMessageCode = jausMessageGetComplimentaryCommandCode(query->commandCode); - createEventMsg->eventType = EVENT_EVERY_CHANGE_TYPE; - createEventMsg->queryMessage = queryConfigurationMessageToJausMessage(query); - if(!createEventMsg->queryMessage) - { - // Problem with queryConfigurationMessageToJausMessage - createEventMessageDestroy(createEventMsg); - queryConfigurationMessageDestroy(query); - return false; - } - - txMessage = createEventMessageToJausMessage(createEventMsg); - if(!txMessage) - { - // Problem with createEventMsgMessageToJausMessage - createEventMessageDestroy(createEventMsg); - queryConfigurationMessageDestroy(query); - return false; - } - - jausAddressCopy(txMessage->destination, address); - jausAddressCopy(txMessage->source, cmpt->address); - this->commMngr->receiveJausMessage(txMessage, this); - createEventMessageDestroy(createEventMsg); - } - - queryConfigurationMessageDestroy(query); - return true; - } - return false; -} - -int NodeManagerComponent::getNextEventId() -{ - int i; - for(i = 0; i < MAXIMUM_EVENT_ID; i++) - { - if(eventId[i] == false) - { - return i; - } - } - return -1; -} - -bool NodeManagerComponent::setupJausServices() -{ - JausService service; - service = jausServiceCreate(0); - if(!service) return false; - jausServiceAddInputCommand(service, JAUS_SET_COMPONENT_AUTHORITY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_SHUTDOWN, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_STANDBY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_RESUME, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_RESET, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_SET_EMERGENCY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CLEAR_EMERGENCY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CREATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_ACTIVATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_SUSPEND_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_TERMINATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_REQUEST_COMPONENT_CONTROL, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_QUERY_COMPONENT_AUTHORITY, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_QUERY_COMPONENT_STATUS, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_QUERY_HEARTBEAT_PULSE, NO_PRESENCE_VECTOR); - - jausServiceAddOutputCommand(service, JAUS_CREATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_CONFIRM_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_TERMINATE_SERVICE_CONNECTION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_CONFIRM_COMPONENT_CONTROL, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REJECT_COMPONENT_CONTROL, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_COMPONENT_AUTHORITY, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_COMPONENT_STATUS, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_HEARTBEAT_PULSE, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_QUERY_COMPONENT_STATUS, NO_PRESENCE_VECTOR); - - // Add Core Service - jausServiceAddService(cmpt->services, service); - - service = jausServiceCreate(JAUS_NODE_MANAGER); - if(!service) return false; - jausServiceAddInputCommand(service, JAUS_QUERY_CONFIGURATION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_QUERY_IDENTIFICATION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_QUERY_SERVICES, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_REPORT_CONFIGURATION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_REPORT_IDENTIFICATION, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_REPORT_SERVICES, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CANCEL_EVENT, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CONFIRM_EVENT_REQUEST, NO_PRESENCE_VECTOR); - jausServiceAddInputCommand(service, JAUS_CREATE_EVENT, NO_PRESENCE_VECTOR); - - jausServiceAddOutputCommand(service, JAUS_QUERY_CONFIGURATION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_QUERY_IDENTIFICATION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_QUERY_SERVICES, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_CONFIGURATION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_IDENTIFICATION, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_REPORT_SERVICES, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_CANCEL_EVENT, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_CONFIRM_EVENT_REQUEST, NO_PRESENCE_VECTOR); - jausServiceAddOutputCommand(service, JAUS_CREATE_EVENT, NO_PRESENCE_VECTOR); - - // Add Node Manager Service - jausServiceAddService(cmpt->services, service); - - return true; -} - -void NodeManagerComponent::handleEvent(NodeManagerEvent *e) -{ - SystemTreeEvent *treeEvent; - - switch(e->getType()) - { - case NodeManagerEvent::SystemTreeEvent: - treeEvent = (SystemTreeEvent *)e; - switch(treeEvent->getSubType()) - { - case SystemTreeEvent::NodeTimeout: - this->sendSubsystemChangedEvents(); - break; - - case SystemTreeEvent::ComponentTimeout: - this->sendSubsystemChangedEvents(); - this->sendNodeChangedEvents(); - break; - - default: - // Nothing - break; - } - delete e; - break; - - default: - delete e; - break; - } -} - diff --git a/lib/openjaus/libopenJaus/src/nodeManager/OjUdpComponentInterface.cpp b/lib/openjaus/libopenJaus/src/nodeManager/OjUdpComponentInterface.cpp deleted file mode 100644 index 08ecaf9def37f1921fa3009177b62fa9e5de902a..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/OjUdpComponentInterface.cpp +++ /dev/null @@ -1,433 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: OjUdpComponentInterface.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file provides an interface through which the NM communicates -// to components using a non-JAUS compliant synchronous UDP port over -// the loopback device. - -#include "nodeManager/OjUdpComponentInterface.h" -#include "nodeManager/events/ErrorEvent.h" - -OjUdpComponentInterface::OjUdpComponentInterface(FileLoader *configData, EventHandler *handler, JausComponentCommunicationManager *cmptMngr) -{ - this->configData = configData; - this->commMngr = cmptMngr; - this->eventHandler = handler; - - this->systemTree = cmptMngr->getSystemTree(); - this->nodeManager = cmptMngr->getNodeManagerComponent(); - this->type = COMPONENT_INTERFACE; - this->name = "OpenJAUS UDP Component to Node Manager Interface"; - this->portMap.empty(); - - // Open our socket - if(!this->openSocket()) - { - throw "OjUdpComponentInterface: Could not open socket\n"; - } -} - -OjUdpComponentInterface::~OjUdpComponentInterface(void) -{ - if(running) - { - this->stopInterface(); - } - this->closeSocket(); -} - -unsigned int OjUdpComponentInterface::getPort(void) -{ - return this->socket->port; -} - -bool OjUdpComponentInterface::startInterface() -{ - // Setup our thread control flag - this->running = true; - - // Setup our pThread - this->startThread(); - - return true; -} - -bool OjUdpComponentInterface::stopInterface() -{ - // Set our thread control flag to false - this->running = false; - - // Stop our pThread - this->stopThread(); - - return true; -} - -bool OjUdpComponentInterface::processMessage(JausMessage message) -{ - // This interface does not transport jaus messages - // This isn't an "error" because the cmptMngr send JausMessages to all known interfaces for broadcasts - jausMessageDestroy(message); - return false; -} - -bool OjUdpComponentInterface::sendDatagramPacket(DatagramPacket dgPacket) -{ - return true; -} - -bool OjUdpComponentInterface::openSocket(void) -{ - // Read Configuration - if(this->configData->GetConfigDataString("Component_Communications", "OpenJAUS_UDP_Port") == "") - { - this->portNumber = OJ_UDP_DEFAULT_PORT; - } - else - { - this->portNumber = this->configData->GetConfigDataInt("Component_Communications", "OpenJAUS_UDP_Port"); - } - - // IP Address - if(this->configData->GetConfigDataString("Component_Communications", "OpenJAUS_UDP_IP_Address") == "") - { - this->ipAddress = inetAddressGetByString((char *)OJ_UDP_DEFAULT_COMPONENT_IP.c_str()); - if(this->ipAddress == NULL) - { - // Cannot open specified IP Address - char errorString[128] = {0}; - sprintf(errorString, "Could not open default IP Address: %s", OJ_UDP_DEFAULT_COMPONENT_IP.c_str()); - - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return false; - } - } - else - { - this->ipAddress = inetAddressGetByString((char *)this->configData->GetConfigDataString("Component_Communications", "OpenJAUS_UDP_IP_Address").c_str()); - if(this->ipAddress == NULL) - { - // Cannot open specified IP Address - char errorString[128] = {0}; - sprintf(errorString, "Could not open specified IP Address: %s", this->configData->GetConfigDataString("Component_Communications", "OpenJAUS_UDP_IP_Address").c_str()); - - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, errorString); - this->eventHandler->handleEvent(e); - return false; - } - } - - // Create Component Socket - this->socket = datagramSocketCreate(this->portNumber, ipAddress); - if(!this->socket) - { - // Error creating our socket - return false; - } - - inetAddressDestroy(this->ipAddress); - - // Setup Timeout - if(this->configData->GetConfigDataString("Component_Communications", "OpenJAUS_UDP_Timeout_Sec") == "") - { - datagramSocketSetTimeout(this->socket, OJ_UDP_DEFAULT_TIMEOUT); - } - else - { - datagramSocketSetTimeout(this->socket, this->configData->GetConfigDataDouble("Component_Communications", "OpenJAUS_UDP_Timeout_Sec")); - } - - return true; -} - -void OjUdpComponentInterface::closeSocket(void) -{ - datagramSocketDestroy(this->socket); -} - -void OjUdpComponentInterface::run() -{ - DatagramPacket packet; - JausAddress address, currentAddress; - JausAddress lookupAddress; - int bytesRecv = 0; - char buf[256] = {0}; - int componentId = 0; - int commandCode = 0; - int serviceType = 0; - - packet = datagramPacketCreate(); - packet->bufferSizeBytes = OJ_UDP_INTERFACE_MESSAGE_SIZE_BYTES; - packet->buffer = (unsigned char *) calloc(packet->bufferSizeBytes, 1); - - while(this->running) - { - bytesRecv = datagramSocketReceive(this->socket, packet); - if(bytesRecv == OJ_UDP_INTERFACE_MESSAGE_SIZE_BYTES) - { - // This is to ensure we are using a valid NM pointer (this occurs - this->nodeManager = ((JausComponentCommunicationManager *)this->commMngr)->getNodeManagerComponent(); - - switch(packet->buffer[0]) - { - case CHECK_IN: - componentId = (packet->buffer[1] & 0xFF); - if(componentId < JAUS_MINIMUM_COMPONENT_ID || componentId > JAUS_MAXIMUM_COMPONENT_ID) - { - sprintf(buf, "Invalid Component Id (%d) trying to check in.", componentId); - ErrorEvent *e = new ErrorEvent(ErrorEvent::Configuration, __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - return; - } - - address = this->nodeManager->checkInLocalComponent(componentId); - if(!address || !jausAddressIsValid(address)) - { - sprintf(buf, "Cannot add local component with Id: %d.", componentId); - ErrorEvent *e = new ErrorEvent(ErrorEvent::Warning, __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - - // TODO: Send back checkin error reply (no available instance) - break; - } - - memset(packet->buffer, 0, OJ_UDP_INTERFACE_MESSAGE_SIZE_BYTES); - packet->buffer[0] = REPORT_ADDRESS; - packet->buffer[1] = (unsigned char)(address->instance & 0xFF); - packet->buffer[2] = (unsigned char)(address->component & 0xFF); - packet->buffer[3] = (unsigned char)(address->node & 0xFF); - packet->buffer[4] = (unsigned char)(address->subsystem & 0xFF); - - datagramSocketSend(this->socket, packet); - jausAddressDestroy(address); - break; - - case CHECK_OUT: - nodeManager->checkOutLocalComponent(packet->buffer[4], packet->buffer[3], packet->buffer[2], packet->buffer[1]); - break; - - case VERIFY_ADDRESS: - lookupAddress = jausAddressCreate(); - lookupAddress->instance = (packet->buffer[1] & 0xFF); - lookupAddress->component = (packet->buffer[2] & 0xFF); - lookupAddress->node = (packet->buffer[3] & 0xFF); - lookupAddress->subsystem = (packet->buffer[4] & 0xFF); - - memset(packet->buffer, 0, OJ_UDP_INTERFACE_MESSAGE_SIZE_BYTES); - packet->buffer[0] = ADDRESS_VERIFIED; - if(this->systemTree->hasComponent(lookupAddress)) - { - packet->buffer[1] = JAUS_TRUE; - } - else - { - packet->buffer[1] = JAUS_FALSE; - } - - datagramSocketSend(this->socket, packet); - jausAddressDestroy(lookupAddress); - break; - - case GET_COMPONENT_ADDRESS_LIST: - componentId = packet->buffer[1] & 0xFF; - - address = systemTree->lookUpAddress(JAUS_ADDRESS_WILDCARD_OCTET, JAUS_ADDRESS_WILDCARD_OCTET, componentId, JAUS_ADDRESS_WILDCARD_OCTET); - memset(packet->buffer, 0, OJ_UDP_INTERFACE_MESSAGE_SIZE_BYTES); - packet->buffer[0] = COMPONENT_ADDRESS_LIST_RESPONSE; - // - if(!address || !jausAddressIsValid(address)) - { - packet->buffer[1] = (unsigned char)(JAUS_INVALID_INSTANCE_ID & 0xFF); - packet->buffer[2] = (unsigned char)(JAUS_INVALID_COMPONENT_ID & 0xFF); - packet->buffer[3] = (unsigned char)(JAUS_INVALID_NODE_ID & 0xFF); - packet->buffer[4] = (unsigned char)(JAUS_INVALID_SUBSYSTEM_ID & 0xFF); - } - else - { - packet->buffer[1] = (unsigned char)(address->instance & 0xFF); - packet->buffer[2] = (unsigned char)(address->component & 0xFF); - packet->buffer[3] = (unsigned char)(address->node & 0xFF); - packet->buffer[4] = (unsigned char)(address->subsystem & 0xFF); - } - datagramSocketSend(this->socket, packet); - jausAddressDestroy(address); - break; - - case LOOKUP_ADDRESS: - lookupAddress = jausAddressCreate(); - lookupAddress->instance = (packet->buffer[1] & 0xFF); - lookupAddress->component = (packet->buffer[2] & 0xFF); - lookupAddress->node = (packet->buffer[3] & 0xFF); - lookupAddress->subsystem = (packet->buffer[4] & 0xFF); - - memset(packet->buffer, 0, OJ_UDP_INTERFACE_MESSAGE_SIZE_BYTES); - packet->buffer[0] = LOOKUP_ADDRESS_RESPONSE; - - address = systemTree->lookUpAddress(lookupAddress); - if(address && jausAddressIsValid(address)) - { - packet->buffer[5] = (unsigned char) JAUS_TRUE; - } - else - { - packet->buffer[5] = (unsigned char) JAUS_FALSE; - } - - packet->buffer[1] = (unsigned char) (address->instance & 0xFF); - packet->buffer[2] = (unsigned char) (address->component & 0xFF); - packet->buffer[3] = (unsigned char) (address->node & 0xFF); - packet->buffer[4] = (unsigned char) (address->subsystem & 0xFF); - datagramSocketSend(this->socket, packet); - - while(address) // NMJ - { // NMJ - currentAddress = address; // NMJ - address = address->next; // NMJ - jausAddressDestroy(currentAddress); // NMJ - } // NMJ - - jausAddressDestroy(lookupAddress); - break; - - case LOOKUP_SERVICE_ADDRESS: - lookupAddress = jausAddressCreate(); - lookupAddress->instance = (packet->buffer[1] & 0xFF); - lookupAddress->component = (packet->buffer[2] & 0xFF); - lookupAddress->node = (packet->buffer[3] & 0xFF); - lookupAddress->subsystem = (packet->buffer[4] & 0xFF); - - commandCode = (packet->buffer[5] & 0xFF) + ((packet->buffer[6] & 0xFF) << 8); - serviceType = (packet->buffer[7] & 0xFF); - - memset(packet->buffer, 0, OJ_UDP_INTERFACE_MESSAGE_SIZE_BYTES); - packet->buffer[0] = LOOKUP_SERVICE_ADDRESS_RESPONSE; - - address = systemTree->lookUpServiceInSystem(commandCode, serviceType); - if(address && jausAddressIsValid(address)) - { - packet->buffer[5] = (unsigned char) JAUS_TRUE; - packet->buffer[1] = (unsigned char) (address->instance & 0xFF); - packet->buffer[2] = (unsigned char) (address->component & 0xFF); - packet->buffer[3] = (unsigned char) (address->node & 0xFF); - packet->buffer[4] = (unsigned char) (address->subsystem & 0xFF); - } - else - { - packet->buffer[5] = (unsigned char) JAUS_FALSE; - } - - datagramSocketSend(this->socket, packet); - - if(address) - { - jausAddressDestroy(address); - jausAddressDestroy(lookupAddress); - } - - break; - - //case InterfaceMessage.NODE_MANAGER_LOOKUP_SERVICE_ADDRESS_LIST: - // lookupAddress = jausAddressCreate(); - // lookupAddress->instance(packet->buffer[1] & 0xFF); - // lookupAddress->component(packet->buffer[2] & 0xFF); - // lookupAddress->node(packet->buffer[3] & 0xFF); - // lookupAddress->subsystem(packet->buffer[4] & 0xFF); - // - // commandCode = (packet->buffer[5] & 0xFF) + ((packet->buffer[6] & 0xFF) << 8); - // serviceType = (packet->buffer[7] & 0xFF); - - // memset(packet->buffer, 0, OJ_UDP_INTERFACE_MESSAGE_SIZE_BYTES); - // packet->buffer[0] = LOOKUP_SERVICE_ADDRESS_LIST_RESPONSE; - - // //System.out.println("CmptInterface: Get address for component ID: " + componentId); - // //address = subsystemTable.lookupServiceAddressList(address, commandCode, serviceCommandType); - // - // if(lookupAddress->subsystem == - - // if(address == null) - // { - // replyMessage.getData()[0] = (byte)(0 & 0xff); - // replyMessage.getData()[1] = (byte)(0 & 0xff); - // replyMessage.getData()[2] = (byte)(0 & 0xff); - // replyMessage.getData()[3] = (byte)(0 & 0xff); - // replyMessage.getData()[4] = (byte)0; - // //System.out.println("CmptInterface: Get address for component ID: " + componentId + " returning: 0.0.0.0"); - // } - // else - // { - // replyMessage.getData()[0] = (byte)(address.getInstance() & 0xff); - // replyMessage.getData()[1] = (byte)(address.getComponent() & 0xff); - // replyMessage.getData()[2] = (byte)(address.getNode() & 0xff); - // replyMessage.getData()[3] = (byte)(address.getSubsystem() & 0xff); - // replyMessage.getData()[4] = (byte)1; - // //System.out.println("CmptInterface: Get address for component ID: " + componentId + " returning: " + address); - // } - // - // replyBuffer = new byte[8]; - // replyMessage.pack(replyBuffer); - // outPacket = new DatagramPacket(replyBuffer, replyBuffer.length, packet.getAddress(), packet.getPort()); - // socket.send(outPacket); - // break; - - default: - sprintf(buf, "Unknown Interface Message Received. CC: 0x%02X\n", packet->buffer[0]); - ErrorEvent *e = new ErrorEvent(ErrorEvent::Warning, __FUNCTION__, __LINE__, buf); - this->eventHandler->handleEvent(e); - break; - } - } - } - - free(packet->buffer); - datagramPacketDestroy(packet); -} - -bool OjUdpComponentInterface::processOjNodemanagerInterfaceMessage(char *buffer) -{ - return true; -} - -std::string OjUdpComponentInterface::toString() -{ - return this->name; -} - diff --git a/lib/openjaus/libopenJaus/src/nodeManager/SystemTree.cpp b/lib/openjaus/libopenJaus/src/nodeManager/SystemTree.cpp deleted file mode 100644 index a20012e04d572a4cb62b5ce8848f48859e2cbd26..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/SystemTree.cpp +++ /dev/null @@ -1,1755 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: SystemTree.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) and Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the SystemTree class which manages the list of -// JAUS subsystems and their associated nodes and components. - -#include -#include "nodeManager/SystemTree.h" -#include "utils/timeLib.h" -#include "nodeManager/events/SystemTreeEvent.h" - -SystemTree::SystemTree(FileLoader *configData, EventHandler *handler) -{ - this->configData = configData; - this->registerEventHandler(handler); - - mySubsystemId = configData->GetConfigDataInt("JAUS", "SubsystemId"); - myNodeId = configData->GetConfigDataInt("JAUS", "NodeId"); - - memset(system, 0, sizeof(system)); - subsystemCount = 0; -} - -SystemTree::~SystemTree(void) -{ - for(int i = JAUS_MINIMUM_SUBSYSTEM_ID; i < JAUS_MAXIMUM_SUBSYSTEM_ID; i++) - { - if(system[i]) - { - jausSubsystemDestroy(system[i]); - } - } - // TODO: Delete all the memory I own (system) -} - -bool SystemTree::updateComponentTimestamp(JausAddress address) -{ - JausComponent cmpt = findComponent(address); - if(cmpt) - { - jausComponentUpdateTimestamp(cmpt); - return true; - } - else - { - return false; - } -} - -bool SystemTree::updateNodeTimestamp(JausAddress address) -{ - JausNode node = findNode(address); - if(node) - { - jausNodeUpdateTimestamp(node); - return true; - } - else - { - return false; - } -} - -bool SystemTree::updateSubsystemTimestamp(JausAddress address) -{ - JausSubsystem subs = system[address->subsystem]; - if(subs) - { - jausSubsystemUpdateTimestamp(subs); - return true; - } - else - { - return false; - } -} - -unsigned char SystemTree::getNextInstanceId(JausAddress address) -{ - bool instanceAvailable[JAUS_MAXIMUM_INSTANCE_ID] = {true}; - int i = 0; - - for(i=0; i < JAUS_MAXIMUM_INSTANCE_ID; i++) - { - instanceAvailable[i] = true; - } - - // Get this node - JausNode node = findNode(address->subsystem, address->node); - - if(node) - { - // We'll go through all the attached components and check for matches - for(i=0; i < node->components->elementCount; i++) - { - JausComponent cmpt = (JausComponent) node->components->elementData[i]; - - // if this is the same cmpt Id, we'll mark that instance as used - if(cmpt->address->component == address->component) - { - instanceAvailable[cmpt->address->instance] = false; - } - } - - // Find the lowest value instance that is available - i = JAUS_MINIMUM_INSTANCE_ID; - while(i <= JAUS_MAXIMUM_INSTANCE_ID) - { - if(instanceAvailable[i]) - { - return i; - } - i++; - } - return JAUS_INVALID_INSTANCE_ID; - } - return JAUS_INVALID_INSTANCE_ID; -} - -bool SystemTree::hasComponent(JausComponent cmpt) -{ - JausAddress address = cmpt->address; - return hasComponent(address->subsystem, address->node, address->component, address->instance); -} - -bool SystemTree::hasComponent(JausAddress address) -{ - return hasComponent(address->subsystem, address->node, address->component, address->instance); -} - -bool SystemTree::hasComponent(int subsystemId, int nodeId, int componentId, int instanceId) -{ - JausComponent cmpt = findComponent(subsystemId, nodeId, componentId, instanceId); - if(cmpt) - { - return true; - } - else - { - return false; - } -} - -bool SystemTree::hasNode(JausNode node) -{ - return hasNode(node->subsystem->id, node->id); -} - -bool SystemTree::hasNode(JausAddress address) -{ - return hasNode(address->subsystem, address->node); -} - -bool SystemTree::hasNode(int subsystemId, int nodeId) -{ - JausNode node = findNode(subsystemId, nodeId); - if(node) - { - return true; - } - else - { - return false; - } -} - -bool SystemTree::hasSubsystem(JausSubsystem subsystem) -{ - return hasSubsystem(subsystem->id); -} - -bool SystemTree::hasSubsystem(JausAddress address) -{ - return hasSubsystem(address->subsystem); -} - -bool SystemTree::hasSubsystem(int subsystemId) -{ - if(system[subsystemId]) - { - return true; - } - else - { - return false; - } -} - -bool SystemTree::hasSubsystemConfiguration(JausSubsystem subsystem) -{ - return hasSubsystemConfiguration(subsystem->id); -} - -// TODO: Move this to JausSubsystem -bool SystemTree::hasSubsystemConfiguration(JausAddress address) -{ - return hasSubsystemConfiguration(address->subsystem); -} - -bool SystemTree::hasSubsystemConfiguration(int subsId) -{ - if(system[subsId]) - { - JausSubsystem subs = system[subsId]; - if(subs->nodes->elementCount > 0) - { - return true; - } - else - { - return false; - } - } - else - { - return false; - } -} - -bool SystemTree::hasSubsystemIdentification(JausSubsystem subsystem) -{ - return hasSubsystemIdentification(subsystem->id); -} - -bool SystemTree::hasSubsystemIdentification(JausAddress address) -{ - return hasSubsystemIdentification(address->subsystem); -} - -bool SystemTree::hasSubsystemIdentification(int subsId) -{ - JausSubsystem subs = system[subsId]; - if(subs && subs->identification) - { - return true; - } - else - { - return false; - } -} - -bool SystemTree::hasNodeIdentification(JausNode node) -{ - return hasNodeIdentification(node->subsystem->id, node->id); -} - -bool SystemTree::hasNodeIdentification(JausAddress address) -{ - return hasNodeIdentification(address->subsystem, address->node); -} - -bool SystemTree::hasNodeIdentification(int subsystemId, int nodeId) -{ - JausNode node = findNode(subsystemId, nodeId); - if(node && node->identification) - { - return true; - } - else - { - return false; - } -} - -bool SystemTree::hasNodeConfiguration(JausAddress address) -{ - JausNode node = findNode(address); - if(node && node->components->elementCount > 0) - { - return true; - } - else - { - return false; - } -} - -bool SystemTree::hasComponentIdentification(JausAddress address) -{ - return hasComponentIdentification(address->subsystem, address->node, address->component, address->instance); -} - -bool SystemTree::hasComponentIdentification(int subsystemId, int nodeId, int componentId, int instanceId) -{ - JausComponent cmpt = findComponent(subsystemId, nodeId, componentId, instanceId); - if(cmpt && cmpt->identification) - { - return true; - } - else - { - return false; - } -} - -bool SystemTree::hasComponentServices(JausAddress address) -{ - return hasComponentServices(address->subsystem, address->node, address->component, address->instance); -} - -bool SystemTree::hasComponentServices(int subsystemId, int nodeId, int componentId, int instanceId) -{ - JausComponent cmpt = findComponent(subsystemId, nodeId, componentId, instanceId); - if(cmpt && cmpt->services->elementCount > 0) - { - return true; - } - else - { - return false; - } -} - -JausAddress SystemTree::lookUpAddress(JausAddress address) -{ - return lookUpAddress(address->subsystem, address->node, address->component, address->instance); -} - -JausAddress SystemTree::lookUpAddressInNode(JausNode node, int lookupCmpt, int lookupInst) -{ - if(node) - { - for(int i = 0; i < node->components->elementCount; i++) - { - JausComponent cmpt = (JausComponent)node->components->elementData[i]; - if(lookupCmpt == JAUS_ADDRESS_WILDCARD_OCTET) - { - if(lookupInst == JAUS_ADDRESS_WILDCARD_OCTET) - { - return jausAddressClone(cmpt->address); - } - else - { - if(cmpt->address->instance == lookupInst) - { - return jausAddressClone(cmpt->address); - } - } - } - else - { - if(cmpt->address->component == lookupCmpt) - { - if(lookupInst == JAUS_ADDRESS_WILDCARD_OCTET) - { - return jausAddressClone(cmpt->address); - } - else - { - if(cmpt->address->instance == lookupInst) - { - return jausAddressClone(cmpt->address); - } - } - } - } - } - } - return NULL; -} - -JausAddress SystemTree::lookUpAddressInSubsystem(JausSubsystem subs, int lookupNode, int lookupCmpt, int lookupInst) -{ - if(subs) - { - if(lookupNode == JAUS_ADDRESS_WILDCARD_OCTET) - { - for(int i = 0; i < subs->nodes->elementCount; i++) - { - JausNode node = (JausNode)subs->nodes->elementData[i]; - JausAddress address = lookUpAddressInNode(node, lookupCmpt, lookupInst); - if(address) - { - return address; - } - } - } - else - { - return lookUpAddressInNode(findNode(subs->id, lookupNode), lookupCmpt, lookupInst); - } - } - return NULL; -} - -JausAddress SystemTree::lookUpAddress2(int lookupSubs, int lookupNode, int lookupCmpt, int lookupInst) -{ - if(lookupSubs == JAUS_ADDRESS_WILDCARD_OCTET) - { - for(int i = JAUS_MINIMUM_SUBSYSTEM_ID; i < JAUS_MAXIMUM_SUBSYSTEM_ID; i++) - { - JausAddress address = lookUpAddressInSubsystem(system[i], lookupNode, lookupCmpt, lookupInst); - if(address) - { - return address; - } - } - } - else - { - return lookUpAddressInSubsystem(system[lookupSubs], lookupNode, lookupCmpt, lookupInst); - } - return NULL; -} - -JausAddress SystemTree::lookUpAddress(int lookupSubs, int lookupNode, int lookupCmpt, int lookupInst) -{ - JausSubsystem subs = NULL; - JausNode node = NULL; - JausComponent cmpt = NULL; - - JausAddress address = jausAddressCreate(); - if(!address) - { - // TODO: Log Error. Throw Exception. - return NULL; - } - address->subsystem = JAUS_INVALID_SUBSYSTEM_ID; - address->node = JAUS_INVALID_NODE_ID; - address->component = JAUS_INVALID_COMPONENT_ID; - address->instance = JAUS_INVALID_INSTANCE_ID; - address->next = NULL; - - JausAddress returnAddress = address; - - // Find this address - // If the subsystem is a wild card - if(lookupSubs == JAUS_ADDRESS_WILDCARD_OCTET) - { - // Look through all subsystems - for(int i = JAUS_MINIMUM_SUBSYSTEM_ID; i < JAUS_MAXIMUM_SUBSYSTEM_ID; i++) - { - subs = system[i]; - if(!subs) - { - continue; - } - - // If the node is a wild card - if(lookupNode == JAUS_ADDRESS_WILDCARD_OCTET) - { - // Look through all nodes - for(int j = 0; j < subs->nodes->elementCount; j++) - { - node = (JausNode) subs->nodes->elementData[j]; - - // If the component or the instance is a wild card - if(lookupCmpt == JAUS_ADDRESS_WILDCARD_OCTET || lookupInst == JAUS_ADDRESS_WILDCARD_OCTET) - { - // Look through all components - for(int k = 0; k < node->components->elementCount; k++) - { - cmpt = (JausComponent) node->components->elementData[k]; - - // If the component is wild card and this is the instance we are looking for - if( lookupCmpt == JAUS_ADDRESS_WILDCARD_OCTET && cmpt->address->instance == lookupInst) - { - // If the address is valid (it should never be) - if(jausAddressIsValid(address)) - { - address->next = jausAddressClone(cmpt->address); // Why do we clone if the address is valid?? - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - // Address was not valid - else - { - jausAddressCopy(address, cmpt->address); // Copy the address of the component we are looking at - address->next = jausAddressCreate(); // Create a new address. Gets created even if we don't do anything else? - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - } - // If the instance is a wild card and this is the component we are looking for - else if(lookupInst == JAUS_ADDRESS_WILDCARD_OCTET && cmpt->address->component == lookupCmpt) - { - if(jausAddressIsValid(address)) - { - address->next = jausAddressClone(cmpt->address); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - else - { - jausAddressCopy(address, cmpt->address); - address->next = jausAddressCreate(); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - } - } - } - else - { - cmpt = findComponent(subs->id, node->id, lookupCmpt, lookupInst); - - if(cmpt) - { - if(jausAddressIsValid(address)) - { - address->next = jausAddressClone(cmpt->address); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - else - { - jausAddressCopy(address, cmpt->address); - address->next = jausAddressCreate(); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - } - } - } - } - else - { - node = findNode(i, lookupNode); - if(lookupCmpt == JAUS_ADDRESS_WILDCARD_OCTET || lookupInst == JAUS_ADDRESS_WILDCARD_OCTET) - { - // Look through all components - for(int k = 0; k < node->components->elementCount; k++) - { - cmpt = (JausComponent) node->components->elementData[k]; - - if( lookupCmpt == JAUS_ADDRESS_WILDCARD_OCTET && - cmpt->address->instance == lookupInst) - { - if(jausAddressIsValid(address)) - { - address->next = jausAddressClone(cmpt->address); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - else - { - jausAddressCopy(address, cmpt->address); - address->next = jausAddressCreate(); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - } - else if(lookupInst == JAUS_ADDRESS_WILDCARD_OCTET && - cmpt->address->component == lookupCmpt) - { - if(jausAddressIsValid(address)) - { - address->next = jausAddressClone(cmpt->address); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - else - { - jausAddressCopy(address, cmpt->address); - address->next = jausAddressCreate(); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - } - } - } - else - { - cmpt = findComponent(subs->id, node->id, lookupCmpt, lookupInst); - - if(cmpt) - { - if(jausAddressIsValid(address)) - { - address->next = jausAddressClone(cmpt->address); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - else - { - jausAddressCopy(address, cmpt->address); - address->next = jausAddressCreate(); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - } - } - } - } - } - // We are looking within a specific subsystem - else - { - subs = system[lookupSubs]; - if(!subs) - { - // Subsystem not found - // TODO: Log Error. Throw Exception. - return address; - } - - if(lookupNode == JAUS_ADDRESS_WILDCARD_OCTET) - { - // Look through all nodes - for(int j = 0; j < subs->nodes->elementCount; j++) - { - node = (JausNode) subs->nodes->elementData[j]; - - if(lookupCmpt == JAUS_ADDRESS_WILDCARD_OCTET || lookupInst == JAUS_ADDRESS_WILDCARD_OCTET) - { - // Look through all components - for(int k = 0; k < node->components->elementCount; k++) - { - cmpt = (JausComponent) node->components->elementData[k]; - - if( lookupCmpt == JAUS_ADDRESS_WILDCARD_OCTET && cmpt->address->instance == lookupInst) - { - if(jausAddressIsValid(address)) - { - address->next = jausAddressClone(cmpt->address); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - else - { - jausAddressCopy(address, cmpt->address); - address->next = jausAddressCreate(); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - } - else if(lookupInst == JAUS_ADDRESS_WILDCARD_OCTET && cmpt->address->component == lookupCmpt) - { - if(jausAddressIsValid(address)) - { - address->next = jausAddressClone(cmpt->address); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - else - { - jausAddressCopy(address, cmpt->address); - address->next = jausAddressCreate(); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - } - } - } - else - { - cmpt = findComponent(subs->id, node->id, lookupCmpt, lookupInst); - - if(cmpt) - { - if(jausAddressIsValid(address)) - { - address->next = jausAddressClone(cmpt->address); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - else - { - jausAddressCopy(address, cmpt->address); - address->next = jausAddressCreate(); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - } - } - } - } - else - { - node = findNode(subs->id, lookupNode); - if(lookupCmpt == JAUS_ADDRESS_WILDCARD_OCTET || lookupInst == JAUS_ADDRESS_WILDCARD_OCTET) - { - // Look through all components - for(int k = 0; k < node->components->elementCount; k++) - { - cmpt = (JausComponent) node->components->elementData[k]; - - if( lookupCmpt == JAUS_ADDRESS_WILDCARD_OCTET && - cmpt->address->instance == lookupInst) - { - if(jausAddressIsValid(address)) - { - address->next = jausAddressClone(cmpt->address); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - else - { - jausAddressCopy(address, cmpt->address); - address->next = jausAddressCreate(); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - } - else if(lookupInst == JAUS_ADDRESS_WILDCARD_OCTET && - cmpt->address->component == lookupCmpt) - { - if(jausAddressIsValid(address)) - { - address->next = jausAddressClone(cmpt->address); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - else - { - jausAddressCopy(address, cmpt->address); - address->next = jausAddressCreate(); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - } - } - } - else - { - cmpt = findComponent(subs->id, node->id, lookupCmpt, lookupInst); - - if(cmpt) - { - if(jausAddressIsValid(address)) - { - address->next = jausAddressClone(cmpt->address); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - else - { - jausAddressCopy(address, cmpt->address); - address->next = jausAddressCreate(); - if(!address->next) - { - return returnAddress; - } - else - { - address = address->next; - } - } - } - } - } - } - return returnAddress; -} - -JausAddress SystemTree::lookUpServiceInSystem(int commandCode, int serviceType) -{ - JausAddress list = NULL; - JausAddress cur = list; - - if(serviceType != JAUS_SERVICE_INPUT_COMMAND && serviceType != JAUS_SERVICE_OUTPUT_COMMAND) - { - return NULL; - } - - for(int i = JAUS_MINIMUM_SUBSYSTEM_ID; i < JAUS_MAXIMUM_SUBSYSTEM_ID; i++) - { - JausSubsystem subs = system[i]; - if(!subs) - { - continue; - } - - for(int j = 0; j < subs->nodes->elementCount; j++) - { - JausNode node = (JausNode) subs->nodes->elementData[j]; - - for(int k = 0; k < node->components->elementCount; k++) - { - JausComponent cmpt = (JausComponent) node->components->elementData[k]; - - for(int m = 0; m < cmpt->services->elementCount; m++) - { - JausService service = (JausService) cmpt->services->elementData[m]; - JausCommand command = NULL; - switch(serviceType) - { - case JAUS_SERVICE_INPUT_COMMAND: - command = service->inputCommandList; - break; - - case JAUS_SERVICE_OUTPUT_COMMAND: - command = service->outputCommandList; - break; - - default: - // ERROR: Unknown service type - // SHOULD NEVER GET HERE, CHECKED ABOVE - return list; - } - - while(command) - { - if(command->commandCode == commandCode) - { - // YAY... we found a matching commandCode - // Add this component's address to our list - JausAddress address = jausAddressClone(cmpt->address); - address->next = NULL; - - if(list == NULL) - { - list = address; - cur = list->next; - } - else - { - cur->next = address; - cur = cur->next; - } - - // This is a cheat to skip the rest of the commands - // since a command should not repeat - command = NULL; - } - else - { - command = command->next; - } - } - } - } - } - } - - return list; - -} - -JausSubsystem *SystemTree::getSystem(void) -{ - if(subsystemCount == 0) - { - return NULL; - } - - JausSubsystem *systemClone = (JausSubsystem *)malloc(subsystemCount*sizeof(JausSubsystem)); - int systemCloneIndex = 0; - - for(int i = JAUS_MINIMUM_SUBSYSTEM_ID; i < JAUS_MAXIMUM_SUBSYSTEM_ID; i++) - { - if(system[i]) - { - systemClone[systemCloneIndex] = jausSubsystemClone(system[i]); - systemCloneIndex++; - } - } - return systemClone; -} - -JausSubsystem SystemTree::getSubsystem(JausSubsystem subsystem) -{ - return getSubsystem(subsystem->id); -} - -JausSubsystem SystemTree::getSubsystem(JausAddress address) -{ - return getSubsystem(address->subsystem); -} - -JausSubsystem SystemTree::getSubsystem(int subsystemId) -{ - JausSubsystem subs = system[subsystemId]; - if(subs) - { - return jausSubsystemClone(subs); - } - return NULL; -} - -JausNode SystemTree::getNode(JausNode node) -{ - return getNode(node->subsystem->id, node->id); -} - -JausNode SystemTree::getNode(JausAddress address) -{ - return getNode(address->subsystem, address->node); -} - -JausNode SystemTree::getNode(int subsystemId, int nodeId) -{ - JausNode node = findNode(subsystemId, nodeId); - if(node) - { - return jausNodeClone(node); - } - return NULL; -} - -JausComponent SystemTree::getComponent(JausComponent cmpt) -{ - return getComponent(cmpt->address->subsystem, cmpt->address->node, cmpt->address->component, cmpt->address->instance); -} - -JausComponent SystemTree::getComponent(JausAddress address) -{ - return getComponent(address->subsystem, address->node, address->component, address->instance); -} - -JausComponent SystemTree::getComponent(int subsystemId, int nodeId, int componentId, int instanceId) -{ - JausComponent cmpt = findComponent(subsystemId, nodeId, componentId, instanceId); - if(cmpt) - { - return jausComponentClone(cmpt); - } - return NULL; -} - -JausNode SystemTree::findNode(JausNode node) -{ - return findNode(node->subsystem->id, node->id); -} - -JausNode SystemTree::findNode(JausAddress address) -{ - return findNode(address->subsystem, address->node); -} - -JausNode SystemTree::findNode(int subsId, int nodeId) -{ - JausSubsystem subs = system[subsId]; - if(subs) - { - for(int i = 0; i < subs->nodes->elementCount; i++) - { - JausNode node = (JausNode)subs->nodes->elementData[i]; - if(node->id == nodeId) - { - return node; - } - } - } - return NULL; -} - -JausComponent SystemTree::findComponent(JausComponent cmpt) -{ - return findComponent(cmpt->address->subsystem, cmpt->address->node, cmpt->address->component, cmpt->address->instance); -} - -JausComponent SystemTree::findComponent(JausAddress address) -{ - return findComponent(address->subsystem, address->node, address->component, address->instance); -} - -JausComponent SystemTree::findComponent(int subsId, int nodeId, int cmptId, int instId) -{ - JausSubsystem subs = system[subsId]; - if(subs) - { - for(int i = 0; i < subs->nodes->elementCount; i++) - { - JausNode node = (JausNode)subs->nodes->elementData[i]; - if(node->id == nodeId) - { - for(int i = 0; i < node->components->elementCount; i++) - { - JausComponent cmpt = (JausComponent)node->components->elementData[i]; - if( cmpt->address->component == cmptId && cmpt->address->instance == instId ) - { - return cmpt; - } - } - return NULL; - } - } - } - return NULL; -} - -bool SystemTree::addComponent(JausComponent cmpt) -{ - return addComponent(cmpt->address->subsystem, cmpt->address->node, cmpt->address->component, cmpt->address->instance, cmpt); -} - -bool SystemTree::addComponent(JausAddress address, JausComponent cmpt) -{ - return addComponent(address->subsystem, address->node, address->component, address->instance, cmpt); -} - -bool SystemTree::addComponent(int subsystemId, int nodeId, int componentId, int instanceId, JausComponent cmpt) -{ - if(!this->hasComponent(subsystemId, nodeId, componentId, instanceId)) - { - JausNode node = findNode(subsystemId, nodeId); - if(node && componentId >= JAUS_MINIMUM_COMPONENT_ID && componentId <= JAUS_MAXIMUM_COMPONENT_ID - && instanceId >= JAUS_MINIMUM_INSTANCE_ID && instanceId <= JAUS_MAXIMUM_INSTANCE_ID) - { - // Add the component to the node - if(cmpt) - { - cmpt = jausComponentClone(cmpt); - } - else - { - cmpt = jausComponentCreate(); - cmpt->address->instance = instanceId; - cmpt->address->component = componentId; - cmpt->address->node = nodeId; - cmpt->address->subsystem = subsystemId; - } - cmpt->node = node; - - jausArrayAdd(node->components, cmpt); - SystemTreeEvent *e = new SystemTreeEvent(SystemTreeEvent::ComponentAdded, cmpt); - this->handleEvent(e); - return true; - } - } - - return false; -} - -bool SystemTree::addNode(JausNode node) -{ - return addNode(node->subsystem->id, node->id, node); -} - -bool SystemTree::addNode(JausAddress address, JausNode node) -{ - return addNode(address->subsystem, address->node, node); -} - -bool SystemTree::addNode(int subsystemId, int nodeId, JausNode node) -{ - if(!this->hasNode(subsystemId, nodeId)) - { - JausSubsystem subs = system[subsystemId]; - if(subs && nodeId >= JAUS_MINIMUM_NODE_ID && nodeId <= JAUS_MAXIMUM_NODE_ID) - { - if(node) - { - node = jausNodeClone(node); - } - else - { - node = jausNodeCreate(); - node->id = nodeId; - } - - node->subsystem = subs; - - jausArrayAdd(subs->nodes, node); - - SystemTreeEvent *e = new SystemTreeEvent(SystemTreeEvent::NodeAdded, node); - this->handleEvent(e); - - return true; - } - } - return false; -} - -bool SystemTree::addSubsystem(JausSubsystem subs) -{ - return addSubsystem(subs->id, subs); -} - -bool SystemTree::addSubsystem(JausAddress address, JausSubsystem subs) -{ - return addSubsystem(address->subsystem, subs); -} - -bool SystemTree::addSubsystem(int subsystemId, JausSubsystem subs) -{ - if(!this->hasSubsystem(subsystemId)) - { - // Test for valid ID - if(subsystemId >= JAUS_MINIMUM_SUBSYSTEM_ID && subsystemId <= JAUS_MAXIMUM_SUBSYSTEM_ID) - { - if(subs) - { - subs = jausSubsystemClone(subs); - } - else - { - subs = jausSubsystemCreate(); - subs->id = subsystemId; - } - - system[subs->id] = subs; - subsystemCount++; - - SystemTreeEvent *e = new SystemTreeEvent(SystemTreeEvent::SubsystemAdded, subs); - this->handleEvent(e); - - return true; - } - } - return false; -} - -bool SystemTree::removeNode(JausNode node) -{ - return removeNode(node->subsystem->id, node->id); -} - -bool SystemTree::removeNode(JausAddress address) -{ - return removeNode(address->subsystem, address->node); -} - -bool SystemTree::removeNode(int subsystemId, int nodeId) -{ - JausSubsystem subs = system[subsystemId]; - if(subs) - { - for(int i=0; inodes->elementCount; i++) - { - JausNode node = (JausNode)subs->nodes->elementData[i]; - if(nodeId == node->id) - { - jausArrayRemoveAt(subs->nodes, i); - - SystemTreeEvent *e = new SystemTreeEvent(SystemTreeEvent::NodeRemoved, node); - this->handleEvent(e); - - jausNodeDestroy(node); - return true; - } - } - } - return false; -} - -bool SystemTree::removeSubsystem(JausSubsystem subs) -{ - return removeSubsystem(subs->id); -} - -bool SystemTree::removeSubsystem(JausAddress address) -{ - return removeSubsystem(address->subsystem); -} - -bool SystemTree::removeSubsystem(int subsystemId) -{ - JausSubsystem subs = system[subsystemId]; - if(subs) - { - system[subsystemId] = NULL; - - SystemTreeEvent *e = new SystemTreeEvent(SystemTreeEvent::SubsystemRemoved, subs); - this->handleEvent(e); - - jausSubsystemDestroy(subs); - subsystemCount--; - return true; - } - return false; -} - -bool SystemTree::removeComponent(JausComponent cmpt) -{ - return removeComponent(cmpt->address->subsystem, cmpt->address->node, cmpt->address->component, cmpt->address->instance); -} - -bool SystemTree::removeComponent(JausAddress address) -{ - return removeComponent(address->subsystem, address->node, address->component, address->instance); -} - -bool SystemTree::removeComponent(int subsystemId, int nodeId, int componentId, int instanceId) -{ - JausNode node = findNode(subsystemId, nodeId); - if(node) - { - for(int i = 0; i < node->components->elementCount; i++) - { - JausComponent cmpt = (JausComponent) node->components->elementData[i]; - if(cmpt->address->component == componentId && cmpt->address->instance == instanceId) - { - jausArrayRemoveAt(node->components, i); - - SystemTreeEvent *e = new SystemTreeEvent(SystemTreeEvent::ComponentRemoved, cmpt); - this->handleEvent(e); - - jausComponentDestroy(cmpt); - return true; - } - } - } - return false; -} - -bool SystemTree::replaceSubsystem(JausAddress address, JausSubsystem newSubs) -{ - return replaceSubsystem(address->subsystem, newSubs); -} - -bool SystemTree::replaceSubsystem(int subsystemId, JausSubsystem newSubs) -{ - JausSubsystem currentSubs = system[subsystemId]; - if(!currentSubs) - { - addSubsystem(subsystemId, newSubs); // No subsystem to replace, so add the newSubs - return true; - } - - JausSubsystem cloneSubs = jausSubsystemClone(newSubs); - if(!cloneSubs) - { - return false; - } - - if(currentSubs->identification) - { - size_t stringLength = strlen(currentSubs->identification) + 1; - cloneSubs->identification = (char *) realloc(cloneSubs->identification, stringLength); - sprintf(cloneSubs->identification, "%s", currentSubs->identification); - } - - for(int i = 0; i < cloneSubs->nodes->elementCount; i++) - { - JausNode cloneNode = (JausNode)cloneSubs->nodes->elementData[i]; - JausNode currentNode = findNode(cloneNode); - if(currentNode) - { - if(currentNode->identification) - { - size_t stringLength = strlen(currentNode->identification) + 1; - cloneNode->identification = (char *) realloc(cloneNode->identification, stringLength); - sprintf(cloneNode->identification, "%s", currentNode->identification); - } - - for(int i = 0; i < cloneNode->components->elementCount; i++) - { - JausComponent cloneCmpt = (JausComponent)cloneNode->components->elementData[i]; - JausComponent currentCmpt = findComponent(cloneCmpt); - if(currentCmpt && currentCmpt->identification) - { - size_t stringLength = strlen(currentCmpt->identification) + 1; - cloneCmpt->identification = (char *) realloc(cloneCmpt->identification, stringLength); - sprintf(cloneCmpt->identification, "%s", currentNode->identification); - } - } - } - } - jausSubsystemDestroy(system[subsystemId]); - - system[subsystemId] = cloneSubs; - subsystemCount++; - - //char string[1024] = {0}; - //jausSubsystemTableToString(cloneSubs, string); - //printf("Replaced Subsystem: \n%s\n", string); - - return true; -} - -bool SystemTree::replaceNode(JausAddress address, JausNode newNode) -{ - return replaceNode(address->subsystem, address->node, newNode); -} - -bool SystemTree::replaceNode(int subsystemId, int nodeId, JausNode newNode) -{ - JausNode currentNode = findNode(subsystemId, nodeId); - if(!currentNode) - { - // No node to replace, so add the newNode - addNode(subsystemId, nodeId, newNode); - return true; - } - - JausNode cloneNode = jausNodeCreate(); - if(!cloneNode) - { - return false; - } - cloneNode->id = currentNode->id; - size_t stringLength = strlen(currentNode->identification) + 1; - cloneNode->identification = (char *) realloc(cloneNode->identification, stringLength); - sprintf(cloneNode->identification, "%s", currentNode->identification); - cloneNode->subsystem = currentNode->subsystem; - - for(int i = 0; i < newNode->components->elementCount; i++) - { - JausComponent newCmpt = (JausComponent)newNode->components->elementData[i]; - JausComponent addCmpt = findComponent(newCmpt); - if(addCmpt) - { - addCmpt = jausComponentClone(addCmpt); - } - else - { - addCmpt = jausComponentCreate(); - addCmpt->address->subsystem = subsystemId; - addCmpt->address->node = nodeId; - addCmpt->address->component = newCmpt->address->component; - addCmpt->address->instance = newCmpt->address->instance; - } - addCmpt->node = cloneNode; - jausArrayAdd(cloneNode->components, addCmpt); - } - - for(int i = 0; i < system[subsystemId]->nodes->elementCount; i++) - { - JausNode node = (JausNode)system[subsystemId]->nodes->elementData[i]; - if(currentNode->id == node->id) - { - jausArrayRemoveAt(system[subsystemId]->nodes, i); - jausNodeDestroy(node); - break; - } - } - - cloneNode->subsystem = system[subsystemId]; - jausArrayAdd(system[subsystemId]->nodes, cloneNode); - return true; -} - -bool SystemTree::setSubsystemIdentification(JausAddress address, char *identification) -{ - JausSubsystem subs = system[address->subsystem]; - if(subs) - { - size_t stringLength = strlen(identification) + 1; - subs->identification = (char *) realloc(subs->identification, stringLength); - if(subs->identification) - { - sprintf(subs->identification, "%s", identification); - return true; - } - } - return false; -} - -bool SystemTree::setNodeIdentification(JausAddress address, char *identification) -{ - JausNode node = findNode(address); - if(node) - { - size_t stringLength = strlen(identification) + 1; - node->identification = (char *) realloc(node->identification, stringLength); - if(node->identification) - { - sprintf(node->identification, "%s", identification); - return true; - } - } - return false; -} - -bool SystemTree::setComponentIdentification(JausAddress address, char *identification) -{ - JausComponent cmpt = findComponent(address); - if(cmpt) - { - size_t stringLength = strlen(identification) + 1; - cmpt->identification = (char *) realloc(cmpt->identification, stringLength); - if(cmpt->identification) - { - sprintf(cmpt->identification, "%s", identification); - return true; - } - } - return false; -} - -bool SystemTree::setComponentServices(JausAddress address, JausArray inputServices) -{ - JausComponent cmpt = findComponent(address); - if(cmpt) - { - // Remove current service set - if(cmpt->services) jausServicesDestroy(cmpt->services); - cmpt->services = jausServicesClone(inputServices); - return true; - } - return false; -} - -char *SystemTree::getSubsystemIdentification(JausSubsystem subsystem) -{ - return getSubsystemIdentification(subsystem->id); -} - -char *SystemTree::getSubsystemIdentification(JausAddress address) -{ - return getSubsystemIdentification(address->subsystem); -} - -char *SystemTree::getSubsystemIdentification(int subsId) -{ - char *string = NULL; - - JausSubsystem subs = system[subsId]; - if(subs) - { - string = (char *)calloc(strlen(subs->identification)+1, sizeof(char)); - strcpy(string, subs->identification); - return string; - } - else - { - return NULL; - } -} - -char *SystemTree::getNodeIdentification(JausNode node) -{ - return getNodeIdentification(node->subsystem->id, node->id); -} - -char *SystemTree::getNodeIdentification(JausAddress address) -{ - return getNodeIdentification(address->subsystem, address->node); -} - -char *SystemTree::getNodeIdentification(int subsId, int nodeId) -{ - char *string = NULL; - - JausNode node = findNode(subsId, nodeId); - if(node) - { - string = (char *)calloc(strlen(node->identification)+1, sizeof(char)); - strcpy(string, node->identification); - return string; - } - else - { - return NULL; - } -} - -std::string SystemTree::toString() -{ - string output = string(); - char buffer[4096] = {0}; - - if(subsystemCount == 0) - { - return "System Tree Empty\n"; - } - - for(int i = JAUS_MINIMUM_SUBSYSTEM_ID; i < JAUS_MAXIMUM_SUBSYSTEM_ID; i++) - { - if(system[i]) - { - jausSubsystemTableToString(system[i], buffer); - output += buffer; - output += "\n"; - } - } - - return output; -} - -std::string SystemTree::toDetailedString() -{ - string output = string(); - char buffer[20480] = {0}; - - if(subsystemCount == 0) - { - return "System Tree Empty\n"; - } - - for(int i = JAUS_MINIMUM_SUBSYSTEM_ID; i < JAUS_MAXIMUM_SUBSYSTEM_ID; i++) - { - if(system[i]) - { - jausSubsystemTableToDetailedString(system[i], buffer); - output += buffer; - output += "\n"; - } - } - - return output; -} - -void SystemTree::refresh() -{ - int i = 0; - int j = 0; - int k = 0; - - for(i = JAUS_MINIMUM_SUBSYSTEM_ID; i < JAUS_MAXIMUM_SUBSYSTEM_ID; i++) - { - if(system[i]) - { - if(system[i]->id == mySubsystemId) - { - for(j = 0; j < system[i]->nodes->elementCount; j++) - { - JausNode node = (JausNode) system[i]->nodes->elementData[j]; - if(node->id == myNodeId) - { - for(k = 0; k < node->components->elementCount; k++) - { - JausComponent cmpt = (JausComponent) node->components->elementData[k]; - - if(jausComponentIsTimedOut(cmpt)) - { - //NOTE: The order here is important b/c event handlers may inspect the system tree and - // we have to remove the cmpt from the tree before we notify of the change - - // Create Subsystem Event - SystemTreeEvent *e = new SystemTreeEvent(SystemTreeEvent::ComponentTimeout, cmpt); - - // Remove this component - jausArrayRemoveAt(node->components, k); k--; - - // Destroy this memory - jausComponentDestroy(cmpt); - - // Send off our event - this->handleEvent(e); - } - } - } - else - { - if(jausNodeIsTimedOut(node)) - { - //NOTE: The order here is important b/c event handlers may inspect the system tree and - // we have to remove the node from the tree before we notify of the change - - // Create a timeout event - SystemTreeEvent *e = new SystemTreeEvent(SystemTreeEvent::NodeTimeout, node); - - // Remove the Node - removeNode(node); - - // Handle the event - this->handleEvent(e); - } - } - } - } - else - { - if(jausSubsystemIsTimedOut(system[i])) - { - //NOTE: The order here is important b/c event handlers may inspect the system tree and - // we have to remove the node from the tree before we notify of the change - - // Create our event with the proper information - SystemTreeEvent *e = new SystemTreeEvent(SystemTreeEvent::SubsystemTimeout, system[i]); - - // Remove the dead subsystem - removeSubsystem(system[i]->id); - - // Handle the event - this->handleEvent(e); - } - } - } - } - -} - -bool SystemTree::registerEventHandler(EventHandler *handler) -{ - if(handler) - { - this->eventHandlers.push_back(handler); - return true; - } - return false; -} - -void SystemTree::handleEvent(NodeManagerEvent *e) -{ - // Send to all registered handlers - std::list ::iterator iter; - for(iter = eventHandlers.begin(); iter != eventHandlers.end(); iter++) - { - (*iter)->handleEvent(e->cloneEvent()); - } - delete e; -} - - diff --git a/lib/openjaus/libopenJaus/src/nodeManager/events/ConfigurationEvent.cpp b/lib/openjaus/libopenJaus/src/nodeManager/events/ConfigurationEvent.cpp deleted file mode 100644 index b683c5e1058eb721c113d760cd5143f4b25d8762..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/events/ConfigurationEvent.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: ConfigurationEvent.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the interface of an ConfigurationEvent, -// which is derived from a the NodeManagerEvent class - -#include "nodeManager/events/ConfigurationEvent.h" - -ConfigurationEvent::ConfigurationEvent(const char *function, long line, std::string userString) -{ - this->type = NodeManagerEvent::ConfigurationEvent; - this->userString = userString; - this->function = function; - this->line = line; -} - -ConfigurationEvent::~ConfigurationEvent() {} - -ConfigurationEvent *ConfigurationEvent::cloneEvent() -{ - return new ConfigurationEvent(this->function.c_str(), this->line, this->userString); -} - -std::string ConfigurationEvent::getUserString() -{ - return this->userString; -} - -std::string ConfigurationEvent::toString() -{ - return this->userString; -} diff --git a/lib/openjaus/libopenJaus/src/nodeManager/events/DebugEvent.cpp b/lib/openjaus/libopenJaus/src/nodeManager/events/DebugEvent.cpp deleted file mode 100644 index 4e561b18689054af8d60e57f9137418dde0c8e2f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/events/DebugEvent.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: DebugEvent.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the interface of an DebugEvent, -// which is derived from a the NodeManagerEvent class - -#include "nodeManager/events/DebugEvent.h" - -DebugEvent::DebugEvent(std::string debugClass) -{ - this->type = NodeManagerEvent::DebugEvent; - this->debugClass = debugClass; - this->debugString = ""; - this->line = -1; - this->function = ""; -} - -DebugEvent::DebugEvent(std::string debugClass, const char *function, long line, std::string debugString) -{ - this->type = NodeManagerEvent::DebugEvent; - this->debugClass = debugClass; - this->debugString = debugString; - this->function = function; - this->line = line; -} - -DebugEvent::~DebugEvent(){} - -DebugEvent *DebugEvent::cloneEvent() -{ - return new DebugEvent(this->debugClass, this->function.c_str(), this->line, this->debugString); -} - -std::string DebugEvent::getDebugString() -{ - return this->debugString; -} - -std::string DebugEvent::getDebugClass() -{ - return this->debugClass; -} - -std::string DebugEvent::toString() -{ - char buf[256] = {0}; - - sprintf(buf, "(%s:%ld) %s: %s", this->function.c_str(), this->line, this->debugClass.c_str(), this->debugString.c_str()); - - return buf; -} diff --git a/lib/openjaus/libopenJaus/src/nodeManager/events/ErrorEvent.cpp b/lib/openjaus/libopenJaus/src/nodeManager/events/ErrorEvent.cpp deleted file mode 100644 index d8ec48230169fd22c6f10ec1362e0c1a1e4d2bc1..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/events/ErrorEvent.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: ErrorEvent.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the interface of an ErrorEvent, -// which is derived from a the NodeManagerEvent class - -#include "nodeManager/events/ErrorEvent.h" - -ErrorEvent::ErrorEvent(unsigned int subType) -{ - this->type = NodeManagerEvent::ErrorEvent; - this->subType = subType; - this->userString = ""; - this->line = -1; - this->function = ""; -} - -ErrorEvent::ErrorEvent(unsigned int subType, const char *function, long line, std::string userString) -{ - this->type = NodeManagerEvent::ErrorEvent; - this->subType = subType; - this->userString = userString; - this->function = function; - this->line = line; -} - -ErrorEvent::~ErrorEvent() {} - -ErrorEvent *ErrorEvent::cloneEvent() -{ - return new ErrorEvent(this->subType, this->function.c_str(), this->line, this->userString); -} - -std::string ErrorEvent::getUserString() -{ - return this->userString; -} - -std::string ErrorEvent::toString() -{ - char buf[256] = {0}; - - if(subType != ErrorEvent::Warning) - { - sprintf(buf, "ERROR (%s:%ld): %s", function.c_str(), line, this->userString.c_str()); - } - else - { - sprintf(buf, "WARN (%s:%ld): %s", function.c_str(), line, this->userString.c_str()); - } - - return buf; -} diff --git a/lib/openjaus/libopenJaus/src/nodeManager/events/JausMessageEvent.cpp b/lib/openjaus/libopenJaus/src/nodeManager/events/JausMessageEvent.cpp deleted file mode 100644 index 2098526dd2bd503a8efe7197f3dd959647930b60..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/events/JausMessageEvent.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: JausMessageEvent.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the interface of a JausMessageEvent, -// which is derived from a the NodeManagerEvent class - -#include "nodeManager/events/JausMessageEvent.h" - -JausMessageEvent::JausMessageEvent(JausMessage message, JausTransportInterface *transport, unsigned char direction) -{ - this->type = NodeManagerEvent::JausMessageEvent; - this->message = message; - this->transport = transport; - this->direction = direction; -} - -JausMessageEvent::~JausMessageEvent() -{ - if(message != NULL) - { - jausMessageDestroy(message); - } -} - -JausMessageEvent *JausMessageEvent::cloneEvent() -{ - return new JausMessageEvent(jausMessageClone(this->message), this->transport, this->direction); -} - -JausMessage JausMessageEvent::getJausMessage() -{ - return this->message; -} - -JausTransportInterface *JausMessageEvent::getJausTransportInterface() -{ - return this->transport; -} - -unsigned char JausMessageEvent::getMessageDirection() -{ - return this->direction; -} - -std::string JausMessageEvent::toString() -{ - char buf[1024] = {0}; - char sourceString[80] = {0}; - char destinationString[80] = {0}; - - jausAddressToString(this->message->source, sourceString); - jausAddressToString(this->message->destination, destinationString); - - if(direction == JausMessageEvent::Inbound) - { - sprintf(buf, "RECEIVED: %s from %s to %s on interface: %s", jausMessageCommandCodeString(this->message), sourceString, destinationString, this->transport->toString().c_str()); - return buf; - } - else - { - sprintf(buf, "SENDING: %s from %s to %s on interface: %s", jausMessageCommandCodeString(this->message), sourceString, destinationString, this->transport->toString().c_str()); - return buf; - } -} - - diff --git a/lib/openjaus/libopenJaus/src/nodeManager/events/NodeManagerEvent.cpp b/lib/openjaus/libopenJaus/src/nodeManager/events/NodeManagerEvent.cpp deleted file mode 100644 index 330cd01a85421404593f6795b8552a8c64860992..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/events/NodeManagerEvent.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: NodeManagerEvent.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the interface of a NodeManagerEvent class -// NodeManagerEvent is a virtual class - -#include "nodeManager/events/NodeManagerEvent.h" - -NodeManagerEvent::~NodeManagerEvent(){} - -unsigned int NodeManagerEvent::getType() -{ - return this->type; -} - -std::string NodeManagerEvent::toString() -{ - switch(this->type) - { - case NodeManagerEvent::SystemTreeEvent: - return "Subsystem Event"; - - case NodeManagerEvent::ErrorEvent: - return "Error Event"; - - case NodeManagerEvent::ConfigurationEvent: - return "Configuration Event"; - - case NodeManagerEvent::JausMessageEvent: - return "JAUS Message Event"; - - case NodeManagerEvent::DebugEvent: - return "Debug Event"; - - default: - return "Unknown Event"; - } -} - diff --git a/lib/openjaus/libopenJaus/src/nodeManager/events/SystemTreeEvent.cpp b/lib/openjaus/libopenJaus/src/nodeManager/events/SystemTreeEvent.cpp deleted file mode 100644 index 60d0c00330009d8421d951c6485f67b823a2e8a2..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManager/events/SystemTreeEvent.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: SystemTreeEvent.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file defines the interface of a SystemTreeEvent, -// which is derived from a the NodeManagerEvent class - -#include "nodeManager/events/SystemTreeEvent.h" - -SystemTreeEvent::SystemTreeEvent(unsigned int type) -{ - this->type = NodeManagerEvent::SystemTreeEvent; - this->subType = type; - this->subs = NULL; - this->node = NULL; - this->cmpt = NULL; -} - -SystemTreeEvent::SystemTreeEvent(unsigned int type, JausSubsystem subs) -{ - this->type = NodeManagerEvent::SystemTreeEvent; - this->subType = type; - this->subs = jausSubsystemClone(subs); - this->node = NULL; - this->cmpt = NULL; -} - -SystemTreeEvent::SystemTreeEvent(unsigned int type, JausNode node) -{ - this->type = NodeManagerEvent::SystemTreeEvent; - this->subType = type; - this->subs = NULL; - this->node = jausNodeClone(node); - this->cmpt = NULL; -} - -SystemTreeEvent::SystemTreeEvent(unsigned int type, JausComponent cmpt) -{ - this->type = NodeManagerEvent::SystemTreeEvent; - this->subType = type; - this->subs = NULL; - this->node = NULL; - this->cmpt = jausComponentClone(cmpt); -} - -SystemTreeEvent::~SystemTreeEvent() -{ - if(subs) - { - jausSubsystemDestroy(subs); - } - - if(node) - { - jausNodeDestroy(node); - } - - if(cmpt) - { - jausComponentDestroy(cmpt); - } -} - -SystemTreeEvent *SystemTreeEvent::cloneEvent() -{ - if(this->subs) - { - return new SystemTreeEvent(this->subType, this->subs); - } - else if(this->node) - { - return new SystemTreeEvent(this->subType, this->node); - } - else if(this->cmpt) - { - return new SystemTreeEvent(this->subType, this->cmpt); - } - else - { - return new SystemTreeEvent(this->subType); - } -} - -std::string SystemTreeEvent::toString() -{ - std::string output = ""; - char buf[128] = {0}; - - switch(this->subType) - { - case SystemTreeEvent::SubsystemAdded: - jausSubsystemToString(this->subs, buf); - output += "Subsystem ADDED: "; - output += buf; - return output; - - case SystemTreeEvent::SubsystemRemoved: - jausSubsystemToString(this->subs, buf); - output += "Subsystem REMOVED: "; - output += buf; - return output; - - case SystemTreeEvent::SubsystemTimeout: - jausSubsystemToString(this->subs, buf); - output += "Subsystem TIMEOUT: "; - output += buf; - return output; - - case SystemTreeEvent::NodeAdded: - jausNodeToString(this->node, buf); - output += "Node ADDED: "; - output += buf; - return output; - - case SystemTreeEvent::NodeRemoved: - jausNodeToString(this->node, buf); - output += "Node REMOVED: "; - output += buf; - return output; - - case SystemTreeEvent::NodeTimeout: - jausNodeToString(this->node, buf); - output += "Node TIMEOUT: "; - output += buf; - return output; - - case SystemTreeEvent::ComponentAdded: - jausComponentToString(this->cmpt, buf); - output += "Component ADDED: "; - output += buf; - return output; - - case SystemTreeEvent::ComponentRemoved: - jausComponentToString(this->cmpt, buf); - output += "Component REMOVED: "; - output += buf; - return output; - - case SystemTreeEvent::ComponentTimeout: - jausComponentToString(this->cmpt, buf); - output += "Component TIMEOUT: "; - output += buf; - return output; - - default: - output = "Unknown Subsystem Event"; - return output; - } -} - -unsigned int SystemTreeEvent::getSubType() -{ - return this->subType; -} - -JausComponent SystemTreeEvent::getComponent() -{ - return this->cmpt; -} - -JausNode SystemTreeEvent::getNode() -{ - return this->node; -} - -JausSubsystem SystemTreeEvent::getSubsystem() -{ - return this->subs; -} - diff --git a/lib/openjaus/libopenJaus/src/nodeManagerInterface/defaultJausMessageProcessor.c b/lib/openjaus/libopenJaus/src/nodeManagerInterface/defaultJausMessageProcessor.c deleted file mode 100644 index 9d4a0a440cc267e52f41e3ad2c2bc2bbaa2d809c..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManagerInterface/defaultJausMessageProcessor.c +++ /dev/null @@ -1,424 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File: defaultJausMessageProcessor.c -// Version: 3.3 BETA -// Written by: Tom Galluzzo (galluzzo AT gmail DOT com) and Danny Kent (jaus AT dannykent DOT com) -// Date: 04/15/08 -// Description: Processes a given JAUS message with the expected JAUS defined behavior - -#include -#include - -#include "nodeManagerInterface/nodeManagerInterface.h" - -void defaultJausMessageProcessor(JausMessage message, NodeManagerInterface nmi, JausComponent cmpt) -{ - defaultJausMessageProcessorNoDestroy(message, nmi, cmpt); - jausMessageDestroy(message); -} - -void defaultJausMessageProcessorNoDestroy(JausMessage message, NodeManagerInterface nmi, JausComponent cmpt) -{ - JausMessage txMessage; - SetComponentAuthorityMessage setComponentAuthority; - RequestComponentControlMessage requestComponentControl; - ReleaseComponentControlMessage releaseComponentControl; - RejectComponentControlMessage rejectComponentControl; - ConfirmComponentControlMessage confirmComponentControl; - ReportComponentAuthorityMessage reportComponentAuthority; - ReportComponentStatusMessage reportComponentStatus; - ReportIdentificationMessage reportIdentification; - ReportConfigurationMessage reportConfMsg; - ConfirmServiceConnectionMessage confScMsg; - CreateServiceConnectionMessage createScMsg; - ActivateServiceConnectionMessage activateServiceConnection; - SuspendServiceConnectionMessage suspendServiceConnection; - TerminateServiceConnectionMessage terminateServiceConnection; - QueryServicesMessage queryServices; - ReportServicesMessage reportServices; - - char string[128] = {0}; - - if(message == NULL) - { - return; - } - - if(nmi == NULL) - { - return; - } - - if(nmi->scm == NULL) - { - return; - } - - if(cmpt->controller.active && !jausAddressEqual(message->source, cmpt->controller.address) && jausMessageIsRejectableCommand(message) ) - { - jausAddressToString(message->source, string); - ////cError("DefaultMessageProcessor: Command %s, from non-controlling source: %s\n", jausMessageCommandCodeString(message)); - return; - } - - switch(message->commandCode) // Switch the processing algorithm according to the JAUS message type - { - // Set the component authority according to the incoming authority code - case JAUS_SET_COMPONENT_AUTHORITY: - setComponentAuthority = setComponentAuthorityMessageFromJausMessage(message); - if(setComponentAuthority) - { - cmpt->authority = setComponentAuthority->authorityCode; - } - else - { - //TODO: Throw errors (need a way to capture errors in this library) - ////cError("DefaultMessageProcessor: Error unpacking %s message.\n", jausMessageCommandCodeString(message)); - } - break; - - case JAUS_SHUTDOWN: - cmpt->state = JAUS_SHUTDOWN_STATE; - break; - - case JAUS_STANDBY: - if(cmpt->state == JAUS_READY_STATE) - { - cmpt->state = JAUS_STANDBY_STATE; - } - break; - - case JAUS_RESUME: - if(cmpt->state == JAUS_STANDBY_STATE) - { - cmpt->state = JAUS_READY_STATE; - } - break; - - case JAUS_RESET: - cmpt->state = JAUS_INITIALIZE_STATE; - break; - - case JAUS_SET_EMERGENCY: - cmpt->state = JAUS_EMERGENCY_STATE; - break; - - case JAUS_CLEAR_EMERGENCY: - cmpt->state = JAUS_STANDBY_STATE; - break; - - case JAUS_REQUEST_COMPONENT_CONTROL: - requestComponentControl = requestComponentControlMessageFromJausMessage(message); - if(requestComponentControl) - { - if(cmpt->controller.active) - { - if(requestComponentControl->authorityCode > cmpt->controller.authority) // Test for higher authority - { - // Terminate control of current component - rejectComponentControl = rejectComponentControlMessageCreate(); - jausAddressCopy(rejectComponentControl->source, cmpt->address); - jausAddressCopy(rejectComponentControl->destination, cmpt->controller.address); - txMessage = rejectComponentControlMessageToJausMessage(rejectComponentControl); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - // Accept control of new component - confirmComponentControl = confirmComponentControlMessageCreate(); - jausAddressCopy(confirmComponentControl->source, cmpt->address); - jausAddressCopy(confirmComponentControl->destination, message->source); - confirmComponentControl->responseCode = JAUS_CONTROL_ACCEPTED; - txMessage = confirmComponentControlMessageToJausMessage(confirmComponentControl); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - // Update cmpt controller information - jausAddressCopy(cmpt->controller.address, message->source); - cmpt->controller.authority = requestComponentControl->authorityCode; - - rejectComponentControlMessageDestroy(rejectComponentControl); - confirmComponentControlMessageDestroy(confirmComponentControl); - } - else - { - if( !jausAddressEqual(message->source, cmpt->controller.address)) - { - rejectComponentControl = rejectComponentControlMessageCreate(); - jausAddressCopy(rejectComponentControl->source, cmpt->address); - jausAddressCopy(rejectComponentControl->destination, message->source); - txMessage = rejectComponentControlMessageToJausMessage(rejectComponentControl); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - rejectComponentControlMessageDestroy(rejectComponentControl); - } - else - { - // Reaccept control of new component - confirmComponentControl = confirmComponentControlMessageCreate(); - jausAddressCopy(confirmComponentControl->source, cmpt->address); - jausAddressCopy(confirmComponentControl->destination, message->source); - confirmComponentControl->responseCode = JAUS_CONTROL_ACCEPTED; - txMessage = confirmComponentControlMessageToJausMessage(confirmComponentControl); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - confirmComponentControlMessageDestroy(confirmComponentControl); - } - } - } - else // Not currently under component control, so give control - { - confirmComponentControl = confirmComponentControlMessageCreate(); - jausAddressCopy(confirmComponentControl->source, cmpt->address); - jausAddressCopy(confirmComponentControl->destination, message->source); - confirmComponentControl->responseCode = JAUS_CONTROL_ACCEPTED; - txMessage = confirmComponentControlMessageToJausMessage(confirmComponentControl); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - jausAddressCopy(cmpt->controller.address, message->source); - cmpt->controller.authority = requestComponentControl->authorityCode; - cmpt->controller.active = JAUS_TRUE; - - confirmComponentControlMessageDestroy(confirmComponentControl); - } - - requestComponentControlMessageDestroy(requestComponentControl); - } - else - { - //cError("DefaultMessageProcessor: Error unpacking %s message.\n", jausMessageCommandCodeString(message)); - } - break; - - case JAUS_RELEASE_COMPONENT_CONTROL: - releaseComponentControl = releaseComponentControlMessageFromJausMessage(message); - if(releaseComponentControl) - { - cmpt->controller.active = JAUS_FALSE; - cmpt->controller.address->subsystem = 0; - cmpt->controller.address->node = 0; - cmpt->controller.address->component = 0; - cmpt->controller.address->instance = 0; - cmpt->controller.authority = 0; - cmpt->controller.state = JAUS_UNDEFINED_STATE; - releaseComponentControlMessageDestroy(releaseComponentControl); - } - else - { - //cError("DefaultMessageProcessor: Error unpacking %s message.\n", jausMessageCommandCodeString(message)); - } - break; - - case JAUS_CONFIRM_SERVICE_CONNECTION: - confScMsg = confirmServiceConnectionMessageFromJausMessage(message); - if(confScMsg) - { - scManagerProcessConfirmScMessage(nmi, confScMsg); - confirmServiceConnectionMessageDestroy(confScMsg); - } - else - { - //cError("DefaultMessageProcessor: Error unpacking %s message.\n", jausMessageCommandCodeString(message)); - } - break; - - case JAUS_CREATE_SERVICE_CONNECTION: - createScMsg = createServiceConnectionMessageFromJausMessage(message); - if(createScMsg) - { - scManagerProcessCreateScMessage(nmi, createScMsg); - createServiceConnectionMessageDestroy(createScMsg); - } - else - { - //cError("DefaultMessageProcessor: Error unpacking %s message.\n", jausMessageCommandCodeString(message)); - } - - break; - - case JAUS_ACTIVATE_SERVICE_CONNECTION: - activateServiceConnection = activateServiceConnectionMessageFromJausMessage(message); - if(activateServiceConnection) - { - scManagerProcessActivateScMessage(nmi, activateServiceConnection); - activateServiceConnectionMessageDestroy(activateServiceConnection); - } - else - { - //cError("DefaultMessageProcessor: Error unpacking %s message.\n", jausMessageCommandCodeString(message)); - } - - break; - - case JAUS_SUSPEND_SERVICE_CONNECTION: - suspendServiceConnection = suspendServiceConnectionMessageFromJausMessage(message); - if(suspendServiceConnection) - { - scManagerProcessSuspendScMessage(nmi, suspendServiceConnection); - suspendServiceConnectionMessageDestroy(suspendServiceConnection); - } - else - { - //cError("DefaultMessageProcessor: Error unpacking %s message.\n", jausMessageCommandCodeString(message)); - } - break; - - case JAUS_TERMINATE_SERVICE_CONNECTION: - terminateServiceConnection = terminateServiceConnectionMessageFromJausMessage(message); - if(terminateServiceConnection) - { - scManagerProcessTerminateScMessage(nmi, terminateServiceConnection); - terminateServiceConnectionMessageDestroy(terminateServiceConnection); - } - else - { - //cError("DefaultMessageProcessor: Error unpacking %s message.\n", jausMessageCommandCodeString(message)); - } - break; - - case JAUS_QUERY_COMPONENT_AUTHORITY: - reportComponentAuthority = reportComponentAuthorityMessageCreate(); - jausAddressCopy(reportComponentAuthority->source, cmpt->address); - jausAddressCopy(reportComponentAuthority->destination, message->source); - reportComponentAuthority->authorityCode = cmpt->authority; - txMessage = reportComponentAuthorityMessageToJausMessage(reportComponentAuthority); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - reportComponentAuthorityMessageDestroy(reportComponentAuthority); - break; - - case JAUS_QUERY_COMPONENT_STATUS: - reportComponentStatus = reportComponentStatusMessageCreate(); - jausAddressCopy(reportComponentStatus->source, cmpt->address); - jausAddressCopy(reportComponentStatus->destination, message->source); - reportComponentStatus->primaryStatusCode = cmpt->state; - - txMessage = reportComponentStatusMessageToJausMessage(reportComponentStatus); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - reportComponentStatusMessageDestroy(reportComponentStatus); - break; - - case JAUS_REPORT_HEARTBEAT_PULSE: - if( message->source->subsystem == cmpt->address->subsystem && - message->source->node == cmpt->address->node && - message->source->component == JAUS_NODE_MANAGER) - { - nmi->timestamp = ojGetTimeSec(); - } - break; - - case JAUS_QUERY_IDENTIFICATION: - reportIdentification = reportIdentificationMessageCreate(); - jausAddressCopy(reportIdentification->source, cmpt->address); - jausAddressCopy(reportIdentification->destination, message->source); - sprintf(reportIdentification->identification, "%s", cmpt->identification); - reportIdentification->queryType = JAUS_QUERY_FIELD_COMPONENT_IDENTITY; // A component can only respond with its identification - txMessage = reportIdentificationMessageToJausMessage(reportIdentification); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - reportIdentificationMessageDestroy(reportIdentification); - break; - - case JAUS_REPORT_CONFIGURATION: - reportConfMsg = reportConfigurationMessageFromJausMessage(message); - if(reportConfMsg) - { - jausSubsystemDestroy(cmpt->node->subsystem); - cmpt->node->subsystem = jausSubsystemClone(reportConfMsg->subsystem); - reportConfigurationMessageDestroy(reportConfMsg); - scManagerProcessUpdatedSubystem(nmi, cmpt->node->subsystem); - - // Check for Controlleer - if( cmpt->controller.active == JAUS_TRUE && !nodeManagerVerifyAddress(nmi, cmpt->controller.address) ) - { - // TODO: Throw errors (need a way to capture errors in this library) - //cError("Active Component Controller (%d.%d.%d.%d) lost.\n", - // cmpt->controller.address->subsystem, cmpt->controller.address->node, - // cmpt->controller.address->component, cmpt->controller.address->instance); - - // Disable Controller - cmpt->controller.active = JAUS_FALSE; - cmpt->controller.address->subsystem = 0; - cmpt->controller.address->node = 0; - cmpt->controller.address->component = 0; - cmpt->controller.address->instance = 0; - cmpt->controller.state = JAUS_UNDEFINED_STATE; - cmpt->controller.authority = 0; - } - } - else - { - //cError("DefaultMessageProcessor: Error unpacking %s message.\n", jausMessageCommandCodeString(message)); - } - break; - - case JAUS_QUERY_SERVICES: - queryServices = queryServicesMessageFromJausMessage(message); - if(queryServices) - { - // Respond with our services - reportServices = reportServicesMessageCreate(); - - jausAddressCopy(reportServices->destination, message->source); - jausAddressCopy(reportServices->source, nmi->cmpt->address); - jausServicesDestroy(reportServices->jausServices); - reportServices->jausServices = jausServicesClone(nmi->cmpt->services); - - txMessage = reportServicesMessageToJausMessage(reportServices); - reportServicesMessageDestroy(reportServices); - - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - queryServicesMessageDestroy(queryServices); - } - else - { - //cError("DefaultMessageProcessor: Error unpacking %s message.\n", jausMessageCommandCodeString(message)); - } - break; - - default: - // Destroy the rxMessage - jausAddressToString(message->source, string); - //cError("DefaultMessageProcessor: Unhandled code: %s, from: %s\n", jausMessageCommandCodeString(message), string); - break; - } -} - diff --git a/lib/openjaus/libopenJaus/src/nodeManagerInterface/lmHandler.c b/lib/openjaus/libopenJaus/src/nodeManagerInterface/lmHandler.c deleted file mode 100644 index 5c41ef4467b76ec58dd65436f73698a6879d885f..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManagerInterface/lmHandler.c +++ /dev/null @@ -1,388 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File: lmHandler.c -// Version: 3.3 BETA -// Written by: Danny Kent (jaus AT dannykent DOT com) -// Date: 04/15/08 -// Description: LargeMessageHandler handles the queueing of large sets of Jaus Messages for -// use by the system. It will queue sets of messages until an end message is -// recieved and then create a single Jaus Message from that collection - -#include -#include "nodeManagerInterface/nodeManagerInterface.h" - -LargeMessageHandler lmHandlerCreate(void) -{ - LargeMessageHandler lmh = (LargeMessageHandler)malloc( sizeof(LargeMessageHandlerStruct) ); - if(lmh) - { - lmh->messageLists = jausArrayCreate(); - return lmh; - } - else - { - return NULL; - } -} - -void lmHandlerDestroy(LargeMessageHandler lmh) -{ - jausArrayDestroy(lmh->messageLists, (void *)lmListDestroy); - free(lmh); -} - -LargeMessageList lmListCreate(void) -{ - LargeMessageList msgList = (LargeMessageList)malloc(sizeof(LargeMessageListStruct)); - msgList->commandCode = 0; - msgList->source = jausAddressCreate(); - msgList->messages = jausArrayCreate(); - return msgList; -} - -void lmListDestroy(LargeMessageList msgList) -{ - jausArrayDestroy(msgList->messages, (void *)jausMessageDestroy); - jausAddressDestroy(msgList->source); - free(msgList); -} - -void lmHandlerReceiveLargeMessage(NodeManagerInterface nmi, JausMessage message) -{ - LargeMessageList msgList; - JausMessage tempMessage; - JausMessage outMessage; - int i; - unsigned long sequenceNumber; - unsigned long index; - JausUnsignedInteger newDataSize = 0; - JausUnsignedInteger bufferIndex = 0; - char address[128] = {0}; - - switch(message->dataFlag) - { - case JAUS_FIRST_DATA_PACKET: - // Check for valid SeqNumber(0), else Error - if(message->sequenceNumber) - { - //cError("LargeMessageHandler: Received First Data Packet with invalid Sequence Number(%d)\n", message->sequenceNumber); - jausMessageDestroy(message); - return; - } - - // Check if LargeMessageList exists (same CC & Source) - msgList = lmHandlerGetMessageList(nmi->lmh, message); - if(msgList) - { - // Destroy the list and all messages - jausArrayRemove(nmi->lmh->messageLists, msgList, (void *)lmHandlerMessageListEqual); - lmListDestroy(msgList); - } - - // create LargeMessageList - msgList = lmListCreate(); - jausArrayAdd(nmi->lmh->messageLists, msgList); - - // add message to LargeMessageList at first position - msgList->commandCode = message->commandCode; - jausAddressCopy(msgList->source, message->source); - jausArrayAdd(msgList->messages, message); - break; - - case JAUS_NORMAL_DATA_PACKET: - // Check if LargeMessageList exists, error if not - msgList = lmHandlerGetMessageList(nmi->lmh, message); - if(msgList) - { - // Check if item exists in LargeMessageList with seqNumber - if(jausArrayContains(msgList->messages, message, (void *)lmHandlerLargeMessageCheck) != -1) - { - //cError("LargeMessageHandler: Received duplicate NORMAL_DATA_PACKET\n"); - jausMessageDestroy(message); - } - else - { - // insert to jausArray - jausArrayAdd(msgList->messages, message); - } - } - else - { - // Destroy Message - //cError("LargeMessageHandler: Received NORMAL_DATA_PACKET (0x%4X) for unknown Large Message Set (never received JAUS_FIRST_DATA_PACKET)\n", message->commandCode); - jausMessageDestroy(message); - } - break; - - case JAUS_RETRANSMITTED_DATA_PACKET: - // Check if LargeMessageList exists, error if not - msgList = lmHandlerGetMessageList(nmi->lmh, message); - if(msgList) - { - // Check if item exists in LargeMessageList with seqNumber - if(jausArrayContains(msgList->messages, message, (void *)lmHandlerLargeMessageCheck) != -1) - { - tempMessage = (JausMessage) jausArrayRemove(msgList->messages, message, (void *)lmHandlerLargeMessageCheck); - jausMessageDestroy(tempMessage); - } - // insert to jausArray - jausArrayAdd(msgList->messages, message); - } - else - { - //cError("LargeMessageHandler: Received RETRANSMITTED_DATA_PACKET for unknown Large Message Set (never received JAUS_FIRST_DATA_PACKET)\n"); - jausMessageDestroy(message); - } - break; - - case JAUS_LAST_DATA_PACKET: - // Check if LargeMessageList exists, error if not - msgList = lmHandlerGetMessageList(nmi->lmh, message); - if(msgList && msgList->messages->elementCount > 0) - { - // insert message to end of list - jausArrayAdd(msgList->messages, message); - - // Create JausMessage object - outMessage = jausMessageCreate(); - - // Calculate new message size - newDataSize = 0; - tempMessage = NULL; - - for(i = 0; i < msgList->messages->elementCount; i++) - { - tempMessage = (JausMessage)msgList->messages->elementData[i]; - newDataSize += tempMessage->dataSize; - } - - // Setup Header and Data Buffer - outMessage->properties = tempMessage->properties; - outMessage->commandCode = tempMessage->commandCode; - jausAddressCopy(outMessage->destination, tempMessage->destination); - jausAddressCopy(outMessage->source, tempMessage->source); - outMessage->dataSize = tempMessage->dataSize; - outMessage->dataFlag = tempMessage->dataFlag; - outMessage->sequenceNumber = tempMessage->sequenceNumber; - outMessage->data = (unsigned char *) malloc(newDataSize); - - // Populate new message - sequenceNumber = 0; - bufferIndex = 0; - while(sequenceNumber <= message->sequenceNumber) - { - index = 0; - do - { - tempMessage = (JausMessage)msgList->messages->elementData[index]; - index++; - if(index > (unsigned int) msgList->messages->elementCount) - { - // Invalid set of messages - //TODO: Here is when you would request a retransmittal if ACK/NAK is set and ask the sending component to resend some packets - - // Received LAST_DATA_PACKET, but do not have proper sequence of messages - // Destroy the list and all messages - jausArrayRemove(nmi->lmh->messageLists, msgList, (void *)lmHandlerMessageListEqual); - lmListDestroy(msgList); - - //cError("LargeMessageHandler: Received LAST_DATA_PACKET, but do not have proper sequence of messages\n"); - jausMessageDestroy(outMessage); - return; - } - } - while(tempMessage->sequenceNumber != sequenceNumber); - - // Move data from tempMessage to outMessage - memcpy(outMessage->data + bufferIndex, tempMessage->data, tempMessage->dataSize); - bufferIndex += tempMessage->dataSize; - sequenceNumber++; // TOM: switched from i++ - } - - // Set DataSize - // Set proper header flags (dataFlag JAUS_SINGLE_DATA_PACKET) - outMessage->dataSize = newDataSize; - outMessage->dataFlag = JAUS_SINGLE_DATA_PACKET; - - if(outMessage->properties.scFlag) - { - scManagerReceiveMessage(nmi, outMessage); - } - else - { - queuePush(nmi->receiveQueue, (void *)outMessage); - } - - // Destroy LargeMessageList - jausArrayRemove(nmi->lmh->messageLists, msgList, (void *)lmHandlerMessageListEqual); - lmListDestroy(msgList); - } - else - { - //cError("LargeMessageHandler: Received LAST_DATA_PACKET for unknown Large Message Set (never received JAUS_FIRST_DATA_PACKET)\n"); - jausMessageDestroy(message); - } - break; - - default: - jausAddressToString(message->source, address); - //cError("lmHandler: Received (%s) with improper dataFlag (%d) from %s\n", jausMessageCommandCodeString(message), message->dataFlag, address); - jausMessageDestroy(message); - break; - } -} - -int lmHandlerMessageListEqual(LargeMessageList listOne, LargeMessageList listTwo) -{ - if(listOne->commandCode == listTwo->commandCode && jausAddressEqual(listOne->source, listTwo->source)) - { - return 1; - } - else - { - return 0; - } -} - -LargeMessageList lmHandlerGetMessageList(LargeMessageHandler lmh, JausMessage message) -{ - int i; - LargeMessageList msgList; - - // Look for the matching LargeMessageList object in the jausArray array - for(i = 0; i < lmh->messageLists->elementCount; i++) - { - msgList = (LargeMessageList) lmh->messageLists->elementData[i]; - - // Command Code and Source uniquely identify a message list - if(msgList->commandCode == message->commandCode && jausAddressEqual(msgList->source, message->source)) - return msgList; - } - return NULL; -} - -int lmHandlerLargeMessageCheck(JausMessage messageOne, JausMessage messageTwo) -{ - // Check if two messages are equal for LargeMessageSet purposes - // This only applies to large message set tests - if(messageOne->commandCode == messageTwo->commandCode && - jausAddressEqual(messageOne->source, messageTwo->source) && - messageOne->sequenceNumber == messageTwo->sequenceNumber) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -// Note: It is left to the user to destroy the inMessage after a call to this function -int lmHandlerSendLargeMessage(NodeManagerInterface nmi, JausMessage inMessage) -{ - unsigned int bytesRemaining = inMessage->dataSize; - unsigned int bufferIndex = 0; - int messageCount = 0; - int result = -1; - JausMessage outMessage; - - if(inMessage->dataSize > JAUS_MAX_DATA_SIZE_BYTES) - { - while(bytesRemaining > JAUS_MAX_DATA_SIZE_BYTES) - { - outMessage = jausMessageCreate(); - - // Copy Header - outMessage->properties = inMessage->properties; - outMessage->commandCode = inMessage->commandCode; - jausAddressCopy(outMessage->destination, inMessage->destination); - jausAddressCopy(outMessage->source, inMessage->source); - outMessage->dataSize = inMessage->dataSize; - outMessage->dataFlag = inMessage->dataFlag; - outMessage->sequenceNumber = messageCount++; - - if(messageCount == 1) - { - // First Message - outMessage->dataFlag = JAUS_FIRST_DATA_PACKET; - } - else - { - // Normal Message - outMessage->dataFlag = JAUS_NORMAL_DATA_PACKET; - } - - // Copy Data to new memory location - outMessage->data = (JausByte *)malloc(JAUS_MAX_DATA_SIZE_BYTES); - outMessage->dataSize = JAUS_MAX_DATA_SIZE_BYTES; - - memcpy(outMessage->data, inMessage->data + bufferIndex, JAUS_MAX_DATA_SIZE_BYTES); - bufferIndex += JAUS_MAX_DATA_SIZE_BYTES; - bytesRemaining -= JAUS_MAX_DATA_SIZE_BYTES; - - result = nodeManagerSendSingleMessage(nmi, outMessage); - jausMessageDestroy(outMessage); - } - - // Last Message - outMessage = jausMessageCreate(); - - // Copy Header - outMessage->properties = inMessage->properties; - outMessage->commandCode = inMessage->commandCode; - jausAddressCopy(outMessage->destination, inMessage->destination); - jausAddressCopy(outMessage->source, inMessage->source); - outMessage->dataSize = inMessage->dataSize; - outMessage->dataFlag = inMessage->dataFlag; - outMessage->sequenceNumber = messageCount++; - - outMessage->dataFlag = JAUS_LAST_DATA_PACKET; - outMessage->dataSize = bytesRemaining; - - // Copy data to new memory location - outMessage->data = (JausByte *)malloc(bytesRemaining); - memcpy(outMessage->data, inMessage->data + bufferIndex, bytesRemaining); - - result = nodeManagerSendSingleMessage(nmi, outMessage); - jausMessageDestroy(outMessage); - } - else - { - // Message in Large Message Handler which is NOT a large message - // Pass through - result = nodeManagerSendSingleMessage(nmi, inMessage); - } - - return result; -} diff --git a/lib/openjaus/libopenJaus/src/nodeManagerInterface/nodeManagerInterface.c b/lib/openjaus/libopenJaus/src/nodeManagerInterface/nodeManagerInterface.c deleted file mode 100644 index fc513585d76a1f2f71c762cbcca9b42976e904ba..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManagerInterface/nodeManagerInterface.c +++ /dev/null @@ -1,886 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File: libNodeManager.c -// Version: 3.3 BETA -// Written by: Tom Galluzzo (galluzzo AT gmail DOT com) and Danny Kent (jaus AT dannykent DOT com) -// Date: 04/15/08 -// Description: The libnodeManager provides an interface for a commponent to access core node management, -// service connections, large message handling and default message processing - -#include -#include -#include - -#if defined (WIN32) - #define WIN32_LEAN_AND_MEAN - #include - #include -#elif defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - #include - #include - #include -#endif - -#include "nodeManagerInterface/nodeManagerInterface.h" - -#define JAUS_OPC_UDP_HEADER "JAUS01.0" -#define JAUS_OPC_UDP_HEADER_SIZE_BYTES 8 - -#define NODE_MANAGER_INTERFACE_PORT 24627 -#define NODE_MANAGER_MESSAGE_PORT 24629 -#define NODE_MANAGER_TIMEOUT_SEC 3.0 - -#define INTERFACE_THREAD_TIMEOUT_SEC 3.0 -#define INTERFACE_SOCKET_TIMEOUT_SEC 1.0 -#define MESSAGE_SOCKET_TIMEOUT_SEC 0.5 - -#define INTERFACE_MESSAGE_SIZE_BYTES 8 -#define INTERFACE_MESSAGE_CHECK_IN 0x01 -#define INTERFACE_MESSAGE_REPORT_ADDRESS 0x02 -#define INTERFACE_MESSAGE_CHECK_OUT 0x03 -#define INTERFACE_MESSAGE_VERIFY_ADDRESS 0x04 -#define INTERFACE_MESSAGE_ADDRESS_VERIFIED 0x05 -#define INTERFACE_MESSAGE_GET_COMPONENT_ADDRESS_LIST 0x06 -#define INTERFACE_MESSAGE_COMPONENT_ADDRESS_LIST_RESPONSE 0x07 -#define INTERFACE_MESSAGE_LOOKUP_ADDRESS 0x08 -#define INTERFACE_MESSAGE_LOOKUP_ADDRESS_RESPONSE 0x09 -#define INTERFACE_MESSAGE_LOOKUP_SERVICE_ADDRESS 0x0A -#define INTERFACE_MESSAGE_LOOKUP_SERVICE_ADDRESS_RESPONSE 0x0B -#define INTERFACE_MESSAGE_LOOKUP_SERVICE_ADDRESS_LIST 0x0C -#define INTERFACE_MESSAGE_LOOKUP_SERVICE_ADDRESS_LIST_RESPONSE 0x0D - -static int checkIntoNodeManager(NodeManagerInterface); -static int checkOutOfNodeManager(NodeManagerInterface); -void *heartbeatThread(void *); -void *receiveThread(void *); - -NodeManagerInterface nodeManagerOpen(JausComponent cmpt) -{ - NodeManagerInterface nmi = NULL; - - if(cmpt == NULL) - { - return NULL; - } - - nmi = (NodeManagerInterface)malloc(sizeof(NodeManagerInterfaceStruct)); - if(nmi == NULL) - { - return NULL; - } - - nmi->cmpt = cmpt; - nmi->timestamp = ojGetTimeSec(); - pthread_cond_init(&nmi->recvCondition, NULL); - pthread_cond_init(&nmi->hbWakeCondition, NULL); - - nmi->ipAddress = inetAddressGetLocalHost(); - if(nmi->ipAddress == NULL) - { - free(nmi); - return NULL; - } - - nmi->interfaceSocket = datagramSocketCreate(0, nmi->ipAddress); - if(nmi->interfaceSocket == NULL) - { - inetAddressDestroy(nmi->ipAddress); - free(nmi); - return NULL; - } - datagramSocketSetTimeout(nmi->interfaceSocket, INTERFACE_SOCKET_TIMEOUT_SEC); - - memset(&nmi->messageSocket, 0, sizeof(nmi->messageSocket)); - nmi->messageSocket = datagramSocketCreate(0, nmi->ipAddress); - if(nmi->messageSocket == NULL) - { - datagramSocketDestroy(nmi->interfaceSocket); - inetAddressDestroy(nmi->ipAddress); - free(nmi); - return NULL; - } - datagramSocketSetTimeout(nmi->messageSocket, MESSAGE_SOCKET_TIMEOUT_SEC); - - if(checkIntoNodeManager(nmi)) - { - datagramSocketDestroy(nmi->messageSocket); - datagramSocketDestroy(nmi->interfaceSocket); - inetAddressDestroy(nmi->ipAddress); - free(nmi); - return NULL; - } - - nmi->receiveQueue = queueCreate(); - - nmi->scm = scManagerCreate(); - if(nmi->scm == NULL) - { - queueDestroy(nmi->receiveQueue, NULL); - checkOutOfNodeManager(nmi); - datagramSocketDestroy(nmi->messageSocket); - datagramSocketDestroy(nmi->interfaceSocket); - inetAddressDestroy(nmi->ipAddress); - free(nmi); - return NULL; - } - - nmi->lmh = lmHandlerCreate(); - if(nmi->lmh == NULL) - { - scManagerDestroy(nmi->scm); - queueDestroy(nmi->receiveQueue, NULL); - checkOutOfNodeManager(nmi); - datagramSocketDestroy(nmi->messageSocket); - datagramSocketDestroy(nmi->interfaceSocket); - inetAddressDestroy(nmi->ipAddress); - free(nmi); - return NULL; - } - - nmi->isOpen = JAUS_TRUE; - - if(pthread_create(&nmi->heartbeatThreadId, NULL, heartbeatThread, (void *)nmi)) - { - lmHandlerDestroy(nmi->lmh); - scManagerDestroy(nmi->scm); - queueDestroy(nmi->receiveQueue, NULL); - checkOutOfNodeManager(nmi); - datagramSocketDestroy(nmi->messageSocket); - datagramSocketDestroy(nmi->interfaceSocket); - inetAddressDestroy(nmi->ipAddress); - free(nmi); - return NULL; - } - - if(pthread_create(&nmi->receiveThreadId, NULL, receiveThread, (void *)nmi)) - { - pthread_cancel(nmi->heartbeatThreadId); - lmHandlerDestroy(nmi->lmh); - scManagerDestroy(nmi->scm); - queueDestroy(nmi->receiveQueue, NULL); - checkOutOfNodeManager(nmi); - datagramSocketDestroy(nmi->messageSocket); - datagramSocketDestroy(nmi->interfaceSocket); - inetAddressDestroy(nmi->ipAddress); - free(nmi); - return NULL; - } - - scManagerAddSupportedMessage(nmi, JAUS_REPORT_COMPONENT_STATUS); - scManagerAddSupportedMessage(nmi, JAUS_REPORT_COMPONENT_AUTHORITY); - - return nmi; -} - -int nodeManagerClose(NodeManagerInterface nmi) -{ - int result = 0; - - if(nmi == NULL) - { - return -1; - } - - if(nmi->isOpen) // Execute the close only if the connection is open - { - scManagerRemoveSupportedMessage(nmi, JAUS_REPORT_COMPONENT_STATUS); - scManagerRemoveSupportedMessage(nmi, JAUS_REPORT_COMPONENT_AUTHORITY); - - nmi->isOpen = 0; - - pthread_cond_signal(&nmi->hbWakeCondition); - pthread_join(nmi->heartbeatThreadId, NULL); - - CLOSE_SOCKET(nmi->messageSocket->descriptor); - pthread_join(nmi->receiveThreadId, NULL); - - lmHandlerDestroy(nmi->lmh); - scManagerDestroy(nmi->scm); - queueDestroy(nmi->receiveQueue, (void*)jausMessageDestroy); - checkOutOfNodeManager(nmi); - datagramSocketDestroy(nmi->messageSocket); - datagramSocketDestroy(nmi->interfaceSocket); - inetAddressDestroy(nmi->ipAddress); - pthread_cond_destroy(&nmi->recvCondition); - pthread_cond_destroy(&nmi->hbWakeCondition); - free(nmi); - } - else - { - return -2; - } - - return result; -}; - -static int checkIntoNodeManager(NodeManagerInterface nmi) -{ - DatagramPacket packet; - - packet = datagramPacketCreate(); - - packet->bufferSizeBytes = INTERFACE_MESSAGE_SIZE_BYTES; - packet->buffer = (unsigned char *)malloc(packet->bufferSizeBytes); - memset(packet->buffer, 0, packet->bufferSizeBytes); - packet->buffer[0]= INTERFACE_MESSAGE_CHECK_IN; - packet->buffer[1]= nmi->cmpt->address->component; - packet->buffer[2] = (unsigned char)(nmi->messageSocket->port & 0xFF); - packet->buffer[3] = (unsigned char)((nmi->messageSocket->port & 0xFF00) >> 8); - - packet->port = NODE_MANAGER_INTERFACE_PORT; - packet->address->value = nmi->ipAddress->value; - - datagramSocketSend(nmi->interfaceSocket, packet); - datagramSocketReceive(nmi->interfaceSocket, packet); - - if(packet->buffer[0] == INTERFACE_MESSAGE_REPORT_ADDRESS) - { - nmi->cmpt->address->instance = packet->buffer[1]; - nmi->cmpt->address->component = packet->buffer[2]; - nmi->cmpt->address->node = packet->buffer[3]; - nmi->cmpt->address->subsystem = packet->buffer[4]; - - free(packet->buffer); - datagramPacketDestroy(packet); - return 0; - } - else - { - free(packet->buffer); - datagramPacketDestroy(packet); - return -1; - } -} - -static int checkOutOfNodeManager(NodeManagerInterface nmi) -{ - DatagramPacket packet; - - packet = datagramPacketCreate(); - - packet->bufferSizeBytes = INTERFACE_MESSAGE_SIZE_BYTES * sizeof(unsigned char); - packet->buffer = (unsigned char*)malloc(packet->bufferSizeBytes); - memset(packet->buffer, 0, packet->bufferSizeBytes); - packet->buffer[0]= INTERFACE_MESSAGE_CHECK_OUT; - packet->buffer[1]= nmi->cmpt->address->instance; - packet->buffer[2] = nmi->cmpt->address->component; - packet->buffer[3] = nmi->cmpt->address->node; - packet->buffer[4] = nmi->cmpt->address->subsystem; - packet->port = NODE_MANAGER_INTERFACE_PORT; - packet->address->value = nmi->ipAddress->value; - - datagramSocketSend(nmi->interfaceSocket, packet); - - // datagramSocketReceive(nmi->interfaceSocket, &packet); TODO: Implement reply - - free(packet->buffer); - datagramPacketDestroy(packet); - return 1; -} - -void *heartbeatThread(void *threadArgument) -{ - pthread_mutex_t hbMutex = PTHREAD_MUTEX_INITIALIZER; - int condition = -1; - struct timespec timeLimitSpec; - double timeLimitSec = 0; - NodeManagerInterface nmi = (NodeManagerInterface)threadArgument; - JausMessage txMessage; - ReportHeartbeatPulseMessage heartbeat = reportHeartbeatPulseMessageCreate(); - - nmi->heartbeatThreadRunning = 1; - nmi->heartbeatCount = 0; - - jausAddressCopy(heartbeat->source, nmi->cmpt->address); - heartbeat->destination->subsystem = nmi->cmpt->address->subsystem; - heartbeat->destination->node = nmi->cmpt->address->node; - heartbeat->destination->component = JAUS_NODE_MANAGER_COMPONENT; - heartbeat->destination->instance = 1; - - txMessage = reportHeartbeatPulseMessageToJausMessage(heartbeat); - - while(nmi->isOpen) - { - nodeManagerSend(nmi, txMessage); - nmi->heartbeatCount++; - if( (ojGetTimeSec() - NODE_MANAGER_TIMEOUT_SEC) > nmi->timestamp) - { - // TODO: Capture Error - //printf("libNodeManager: Node Manager Has Timed Out\n"); - //nmi->cmpt->state = JAUS_FAILURE_STATE; - break; - } - - timeLimitSec = ojGetTimeSec() + 1.0; - timeLimitSpec.tv_sec = (long)timeLimitSec; - timeLimitSpec.tv_nsec = (long)(1e9 * (timeLimitSec - (double)timeLimitSpec.tv_sec)); - - pthread_mutex_lock(&hbMutex); - condition = pthread_cond_timedwait(&nmi->hbWakeCondition, &hbMutex, &timeLimitSpec); - pthread_mutex_unlock(&hbMutex); - } - - jausMessageDestroy(txMessage); - reportHeartbeatPulseMessageDestroy(heartbeat); - nmi->heartbeatThreadRunning = 0; - - return NULL; -} - -void *receiveThread(void *threadArgument) -{ - int index; - - NodeManagerInterface nmi = (NodeManagerInterface)threadArgument; - DatagramPacket packet; - - JausMessage message; - - nmi->receiveThreadRunning = 1; - - nmi->receiveCount = 0; - - packet = datagramPacketCreate(); - - packet->bufferSizeBytes = JAUS_HEADER_SIZE_BYTES + JAUS_MAX_DATA_SIZE_BYTES; - packet->buffer = (unsigned char*)malloc(packet->bufferSizeBytes); - memset(packet->buffer, 0, packet->bufferSizeBytes); - - while(nmi->isOpen) - { - if(datagramSocketReceive(nmi->messageSocket, packet) > 0) - { - index = 0; - if(!strncmp((char *)packet->buffer, JAUS_OPC_UDP_HEADER, JAUS_OPC_UDP_HEADER_SIZE_BYTES)) // equals 1 if same - { - index += JAUS_OPC_UDP_HEADER_SIZE_BYTES; - } - - message = jausMessageCreate(); - if(jausMessageFromBuffer(message, packet->buffer + index, packet->bufferSizeBytes - index)) - { - if(message->dataFlag) - { - lmHandlerReceiveLargeMessage(nmi, message); - } - else - { - if(message->properties.scFlag) - { - if( (message->commandCode >= JAUS_CREATE_SERVICE_CONNECTION && - message->commandCode <= JAUS_TERMINATE_SERVICE_CONNECTION) || - message->commandCode == JAUS_CREATE_EVENT || - message->commandCode == JAUS_CONFIRM_EVENT_REQUEST || - message->commandCode == JAUS_CANCEL_EVENT) - { - // This is to take Service Connection Control messages and send them on through - // to the regular receiveQueue. JAUS 3.2 RA says to set the properties.scFlag bit if it is - // a Service Connection Control message, but logically they do not need to go - // to the scManager and instead to the component - queuePush(nmi->receiveQueue, (void *)message); - } - else - { - scManagerReceiveMessage(nmi, message); - } - } - else - { - queuePush(nmi->receiveQueue, (void *)message); - } - } - pthread_cond_signal(&nmi->recvCondition); - nmi->receiveCount++; - } - else - { - jausMessageDestroy(message); - } - } - } - - free(packet->buffer); - - datagramPacketDestroy(packet); - - nmi->receiveThreadRunning = 0; - - return NULL; -} - -JausAddressList *nodeManagerGetComponentAddressList(NodeManagerInterface nmi, unsigned char componentId) -{ - JausAddressList *addressList = NULL; - JausAddressList *currentAddress = NULL; - DatagramPacket packet; - - if(!nmi || !nmi->isOpen || !componentId) - { - return NULL; - } - - packet = datagramPacketCreate(); - - packet->bufferSizeBytes = INTERFACE_MESSAGE_SIZE_BYTES; - packet->buffer = (unsigned char *)malloc(packet->bufferSizeBytes); - memset(packet->buffer, 0, packet->bufferSizeBytes); - packet->buffer[0] = INTERFACE_MESSAGE_GET_COMPONENT_ADDRESS_LIST; - packet->buffer[1] = componentId; - packet->buffer[2] = 0; - packet->buffer[3] = 0; - packet->buffer[4] = 0; - - packet->port = NODE_MANAGER_INTERFACE_PORT; - packet->address->value = nmi->ipAddress->value; - - datagramSocketSend(nmi->interfaceSocket, packet); - datagramSocketReceive(nmi->interfaceSocket, packet); - - while(packet->buffer[0] == INTERFACE_MESSAGE_COMPONENT_ADDRESS_LIST_RESPONSE && packet->buffer[4]) - { - if(currentAddress) - { - currentAddress->nextAddress = (JausAddressList *)malloc(sizeof(JausAddressList)); - currentAddress = currentAddress->nextAddress; - currentAddress->address = jausAddressCreate(); - currentAddress->address->instance = packet->buffer[1]; - currentAddress->address->component = packet->buffer[2]; - currentAddress->address->node = packet->buffer[3]; - currentAddress->address->subsystem = packet->buffer[4]; - currentAddress->nextAddress = NULL; - } - else - { - addressList = (JausAddressList *)malloc(sizeof(JausAddressList)); - currentAddress = addressList; - currentAddress->address = jausAddressCreate(); - currentAddress->address->instance = packet->buffer[1]; - currentAddress->address->component = packet->buffer[2]; - currentAddress->address->node = packet->buffer[3]; - currentAddress->address->subsystem = packet->buffer[4]; - currentAddress->nextAddress = NULL; - } - - packet->buffer[0] = INTERFACE_MESSAGE_GET_COMPONENT_ADDRESS_LIST; - packet->buffer[1] = 0; - packet->buffer[2] = 0; - packet->buffer[3] = 0; - packet->buffer[4] = 0; - - datagramSocketSend(nmi->interfaceSocket, packet); - datagramSocketReceive(nmi->interfaceSocket, packet); - } - - free(packet->buffer); - datagramPacketDestroy(packet); - - return addressList; -} - -JausBoolean nodeManagerLookupAddress(NodeManagerInterface nmi, JausAddress lookupAddress) -{ - DatagramPacket packet; - - if(!nmi || !nmi->isOpen) - { - return JAUS_FALSE; - } - - packet = datagramPacketCreate(); - - packet->bufferSizeBytes = INTERFACE_MESSAGE_SIZE_BYTES; - packet->buffer = (unsigned char *)malloc(packet->bufferSizeBytes); - memset(packet->buffer, 0, packet->bufferSizeBytes); - packet->buffer[0] = INTERFACE_MESSAGE_LOOKUP_ADDRESS; - packet->buffer[1] = lookupAddress->instance; - packet->buffer[2] = lookupAddress->component; - packet->buffer[3] = lookupAddress->node; - packet->buffer[4] = lookupAddress->subsystem; - - packet->port = NODE_MANAGER_INTERFACE_PORT; - packet->address->value = nmi->ipAddress->value; - - datagramSocketSend(nmi->interfaceSocket, packet); - datagramSocketReceive(nmi->interfaceSocket, packet); - - if( packet->buffer[0] == INTERFACE_MESSAGE_LOOKUP_ADDRESS_RESPONSE && packet->buffer[5]) - { - lookupAddress->instance = packet->buffer[1]; - lookupAddress->component = packet->buffer[2]; - lookupAddress->node = packet->buffer[3]; - lookupAddress->subsystem = packet->buffer[4]; - - free(packet->buffer); - datagramPacketDestroy(packet); - return JAUS_TRUE; - } - else - { - free(packet->buffer); - datagramPacketDestroy(packet); - return JAUS_FALSE; - } -} - -JausAddressList *nodeManagerLookupServiceAddressList(NodeManagerInterface nmi, JausAddress lookupAddress, unsigned short commandCode, int serviceCommandType) -{ - JausAddressList *addressList = NULL; - JausAddressList *currentAddress = NULL; - DatagramPacket packet; - - if(!nmi || !nmi->isOpen || !commandCode) - { - return NULL; - } - - packet = datagramPacketCreate(); - - packet->bufferSizeBytes = INTERFACE_MESSAGE_SIZE_BYTES; - packet->buffer = (unsigned char *)malloc(packet->bufferSizeBytes); - memset(packet->buffer, 0, packet->bufferSizeBytes); - packet->buffer[0] = INTERFACE_MESSAGE_LOOKUP_SERVICE_ADDRESS_LIST; - packet->buffer[1] = lookupAddress->instance; - packet->buffer[2] = lookupAddress->component; - packet->buffer[3] = lookupAddress->node; - packet->buffer[4] = lookupAddress->subsystem; - packet->buffer[5] = (unsigned char)(commandCode & 0xFF); - packet->buffer[6] = (unsigned char)((commandCode & 0xFF00) >> 8); - packet->buffer[7] = (unsigned char)(serviceCommandType & 0xFF); - - packet->port = NODE_MANAGER_INTERFACE_PORT; - packet->address->value = nmi->ipAddress->value; - - datagramSocketSend(nmi->interfaceSocket, packet); - datagramSocketReceive(nmi->interfaceSocket, packet); - - while(packet->buffer[0] == INTERFACE_MESSAGE_COMPONENT_ADDRESS_LIST_RESPONSE && packet->buffer[5]) - { - if(currentAddress) - { - currentAddress->nextAddress = (JausAddressList *)malloc(sizeof(JausAddressList)); - currentAddress = currentAddress->nextAddress; - currentAddress->address = jausAddressCreate(); - currentAddress->address->instance = packet->buffer[1]; - currentAddress->address->component = packet->buffer[2]; - currentAddress->address->node = packet->buffer[3]; - currentAddress->address->subsystem = packet->buffer[4]; - currentAddress->nextAddress = NULL; - } - else - { - addressList = (JausAddressList *)malloc(sizeof(JausAddressList)); - currentAddress = addressList; - currentAddress->address = jausAddressCreate(); - currentAddress->address->instance = packet->buffer[1]; - currentAddress->address->component = packet->buffer[2]; - currentAddress->address->node = packet->buffer[3]; - currentAddress->address->subsystem = packet->buffer[4]; - currentAddress->nextAddress = NULL; - } - - packet->buffer[0] = INTERFACE_MESSAGE_GET_COMPONENT_ADDRESS_LIST; - packet->buffer[1] = lookupAddress->instance; - packet->buffer[2] = lookupAddress->component; - packet->buffer[3] = lookupAddress->node; - packet->buffer[4] = lookupAddress->subsystem; - packet->buffer[5] = 0; - packet->buffer[6] = 0; - packet->buffer[7] = (unsigned char)(serviceCommandType & 0xFF); - - datagramSocketSend(nmi->interfaceSocket, packet); - datagramSocketReceive(nmi->interfaceSocket, packet); - } - - free(packet->buffer); - datagramPacketDestroy(packet); - - return addressList; -} - -JausBoolean nodeManagerLookupServiceAddress(NodeManagerInterface nmi, JausAddress lookupAddress, unsigned short commandCode, int serviceCommandType) -{ - DatagramPacket packet; - - if(!nmi || !nmi->isOpen) - { - return JAUS_FALSE; - } - - packet = datagramPacketCreate(); - - packet->bufferSizeBytes = INTERFACE_MESSAGE_SIZE_BYTES; - packet->buffer = (unsigned char *)malloc(packet->bufferSizeBytes); - memset(packet->buffer, 0, packet->bufferSizeBytes); - packet->buffer[0] = INTERFACE_MESSAGE_LOOKUP_SERVICE_ADDRESS; - packet->buffer[1] = lookupAddress->instance; - packet->buffer[2] = lookupAddress->component; - packet->buffer[3] = lookupAddress->node; - packet->buffer[4] = lookupAddress->subsystem; - packet->buffer[5] = (unsigned char)(commandCode & 0xFF); - packet->buffer[6] = (unsigned char)((commandCode & 0xFF00) >> 8); - packet->buffer[7] = (unsigned char)(serviceCommandType & 0xFF); - - packet->port = NODE_MANAGER_INTERFACE_PORT; - packet->address->value = nmi->ipAddress->value; - - datagramSocketSend(nmi->interfaceSocket, packet); - datagramSocketReceive(nmi->interfaceSocket, packet); - - if( packet->buffer[0] == INTERFACE_MESSAGE_LOOKUP_SERVICE_ADDRESS_RESPONSE && packet->buffer[5]) - { - lookupAddress->instance = packet->buffer[1]; - lookupAddress->component = packet->buffer[2]; - lookupAddress->node = packet->buffer[3]; - lookupAddress->subsystem = packet->buffer[4]; - - free(packet->buffer); - datagramPacketDestroy(packet); - return JAUS_TRUE; - } - else - { - free(packet->buffer); - datagramPacketDestroy(packet); - return JAUS_FALSE; - } -} - -void nodeManagerDestroyAddressList(JausAddressList *addressList) -{ - JausAddressList *deadAddressList; - - while(addressList) - { - deadAddressList = addressList; - addressList = addressList->nextAddress; - - jausAddressDestroy(deadAddressList->address); - free(deadAddressList); - } -} - -int nodeManagerVerifyAddress(NodeManagerInterface nmi, JausAddress address) -{ - DatagramPacket packet; - int response = 0; - - packet = datagramPacketCreate(); - - packet->bufferSizeBytes = INTERFACE_MESSAGE_SIZE_BYTES; - packet->buffer = (unsigned char *)malloc(packet->bufferSizeBytes); - memset(packet->buffer, 0, packet->bufferSizeBytes); - packet->buffer[0] = INTERFACE_MESSAGE_VERIFY_ADDRESS; - packet->buffer[1] = (unsigned char)address->instance; - packet->buffer[2] = (unsigned char)address->component; - packet->buffer[3] = (unsigned char)address->node; - packet->buffer[4] = (unsigned char)address->subsystem; - - packet->port = NODE_MANAGER_INTERFACE_PORT; - packet->address->value = nmi->ipAddress->value; - - datagramSocketSend(nmi->interfaceSocket, packet); - datagramSocketReceive(nmi->interfaceSocket, packet); - - if(packet->buffer[0] == INTERFACE_MESSAGE_ADDRESS_VERIFIED) - { - response = packet->buffer[1]; - - free(packet->buffer); - datagramPacketDestroy(packet); - return response; - } - else - { - free(packet->buffer); - datagramPacketDestroy(packet); - return 0; - } - -} - -int nodeManagerReceive(NodeManagerInterface nmi, JausMessage *message) -{ - if(nmi->isOpen && nmi->receiveQueue->size) - { - *message = (JausMessage)queuePop(nmi->receiveQueue); - return 1; - } - else - { - return 0; - } -} - -int nodeManagerTimedReceive(NodeManagerInterface nmi, JausMessage *message, double timeLimitSec) -{ - pthread_mutex_t recvMutex = PTHREAD_MUTEX_INITIALIZER; - int condition = -1; - struct timespec timeLimitSpec; - - if(nmi->isOpen) - { - if(ojGetTimeSec() > timeLimitSec) - { - return NMI_RECEIVE_TIMED_OUT; - } - else if(nmi->receiveQueue->size) - { - *message = (JausMessage)queuePop(nmi->receiveQueue); - return NMI_MESSAGE_RECEIVED; - } - else - { - timeLimitSpec.tv_sec = (long)timeLimitSec; - timeLimitSpec.tv_nsec = (long)(1e9 * (timeLimitSec - (double)timeLimitSpec.tv_sec)); - - pthread_mutex_lock(&recvMutex); - condition = pthread_cond_timedwait(&nmi->recvCondition, &recvMutex, &timeLimitSpec); - pthread_mutex_unlock(&recvMutex); - - switch(condition) - { - case 0: // Conditional Signaled - *message = (JausMessage)queuePop(nmi->receiveQueue); - return NMI_MESSAGE_RECEIVED; - - case ETIMEDOUT: // our time is up - return NMI_RECEIVE_TIMED_OUT; - - default: // Some other error occured - return NMI_CONDITIONAL_WAIT_ERROR; - } - } - } - else - { - return NMI_CLOSED_ERROR; - } -} - -int nodeManagerSend(NodeManagerInterface nmi, JausMessage message) -{ - int result = -1; - - if(nmi->isOpen) - { - result = lmHandlerSendLargeMessage(nmi, message); - } - - return result; -} - -int nodeManagerSendSingleMessage(NodeManagerInterface nmi, JausMessage message) -{ - DatagramPacket packet; - int result = -1; - - if(nmi->isOpen) - { - packet = datagramPacketCreate(); - packet->bufferSizeBytes = (int)jausMessageSize(message); - packet->buffer = (unsigned char*)malloc(packet->bufferSizeBytes); - packet->port = NODE_MANAGER_MESSAGE_PORT; - packet->address->value = nmi->ipAddress->value; - memset(packet->buffer, 0, packet->bufferSizeBytes); - - if(jausMessageToBuffer(message, packet->buffer, packet->bufferSizeBytes)) - { - result = datagramSocketSend(nmi->messageSocket, packet); - } - free(packet->buffer); - datagramPacketDestroy(packet); - } - - return result; -} - -void nodeManagerSendCoreServiceConnections(NodeManagerInterface nmi) -{ - JausMessage message = NULL; - ServiceConnection scList = NULL; - ServiceConnection sc; - ReportComponentStatusMessage reportStatus; - ReportComponentAuthorityMessage reportAuthority; - - // Respond to a ReportComponentStatus Service Connection - scList = scManagerGetSendList(nmi, JAUS_REPORT_COMPONENT_STATUS); - if(scList) - { - reportStatus = reportComponentStatusMessageCreate(); - jausAddressCopy(reportStatus->source, nmi->cmpt->address); - reportStatus->properties.scFlag = JAUS_SERVICE_CONNECTION_MESSAGE; - reportStatus->primaryStatusCode = nmi->cmpt->state; - - sc = scList; - while(sc) - { - jausAddressCopy(reportStatus->destination, sc->address); - reportStatus->sequenceNumber = sc->sequenceNumber; - - message = reportComponentStatusMessageToJausMessage(reportStatus); - nodeManagerSend(nmi, message); - jausMessageDestroy(message); - - sc = sc->nextSc; - } - reportComponentStatusMessageDestroy(reportStatus); - } - scManagerDestroySendList(scList); - - scList = NULL; - // Respond to a ReportComponentAuthorityMessage Service Connection - scList = scManagerGetSendList(nmi, JAUS_REPORT_COMPONENT_AUTHORITY); - if(scList) - { - reportAuthority = reportComponentAuthorityMessageCreate(); - jausAddressCopy(reportAuthority->source, nmi->cmpt->address); - reportAuthority->properties.scFlag = JAUS_SERVICE_CONNECTION_MESSAGE; - reportAuthority->authorityCode = nmi->cmpt->authority; - - sc = scList; - while(sc) - { - jausAddressCopy(reportAuthority->destination, sc->address); - reportAuthority->sequenceNumber = sc->sequenceNumber; - - message = reportComponentAuthorityMessageToJausMessage(reportAuthority); - nodeManagerSend(nmi, message); - jausMessageDestroy(message); - - sc = sc->nextSc; - } - reportComponentAuthorityMessageDestroy(reportAuthority); - } - scManagerDestroySendList(scList); -} diff --git a/lib/openjaus/libopenJaus/src/nodeManagerInterface/scManager.c b/lib/openjaus/libopenJaus/src/nodeManagerInterface/scManager.c deleted file mode 100644 index 38ff3e5df78b8c9095f5eadb434ccc00cef7e4cf..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/nodeManagerInterface/scManager.c +++ /dev/null @@ -1,1080 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File: scManager.c -// Version: 3.3 BETA -// Written by: Tom Galluzzo (galluzzo AT gmail DOT com) and -// Danny Kent (jaus AT dannykent DOT com) -// Date: 04/15/08 -// Description: Provides the core service connection management routines - -#include -#include -#include "nodeManagerInterface/nodeManagerInterface.h" - -SupportedScMessage scFindSupportedScMsgInList(SupportedScMessage, unsigned short); -ServiceConnection scFindScInList(ServiceConnection, ServiceConnection); -int scGetAvailableInstanceId(ServiceConnection, ServiceConnection); - -ServiceConnection serviceConnectionCreate(void) -{ - ServiceConnection sc; - - sc = (ServiceConnection) malloc(sizeof(ServiceConnectionStruct)); - if(sc) - { - sc->address = jausAddressCreate(); - if(!sc->address) - { - // Failed to init address - free(sc); - return NULL; - } - - sc->queue = queueCreate(); - if(!sc->queue) - { - // Failed to init queue - jausAddressDestroy(sc->address); - free(sc); - return NULL; - } - - return sc; - } - else - { - return NULL; - } -} - -void serviceConnectionDestroy(ServiceConnection sc) -{ - jausAddressDestroy(sc->address); - queueDestroy(sc->queue, (void *)jausMessageDestroy); - free(sc); -} - -ServiceConnectionManager scManagerCreate(void) -{ - ServiceConnectionManager scm = NULL; - int retVal; - - scm = (ServiceConnectionManager)malloc(sizeof(ServiceConnectionManagerStruct)); - if(scm == NULL) - { - return NULL; - } - - scm->supportedScMsgList = NULL; - scm->incomingSc = NULL; - scm->supportedScMsgCount = 0; - scm->outgoingScCount = 0; - scm->incomingScCount = 0; - - retVal = pthread_mutex_init(&scm->mutex, NULL); - if(retVal != 0) - { - // Failed to init mutex - free(scm); - return NULL; - } - - return scm; -} - -void scManagerDestroy(ServiceConnectionManager scm) -{ - SupportedScMessage supportedScMsg; - ServiceConnection sc; - - // Only attempt to destroy the scm if it is a non-NULL pointer - if(scm == NULL) - { - return; - } - - // Free the supported message list - while(scm->supportedScMsgList) - { - supportedScMsg = scm->supportedScMsgList; - scm->supportedScMsgList = supportedScMsg->nextSupportedScMsg; - - // Free all the service connections - while(supportedScMsg->scList) - { - sc = supportedScMsg->scList; - supportedScMsg->scList = sc->nextSc; - serviceConnectionDestroy(sc); - } - - free(supportedScMsg); - } - - pthread_mutex_destroy(&scm->mutex); - free(scm); -} - -void scManagerProcessConfirmScMessage(NodeManagerInterface nmi, ConfirmServiceConnectionMessage message) -{ - ServiceConnection prevSc = NULL; - ServiceConnection sc; - TerminateServiceConnectionMessage terminateSc; - JausMessage txMessage; - - pthread_mutex_lock(&nmi->scm->mutex); - - sc = nmi->scm->incomingSc; - - while(sc) - { - if( sc->commandCode == message->serviceConnectionCommandCode && jausAddressEqual(sc->address, message->source) ) - { - if( message->responseCode == JAUS_SC_SUCCESSFUL ) - { - sc->confirmedUpdateRateHz = message->confirmedPeriodicUpdateRateHertz; - sc->instanceId = message->instanceId; - sc->isActive = JAUS_TRUE; - sc->sequenceNumber = 65535; - sc->lastSentTime = ojGetTimeSec(); - } - else - { - // Set SC Inactive - sc->isActive = JAUS_FALSE; - - // Remove Service Connection - if(prevSc) - { - prevSc->nextSc = sc->nextSc; - sc->nextSc = NULL; - } - else - { - nmi->scm->incomingSc = sc->nextSc; - sc->nextSc = NULL; - } - nmi->scm->incomingScCount--; - } - - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - prevSc = sc; - sc = sc->nextSc; - } - - // The SC was not found, so send a terminate to prevent streaming - if( message->responseCode == JAUS_SC_SUCCESSFUL ) - { - terminateSc = terminateServiceConnectionMessageCreate(); - jausAddressCopy(terminateSc->source, nmi->cmpt->address); - jausAddressCopy(terminateSc->destination, message->source); - terminateSc->serviceConnectionCommandCode = message->serviceConnectionCommandCode; - terminateSc->instanceId = message->instanceId; - - txMessage = terminateServiceConnectionMessageToJausMessage(terminateSc); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - terminateServiceConnectionMessageDestroy(terminateSc); - } - - pthread_mutex_unlock(&nmi->scm->mutex); -} - -void scManagerProcessCreateScMessage(NodeManagerInterface nmi, CreateServiceConnectionMessage message) -{ - SupportedScMessage supportedScMsg; - ServiceConnection sc; - ServiceConnection newSc; - JausMessage txMessage; - ConfirmServiceConnectionMessage confScMsg; - - pthread_mutex_lock(&nmi->scm->mutex); - - supportedScMsg = scFindSupportedScMsgInList(nmi->scm->supportedScMsgList, message->serviceConnectionCommandCode); - if(supportedScMsg == NULL) - { - confScMsg = confirmServiceConnectionMessageCreate(); - jausAddressCopy(confScMsg->source, nmi->cmpt->address); - jausAddressCopy(confScMsg->destination, message->source); - confScMsg->serviceConnectionCommandCode = message->serviceConnectionCommandCode; - confScMsg->instanceId = 0; - confScMsg->confirmedPeriodicUpdateRateHertz = 0; - confScMsg->responseCode = JAUS_SC_COMPONENT_NOT_CAPABLE; - - txMessage = confirmServiceConnectionMessageToJausMessage(confScMsg); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - confirmServiceConnectionMessageDestroy(confScMsg); - - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - - newSc = (ServiceConnection)malloc( sizeof(ServiceConnectionStruct) ); - if(newSc == NULL) - { - // Send negative conf (could not create sc) - confScMsg = confirmServiceConnectionMessageCreate(); - jausAddressCopy(confScMsg->source, nmi->cmpt->address); - jausAddressCopy(confScMsg->destination, message->source); - confScMsg->serviceConnectionCommandCode = message->serviceConnectionCommandCode; - confScMsg->instanceId = 0; - confScMsg->confirmedPeriodicUpdateRateHertz = 0; - confScMsg->responseCode = JAUS_SC_CONNECTION_REFUSED; - - txMessage = confirmServiceConnectionMessageToJausMessage(confScMsg); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - confirmServiceConnectionMessageDestroy(confScMsg); - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - - newSc->commandCode = message->serviceConnectionCommandCode; - newSc->presenceVector = message->presenceVector; - newSc->address = jausAddressCreate(); - jausAddressCopy(newSc->address, message->source); - newSc->instanceId = scGetAvailableInstanceId(supportedScMsg->scList, newSc); - if(newSc->instanceId == -1) - { - // Send negative conf (could not create sc) - confScMsg = confirmServiceConnectionMessageCreate(); - jausAddressCopy(confScMsg->source, nmi->cmpt->address); - jausAddressCopy(confScMsg->destination, message->source); - confScMsg->serviceConnectionCommandCode = message->serviceConnectionCommandCode; - confScMsg->instanceId = 0; - confScMsg->confirmedPeriodicUpdateRateHertz = 0; - confScMsg->responseCode = JAUS_SC_CONNECTION_REFUSED; - - txMessage = confirmServiceConnectionMessageToJausMessage(confScMsg); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - confirmServiceConnectionMessageDestroy(confScMsg); - - jausAddressDestroy(newSc->address); - free(newSc); - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - newSc->queue = NULL; - newSc->queueSize = 0; - - sc = scFindScInList(supportedScMsg->scList, newSc); - if(sc == NULL) // Test to see if the sc does not already exist - { - // The sc doesent exist, so we insert the new one into the list - sc = newSc; - sc->nextSc = supportedScMsg->scList; - supportedScMsg->scList = sc; - nmi->scm->outgoingScCount++; - } - else - { - jausAddressDestroy(newSc->address); - free(newSc); - } - - sc->requestedUpdateRateHz = message->requestedPeriodicUpdateRateHertz; - sc->lastSentTime = 0.0; - sc->sequenceNumber = 0; - sc->isActive = JAUS_TRUE; - sc->confirmedUpdateRateHz = message->requestedPeriodicUpdateRateHertz; // TODO: calculate confirmedUpdateRateHz - - confScMsg = confirmServiceConnectionMessageCreate(); - jausAddressCopy(confScMsg->source, nmi->cmpt->address); - jausAddressCopy(confScMsg->destination, message->source); - confScMsg->serviceConnectionCommandCode = sc->commandCode; - confScMsg->instanceId = (JausByte)sc->instanceId; - confScMsg->confirmedPeriodicUpdateRateHertz = sc->confirmedUpdateRateHz; - confScMsg->responseCode = JAUS_SC_SUCCESSFUL; - - txMessage = confirmServiceConnectionMessageToJausMessage(confScMsg); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - confirmServiceConnectionMessageDestroy(confScMsg); - - pthread_mutex_unlock(&nmi->scm->mutex); -} - -void scManagerProcessActivateScMessage(NodeManagerInterface nmi, ActivateServiceConnectionMessage message) -{ - SupportedScMessage supportedScMsg; - ServiceConnection sc; - ServiceConnection messageSc; - - pthread_mutex_lock(&nmi->scm->mutex); - - supportedScMsg = scFindSupportedScMsgInList(nmi->scm->supportedScMsgList, message->serviceConnectionCommandCode); - if(supportedScMsg == NULL) - { - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - - messageSc = (ServiceConnection)malloc( sizeof(ServiceConnectionStruct) ); - if(messageSc == NULL) - { - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - - messageSc->address = jausAddressCreate(); - jausAddressCopy(messageSc->address, message->source); - messageSc->instanceId = message->instanceId; - - sc = scFindScInList(supportedScMsg->scList, messageSc); - if(sc != NULL) - { - sc->isActive = JAUS_TRUE; - } - - jausAddressDestroy(messageSc->address); - free(messageSc); - pthread_mutex_unlock(&nmi->scm->mutex); -} - -void scManagerProcessSuspendScMessage(NodeManagerInterface nmi, SuspendServiceConnectionMessage message) -{ - SupportedScMessage supportedScMsg; - ServiceConnection sc; - ServiceConnection messageSc; - - pthread_mutex_lock(&nmi->scm->mutex); - - supportedScMsg = scFindSupportedScMsgInList(nmi->scm->supportedScMsgList, message->serviceConnectionCommandCode); - if(supportedScMsg == NULL) - { - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - - messageSc = (ServiceConnection)malloc( sizeof(ServiceConnectionStruct) ); - if(messageSc == NULL) - { - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - - messageSc->address = jausAddressCreate(); - jausAddressCopy(messageSc->address, message->source); - messageSc->instanceId = message->instanceId; - - sc = scFindScInList(supportedScMsg->scList, messageSc); - if(sc != NULL) - { - sc->isActive = JAUS_FALSE; - } - - jausAddressDestroy(messageSc->address); - free(messageSc); - pthread_mutex_unlock(&nmi->scm->mutex); -} - -void scManagerProcessTerminateScMessage(NodeManagerInterface nmi, TerminateServiceConnectionMessage message) -{ - SupportedScMessage supportedScMsg; - ServiceConnection sc; - ServiceConnection prevSc; - - pthread_mutex_lock(&nmi->scm->mutex); - - supportedScMsg = scFindSupportedScMsgInList(nmi->scm->supportedScMsgList, message->serviceConnectionCommandCode); - if(supportedScMsg == NULL) - { - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - - if( supportedScMsg->scList == NULL ) - { - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - - sc = supportedScMsg->scList; - - if( jausAddressEqual(sc->address, message->source) && - sc->commandCode == message->serviceConnectionCommandCode && - sc->instanceId == message->instanceId ) - { - // Remove sc from list - supportedScMsg->scList = sc->nextSc; - serviceConnectionDestroy(sc); - nmi->scm->outgoingScCount--; - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - - prevSc = sc; - sc = prevSc->nextSc; - while(sc) - { - if( jausAddressEqual(sc->address, message->source) && - sc->commandCode == message->serviceConnectionCommandCode && - sc->instanceId == message->instanceId ) - { - // Remove sc from list - prevSc->nextSc = sc->nextSc; - serviceConnectionDestroy(sc); - nmi->scm->outgoingScCount--; - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - prevSc = sc; - sc = sc->nextSc; - } - - pthread_mutex_unlock(&nmi->scm->mutex); -} - -void scManagerProcessUpdatedSubystem(NodeManagerInterface nmi, JausSubsystem subsystem) -{ - SupportedScMessage supportedScMsg; - ServiceConnection sc; - ServiceConnection prevSc; - - pthread_mutex_lock(&nmi->scm->mutex); - - supportedScMsg = nmi->scm->supportedScMsgList; - while(supportedScMsg) - { - prevSc = NULL; - sc = supportedScMsg->scList; - while(sc) - { - if( !nodeManagerVerifyAddress(nmi, sc->address) ) - { - // Remove sc from list - if(prevSc) - { - prevSc->nextSc = sc->nextSc; - serviceConnectionDestroy(sc); - sc = prevSc->nextSc; - } - else - { - supportedScMsg->scList = sc->nextSc; - serviceConnectionDestroy(sc); - sc = supportedScMsg->scList; - } - nmi->scm->outgoingScCount--; - } - else - { - prevSc = sc; - sc = sc->nextSc; - } - } - supportedScMsg = supportedScMsg->nextSupportedScMsg; - } - - prevSc = NULL; - sc = nmi->scm->incomingSc; - while(sc) - { - if( !nodeManagerVerifyAddress(nmi, sc->address) ) - { - // Remove sc from list - sc->isActive = JAUS_FALSE; - - // Clear out Inbound Queue - queueEmpty(sc->queue, (void *)jausMessageDestroy); - - if(prevSc) - { - prevSc->nextSc = sc->nextSc; - sc->nextSc = NULL; - sc = prevSc->nextSc; - } - else - { - nmi->scm->incomingSc = sc->nextSc; - sc->nextSc = NULL; - sc = nmi->scm->incomingSc; - } - nmi->scm->incomingScCount--; - } - else - { - prevSc = sc; - sc = sc->nextSc; - } - } - - pthread_mutex_unlock(&nmi->scm->mutex); -} - -void scManagerAddSupportedMessage(NodeManagerInterface nmi, unsigned short commandCode) -{ - SupportedScMessage supportedScMsg; - - pthread_mutex_lock(&nmi->scm->mutex); - - supportedScMsg = scFindSupportedScMsgInList(nmi->scm->supportedScMsgList, commandCode); - if(supportedScMsg == NULL) - { - supportedScMsg = (SupportedScMessage)malloc(sizeof(struct SupportedScMessageStruct)); - if(supportedScMsg == NULL) - { - // TODO: Throw error - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - - supportedScMsg->commandCode = commandCode; - supportedScMsg->scList = NULL; - - supportedScMsg->nextSupportedScMsg = nmi->scm->supportedScMsgList; - nmi->scm->supportedScMsgList = supportedScMsg; - nmi->scm->supportedScMsgCount++; - } - - pthread_mutex_unlock(&nmi->scm->mutex); -} - -void scManagerRemoveSupportedMessage(NodeManagerInterface nmi, unsigned short commandCode) -{ - SupportedScMessage prevSupportedScMsg = NULL; - SupportedScMessage supportedScMsg; - ServiceConnection sc; - TerminateServiceConnectionMessage terminateSc; - JausMessage txMessage; - - pthread_mutex_lock(&nmi->scm->mutex); - - supportedScMsg = nmi->scm->supportedScMsgList; - - while(supportedScMsg) - { - if(supportedScMsg->commandCode == commandCode) - { - // Remove Service Connection - if(prevSupportedScMsg) - { - prevSupportedScMsg->nextSupportedScMsg = supportedScMsg->nextSupportedScMsg; - } - else - { - nmi->scm->supportedScMsgList = supportedScMsg->nextSupportedScMsg; - } - - // Terminate and free all the service connections - while(supportedScMsg->scList) - { - sc = supportedScMsg->scList; - supportedScMsg->scList = sc->nextSc; - - terminateSc = terminateServiceConnectionMessageCreate(); - jausAddressCopy(terminateSc->source, nmi->cmpt->address); - jausAddressCopy(terminateSc->destination, sc->address); - terminateSc->serviceConnectionCommandCode = sc->commandCode; - terminateSc->instanceId = sc->instanceId; - - txMessage = terminateServiceConnectionMessageToJausMessage(terminateSc); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - terminateServiceConnectionMessageDestroy(terminateSc); - - serviceConnectionDestroy(sc); - } - free(supportedScMsg); - nmi->scm->supportedScMsgCount--; - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - prevSupportedScMsg = supportedScMsg; - supportedScMsg = supportedScMsg->nextSupportedScMsg; - } - - pthread_mutex_unlock(&nmi->scm->mutex); -} - -JausBoolean scManagerQueryActiveMessage(NodeManagerInterface nmi, unsigned short commandCode) -{ - SupportedScMessage supportedScMsg; - - pthread_mutex_lock(&nmi->scm->mutex); - - supportedScMsg = scFindSupportedScMsgInList(nmi->scm->supportedScMsgList, commandCode); - - pthread_mutex_unlock(&nmi->scm->mutex); - - if(supportedScMsg != NULL && supportedScMsg->scList != NULL) - { - return JAUS_TRUE; - } - else - { - return JAUS_FALSE; - } -} - -ServiceConnection scManagerGetSendList(NodeManagerInterface nmi, unsigned short commandCode) -{ - SupportedScMessage supportedScMsg; - ServiceConnection sc; - ServiceConnection newSc = NULL; - ServiceConnection firstSc = NULL; - double currentTime = ojGetTimeSec(); - - pthread_mutex_lock(&nmi->scm->mutex); - - // find the SC object associated with this command code - supportedScMsg = scFindSupportedScMsgInList(nmi->scm->supportedScMsgList, commandCode); - if(supportedScMsg) - { - sc = supportedScMsg->scList; - } - else - { - pthread_mutex_unlock(&nmi->scm->mutex); - return NULL; - } - - while(sc) - { - // Check for update rate - if(sc->isActive && sc->lastSentTime < (currentTime - 1.0/sc->confirmedUpdateRateHz)) - { - sc->lastSentTime = currentTime; - if(newSc == NULL) - { - newSc = (ServiceConnection)malloc(sizeof(ServiceConnectionStruct)); - firstSc = newSc; - } - else - { - newSc->nextSc = (ServiceConnection)malloc(sizeof(ServiceConnectionStruct)); - newSc = newSc->nextSc; - } - - *newSc = *sc; - newSc->nextSc = NULL; - sc->sequenceNumber++; - } - - sc = sc->nextSc; - } - - pthread_mutex_unlock(&nmi->scm->mutex); - return firstSc; -} - -void scManagerDestroySendList(ServiceConnection sc) -{ - ServiceConnection deadSc; - - while(sc) - { - deadSc = sc; - sc = sc->nextSc; - free(deadSc); - } -} - -SupportedScMessage scFindSupportedScMsgInList(SupportedScMessage supportedScMsg, unsigned short commandCode) -{ - while(supportedScMsg) - { - if(supportedScMsg->commandCode == commandCode) - { - return supportedScMsg; - } - supportedScMsg = supportedScMsg->nextSupportedScMsg; - } - - return NULL; -} - -ServiceConnection scFindScInList(ServiceConnection sc, ServiceConnection newSc) -{ - // NOTE: destination, commandCode and presenceVector define the sc equals (==) functionality - // the updateRate is not included - - while(sc) - { - if( jausAddressEqual(sc->address, newSc->address) && sc->instanceId == newSc->instanceId ) - { - return sc; - } - sc = sc->nextSc; - } - - return NULL; -} - -int scGetAvailableInstanceId(ServiceConnection sc, ServiceConnection newSc) -{ - int i; - unsigned char instanceAvailable[256]; - - memset(instanceAvailable, 1, 256); - - while(sc) - { - if(jausAddressEqual(sc->address, newSc->address)) - { - if(sc->presenceVector == newSc->presenceVector) - { - return sc->instanceId; - } - else - { - instanceAvailable[sc->instanceId] = 0; - } - } - sc = sc->nextSc; - } - - for(i = 0; i<256; i++) - { - if(instanceAvailable[i]) - { - return i; - } - } - - return -1; -} - -JausBoolean scManagerCreateServiceConnection(NodeManagerInterface nmi, ServiceConnection sc) -{ - CreateServiceConnectionMessage createSc; - JausMessage txMessage; - JausAddress localAddress; - - ServiceConnection prevSc = NULL; - ServiceConnection testSc = NULL; - - pthread_mutex_lock(&nmi->scm->mutex); - - testSc = nmi->scm->incomingSc; - - if(!sc) - { - pthread_mutex_unlock(&nmi->scm->mutex); - return JAUS_FALSE; - } - - // Remove this service connection from the list of incoming service connections - while(testSc) - { - if(sc == testSc) - { - if(prevSc) - { - prevSc->nextSc = testSc->nextSc; - } - else - { - nmi->scm->incomingSc = testSc->nextSc; - } - nmi->scm->incomingScCount--; - } - - prevSc = testSc; - testSc = testSc->nextSc; - } - - sc->confirmedUpdateRateHz = 0; - sc->lastSentTime = 0; - sc->sequenceNumber = 65535; - sc->instanceId = -1; - sc->isActive = JAUS_FALSE; - sc->nextSc = NULL; - - createSc = createServiceConnectionMessageCreate(); - jausAddressCopy(createSc->source, nmi->cmpt->address); - createSc->serviceConnectionCommandCode = sc->commandCode; - createSc->requestedPeriodicUpdateRateHertz = sc->requestedUpdateRateHz; - createSc->presenceVector = sc->presenceVector; - - // If the subsystem for this service connection is known - if(sc->address && sc->address->subsystem != 0) - { - jausAddressCopy(createSc->destination, sc->address); - - txMessage = createServiceConnectionMessageToJausMessage(createSc); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - createServiceConnectionMessageDestroy(createSc); - - // Add the service connection to the front of the incoming service connection list - sc->nextSc = nmi->scm->incomingSc; - nmi->scm->incomingSc = sc; - nmi->scm->incomingScCount++; - - pthread_mutex_unlock(&nmi->scm->mutex); - return JAUS_TRUE; - } - // otherwise the subsystem is unknown so we assume it is the same subsystem? - else - { - localAddress = jausAddressCreate(); - localAddress->subsystem = nmi->cmpt->address->subsystem; - localAddress->node = 0; - localAddress->component = sc->address->component; - localAddress->instance = 0; - - // Lookup Address from nodeManager - // Tests if the target component exists or not - if(nodeManagerLookupAddress(nmi, localAddress)) - { - jausAddressCopy(createSc->destination, localAddress); - jausAddressCopy(sc->address, localAddress); - - txMessage = createServiceConnectionMessageToJausMessage(createSc); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - jausAddressDestroy(localAddress); - createServiceConnectionMessageDestroy(createSc); - - // Add the service connection to the front of the incoming service connection list - sc->nextSc = nmi->scm->incomingSc; - nmi->scm->incomingSc = sc; - nmi->scm->incomingScCount++; - - pthread_mutex_unlock(&nmi->scm->mutex); - return JAUS_TRUE; - } - else - { - jausAddressDestroy(localAddress); - createServiceConnectionMessageDestroy(createSc); - - pthread_mutex_unlock(&nmi->scm->mutex); - return JAUS_FALSE; - } - } - - pthread_mutex_unlock(&nmi->scm->mutex); -} - -JausBoolean scManagerTerminateServiceConnection(NodeManagerInterface nmi, ServiceConnection deadSc) -{ - TerminateServiceConnectionMessage terminateSc; - JausMessage txMessage; - ServiceConnection prevSc = NULL; - ServiceConnection sc = NULL; - - pthread_mutex_lock(&nmi->scm->mutex); - - sc = nmi->scm->incomingSc; - - while(sc) - { - if(sc->commandCode == deadSc->commandCode && jausAddressEqual(sc->address, deadSc->address) ) - { - if(sc->instanceId > -1) - { - terminateSc = terminateServiceConnectionMessageCreate(); - jausAddressCopy(terminateSc->source, nmi->cmpt->address); - jausAddressCopy(terminateSc->destination, deadSc->address); - terminateSc->serviceConnectionCommandCode = deadSc->commandCode; - terminateSc->instanceId = deadSc->instanceId; - - txMessage = terminateServiceConnectionMessageToJausMessage(terminateSc); - nodeManagerSend(nmi, txMessage); - jausMessageDestroy(txMessage); - - terminateServiceConnectionMessageDestroy(terminateSc); - } - - // Set SC to inactive - sc->isActive = JAUS_FALSE; - - // Empty any Remaining Queue - queueEmpty(sc->queue, (void *)jausMessageDestroy); - - // Remove Service Connection - if(prevSc) - { - prevSc->nextSc = sc->nextSc; - sc->nextSc = NULL; - } - else - { - nmi->scm->incomingSc = sc->nextSc; - sc->nextSc = NULL; - } - - nmi->scm->incomingScCount--; - pthread_mutex_unlock(&nmi->scm->mutex); - return JAUS_TRUE; - } - else - { - prevSc = sc; - sc = sc->nextSc; - } - } - pthread_mutex_unlock(&nmi->scm->mutex); - return JAUS_FALSE; -} - -JausBoolean scManagerReceiveServiceConnection(NodeManagerInterface nmi, ServiceConnection requestSc, JausMessage *message) -{ - ServiceConnection prevSc; - ServiceConnection sc; - - pthread_mutex_unlock(&nmi->scm->mutex); - - sc = nmi->scm->incomingSc; - prevSc = NULL; - while(sc) - { - if(sc->commandCode == requestSc->commandCode && jausAddressEqual(sc->address, requestSc->address) ) - { - if(ojGetTimeSec() > (sc->lastSentTime + sc->timeoutSec)) - { - // Connection has Timed Out - sc->isActive = JAUS_FALSE; - queueEmpty(sc->queue, (void *)jausMessageDestroy); - - // Remove Service Connection - if(prevSc) - { - prevSc->nextSc = sc->nextSc; - sc->nextSc = NULL; - } - else - { - nmi->scm->incomingSc = sc->nextSc; - sc->nextSc = NULL; - } - nmi->scm->incomingScCount--; - pthread_mutex_unlock(&nmi->scm->mutex); - return JAUS_FALSE; - } - - if(sc->queue->size) - { - *message = (JausMessage)queuePop(sc->queue); - pthread_mutex_unlock(&nmi->scm->mutex); - return JAUS_TRUE; - } - else - { - pthread_mutex_unlock(&nmi->scm->mutex); - return JAUS_FALSE; - } - } - else - { - prevSc = sc; - sc = sc->nextSc; - } - } - - pthread_mutex_unlock(&nmi->scm->mutex); - return JAUS_FALSE; -} - -void scManagerReceiveMessage(NodeManagerInterface nmi, JausMessage message) -{ - ServiceConnection sc; - char string[32] = {0}; - - pthread_mutex_lock(&nmi->scm->mutex); - - sc = nmi->scm->incomingSc; - while(sc) - { - if(sc->commandCode == message->commandCode && jausAddressEqual(sc->address, message->source) ) - { - if(sc->isActive) - { - sc->lastSentTime = ojGetTimeSec(); - - if(sc->queueSize && sc->queueSize == sc->queue->size) - { - jausMessageDestroy(queuePop(sc->queue)); - queuePush(sc->queue, (void *)message); - } - else - { - queuePush(sc->queue, (void *)message); - } - } - else - { - // TODO: Error? received a message for inactive SC - jausMessageDestroy(message); - } - pthread_mutex_unlock(&nmi->scm->mutex); - return; - } - sc = sc->nextSc; - } - - jausAddressToString(message->source, string); - jausMessageDestroy(message); - pthread_mutex_unlock(&nmi->scm->mutex); -} - -int scManagerUpdateServiceConnection(ServiceConnection sc, unsigned short sequenceNumber) -{ - int returnValue = JAUS_FALSE; - - sc->lastSentTime = ojGetTimeSec(); - - if(sequenceNumber == sc->sequenceNumber) - { - returnValue = SC_ERROR_SEQUENCE_NUMBERS_EQUAL; - } - else if(sequenceNumber == 0 && sc->sequenceNumber != 65535) - { - returnValue = SC_ERROR_SEQUENCE_NUMBER_OUT_OF_SYNC; - } - else if(sequenceNumber - sc->sequenceNumber != 1 && sequenceNumber !=0) - { - returnValue = SC_ERROR_SEQUENCE_NUMBER_OUT_OF_SYNC; - } - else - { - returnValue = JAUS_TRUE; - } - - sc->sequenceNumber = sequenceNumber; - - return returnValue; -} diff --git a/lib/openjaus/libopenJaus/src/utils/FileLoader.cpp b/lib/openjaus/libopenJaus/src/utils/FileLoader.cpp deleted file mode 100644 index 0da4ac07831c05f5d708672ec3dc66daaafcde47..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/utils/FileLoader.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: FileLoader.cpp -// -// Written By: Jeffrey Kunkle -// -// Version: 3.3.0a -// -// Date: 04/26/2006 -// -// Modifications: -// Date/Author -// Description -// -// @par 04-26-2006 Jeff Kunkle -// - Initial Creation -// -// @par 12-08-2006 Jeff Kunkle -// - Updated to Visual Studio 2005. -// -// @par 10-23-2007 Danny Kent -// - Updated for use in the NodeManager project - -#include "utils/FileLoader.h" - -#ifndef WIN32 - #include - #include - #define stricmp(x,y) strcasecmp(x,y) - #define strtok_s(x,y,z) strtok_r(x,y,z) -#else - #define stricmp(x,y) _stricmp(x,y) -#endif - - -FileLoader::FileLoader(){} -FileLoader::FileLoader( string filename ){ load_cfg( filename); } - -FileLoader::~FileLoader(){} - -bool FileLoader::load_cfg( string filename ) -{ - ifstream cfg_file( filename.c_str(), ios::in ); - - if( cfg_file.fail() ) - { - //DebugUtil::error( "FileLoader: load_cfg: Unable to open file: \"%s\"\n", filename.c_str() ); - cfg_file.close(); - return false; - } - - char buffer[256]; - char *token, *next_token; - - Config_File_Data_t tmp; - Config_Data_t tmpInfo; - tmp.configheader = ""; - - while( cfg_file.getline( buffer, sizeof( buffer ) - 1 ) ) - { - token = strtok_s( buffer, ": ", &next_token ); - if ( token == NULL || token[0] == '\r' ); // This is a blank line - else if( token[0] == ';' ); // This is a comment - else if( token[0] == '/' ); // This is a comment - else if( token[0] == '*' ); // This is a comment - else if( token[0] == '#' ); // This is a comment - else if( token[0] == '[' ) // This is a label - { - if( tmp.configheader != "" ){ configFileData.push_back( tmp ); } - - token = strtok_s( token, "[]", &next_token ); - tmp.configheader = token; - tmp.data.clear(); - } - else - { - tmpInfo.label = token; - while( token != NULL ) - { - token = strtok_s( NULL, " ,\r\t", &next_token ); - if( token != NULL ) - { - tmpInfo.tok.push_back( token ); - } - } - tmp.data.push_back( tmpInfo ); - tmpInfo.label = ""; - tmpInfo.tok.clear(); - } - - } - - if( tmp.configheader != "" ){ configFileData.push_back( tmp ); } - cfg_file.close(); - - return true; -} - - -string FileLoader::GetConfigDataString( string header, string label ) -{ - int hdr_index = findHeader( header ); - if( hdr_index == -1 ){ return ""; } - - int lbl_index = findLabel( hdr_index, label ); - if( lbl_index == -1 ){ return ""; } - - if( configFileData[ hdr_index ].data[ lbl_index ].tok.empty() ){ return ""; } - - return configFileData[ hdr_index ].data[ lbl_index ].tok[0]; -} - -int FileLoader::GetConfigDataInt( string header, string label ) -{ - string tmp = GetConfigDataString( header, label ); - return ( tmp != "" ? atoi( tmp.c_str() ) : -1 ); -} - -float FileLoader::GetConfigDataFloat( string header, string label ) -{ - string tmp = GetConfigDataString( header, label ); - return ( tmp != "" ? (float)atof( tmp.c_str() ) : -1.0f ); -} - -double FileLoader::GetConfigDataDouble( string header, string label ) -{ - string tmp = GetConfigDataString( header, label ); - return ( tmp != "" ? atof( tmp.c_str() ) : -1 ); -} -bool FileLoader::GetConfigDataBool( string header, string label ) -{ - string tmp = GetConfigDataString( header, label ); - return ( stricmp( tmp.c_str(), "true" ) == 0 ? true : false ); -} -vector< string >* FileLoader::GetConfigDataVector( string header, string label ) -{ - int hdr_index = findHeader( header ); - if( hdr_index == -1 ){ return NULL; } - - int lbl_index = findLabel( hdr_index, label ); - if( lbl_index == -1 ){ return NULL; } - - vector< string > *rtnData = new vector< string >(); - - int datasize = (int)configFileData[ hdr_index ].data[ lbl_index ].tok.size(); - - for( int i=0; ipush_back( tmp ); - } - - return rtnData; -} - -int FileLoader::findHeader( string hdr ) -{ - int rtn = 0; - vector< Config_File_Data_t >::iterator findHead = configFileData.begin(); - - while( findHead != configFileData.end() && ( *findHead ).configheader != hdr ) - { - findHead++; - rtn++; - } - if( rtn < (int)configFileData.size() ){ return rtn; } - else{ return -1; } -} - - -int FileLoader::findLabel( int hdrIndex, string label ) -{ - int rtn = 0; - vector< Config_Data_t >::iterator findLabel = configFileData[hdrIndex].data.begin(); - - while( findLabel != configFileData[hdrIndex].data.end() && ( *findLabel ).label != label ) - { - findLabel++; - rtn++; - } - - if( rtn < (int)configFileData[hdrIndex].data.size() ){ return rtn; } - else{ return -1; } -} diff --git a/lib/openjaus/libopenJaus/src/utils/datagramPacket.c b/lib/openjaus/libopenJaus/src/utils/datagramPacket.c deleted file mode 100644 index 4946a2768d0f833905f80dd668e0d89d1727a3dc..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/utils/datagramPacket.c +++ /dev/null @@ -1,76 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: datagramPacket.c -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes the functionality associated with a DatagramPacket object. -// Inspired by the class of the same name in the JAVA language. - -#include -#include -#include - -#include "utils/datagramPacket.h" - -DatagramPacket datagramPacketCreate(void) -{ - DatagramPacket packet; - - packet = (DatagramPacket)malloc( sizeof(DatagramPacketStruct) ); - if(packet == NULL) - { - return NULL; - } - - packet->address = inetAddressCreate(); - if(packet->address == NULL) - { - free(packet); - return NULL; - } - - return packet; -} - -void datagramPacketDestroy(DatagramPacket packet) -{ - inetAddressDestroy(packet->address); - - free(packet); -} diff --git a/lib/openjaus/libopenJaus/src/utils/datagramSocket.c b/lib/openjaus/libopenJaus/src/utils/datagramSocket.c deleted file mode 100644 index 01dbcc7b6c8bd9092a1b2d56b09afc88aa041592..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/utils/datagramSocket.c +++ /dev/null @@ -1,191 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: datagramSocket.c -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes the functionality associated with a DatagramSocket object. -// Inspired by the class of the same name in the JAVA language. - -#include -#include -#include -#include "utils/datagramSocket.h" - -DatagramSocket datagramSocketCreate(short port, InetAddress ipAddress) -{ - DatagramSocket datagramSocket; - struct sockaddr_in address; - socklen_t addressLength = sizeof(address); - -#ifdef WIN32 - // Initialize the socket subsystem - WSADATA wsaData; - int err; - err = WSAStartup(MAKEWORD(2, 2), &wsaData); - if(err != 0) - { - return NULL; - } -#endif - - datagramSocket = (DatagramSocket) malloc( sizeof(DatagramSocketStruct) ); - if( datagramSocket == NULL ) - { - return NULL; - } - - // Open a socket with: Protocol Family (PF) IPv4, of Datagram Socket Type, and using UDP IP protocol explicitly - datagramSocket->descriptor = (int) socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); - if(datagramSocket->descriptor == -1) - { - return NULL; - } - - memset(&address, 0, sizeof(address)); // Clear the data structure to zero - address.sin_family = AF_INET; // Set Internet Socket (sin), Family to: Address Family (AF) IPv4 (INET) - address.sin_addr.s_addr = ipAddress->value; // Set Internet Socket (sin), Address to: The ipAddressString argument - address.sin_port = htons(port); // Set Internet Socket (sin), Port to: the port argument - - // Bind our open socket to a free port on the localhost, with our defined ipAddress - if(bind(datagramSocket->descriptor, (struct sockaddr *)&address, sizeof(address))) - { - CLOSE_SOCKET(datagramSocket->descriptor); - return NULL; - } - - if(getsockname(datagramSocket->descriptor, (struct sockaddr *)&address, &addressLength)) - { - CLOSE_SOCKET(datagramSocket->descriptor); - return NULL; - } - - datagramSocket->address = ipAddress; - datagramSocket->port = ntohs(address.sin_port); - datagramSocket->timeout.tv_sec = 0; - datagramSocket->timeout.tv_usec = 0; - datagramSocket->blocking = 1; - - return datagramSocket; -} - -void datagramSocketDestroy(DatagramSocket datagramSocket) -{ - CLOSE_SOCKET(datagramSocket->descriptor); - free(datagramSocket); -#ifdef WIN32 - // Initialize the socket subsystem - WSACleanup(); -#endif -} - -int datagramSocketSend(DatagramSocket datagramSocket, DatagramPacket packet) -{ - struct sockaddr_in toAddress; - int bytesSent = 0; - - memset(&toAddress, 0, sizeof(toAddress)); - toAddress.sin_family = AF_INET; // Set Internet Socket (sin), Family to: Address Family (AF) IPv4 (INET) - toAddress.sin_addr.s_addr = packet->address->value; // Set Internet Socket (sin), Address to: The packet ipAddressString - toAddress.sin_port = htons(packet->port); // Set Internet Socket (sin), Port to: the packet port - - bytesSent = sendto(datagramSocket->descriptor, (void *)packet->buffer, packet->bufferSizeBytes, 0, (struct sockaddr *)&toAddress, sizeof(toAddress)); - return bytesSent; -} - -int datagramSocketReceive(DatagramSocket datagramSocket, DatagramPacket packet) -{ - struct timeval timeout; - struct timeval *timeoutPtr = NULL; - fd_set readSet; - struct sockaddr_in fromAddress; - socklen_t fromAddressLength; - int bytesReceived = 0; - int selcetReturnVal = -2; - - memset(&fromAddress, 0, sizeof(fromAddress)); - - if(!datagramSocket->blocking) - { - timeout = datagramSocket->timeout; - timeoutPtr = &timeout; - } - - FD_ZERO(&readSet); - FD_SET(datagramSocket->descriptor, &readSet); - - selcetReturnVal = select(datagramSocket->descriptor + 1, &readSet, NULL, NULL, timeoutPtr); - if(selcetReturnVal > 0) - { - if(FD_ISSET(datagramSocket->descriptor, &readSet)) - { - fromAddressLength = sizeof(fromAddress); - bytesReceived = recvfrom(datagramSocket->descriptor, packet->buffer, packet->bufferSizeBytes, 0, (struct sockaddr*)&fromAddress, &fromAddressLength); - - if(bytesReceived != -1) - { - packet->port = ntohs(fromAddress.sin_port); - packet->address->value = fromAddress.sin_addr.s_addr; - } - return bytesReceived; - } - else - { - return -2; - } - } - else - { - return selcetReturnVal; - } -} - -void datagramSocketSetTimeout(DatagramSocket datagramSocket, double timeoutSec) -{ - long sec, usec; - - sec = (long)timeoutSec; - usec = (long)((timeoutSec - (double)sec) * 1.0e6); - - datagramSocket->timeout.tv_sec = sec; - datagramSocket->timeout.tv_usec = usec; - datagramSocket->blocking = 0; -} - - - diff --git a/lib/openjaus/libopenJaus/src/utils/inetAddress.c b/lib/openjaus/libopenJaus/src/utils/inetAddress.c deleted file mode 100644 index af7918b0237d8cfb784c98241f2fda652c7ccdea..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/utils/inetAddress.c +++ /dev/null @@ -1,200 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: inetAddress.c -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes the functionality associated with a InetAddress object. -// Inspired by the class of the same name in the JAVA language. - -#include -#include -#include - -#include "utils/inetAddress.h" - -//#ifdef WIN32 -// const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt); -// int inet_pton(int af, const char *src, void *dst); -//#endif - -InetAddress inetAddressCreate(void) -{ - return (InetAddress) malloc( sizeof(InetAddressStruct) ); -} - -void inetAddressDestroy(InetAddress address) -{ - free(address); -} - -InetAddress inetAddressGetLocalHost(void) -{ - struct hostent *localhost; - InetAddress address; - -#ifdef WIN32 - // Initialize the socket subsystem - WSADATA wsaData; - int err; - err = WSAStartup(MAKEWORD(2, 2), &wsaData); - if(err != 0) - { - return NULL; - } -#endif - - address = (InetAddress) malloc( sizeof(InetAddressStruct) ); - if( address == NULL ) - { - return NULL; - } - - // Get the localhost entry, which allows us to connect to the loopback ip interface - localhost = gethostbyname("127.0.0.1"); - if(localhost == NULL) - { - return NULL; - } - else - { - memcpy(address, localhost->h_addr_list[0], sizeof(InetAddressStruct)); - return address; - } -} - -InetAddress inetAddressGetByName(char *nameString) -{ - struct hostent *host; - InetAddress address; - -#ifdef WIN32 - // Initialize the socket subsystem - WSADATA wsaData; - int err; - err = WSAStartup(MAKEWORD(2, 2), &wsaData); - if(err != 0) - { - return NULL; - } -#endif - - address = (InetAddress) malloc( sizeof(InetAddressStruct) ); - if( address == NULL ) - { - return NULL; - } - - host = gethostbyname(nameString); - if(host == NULL) - { - return NULL; - } - else - { - memcpy(address, host->h_addr_list[0], sizeof(InetAddressStruct)); - return address; - } -} - -InetAddress inetAddressGetByString(char *addressString) -{ - struct hostent *host; - InetAddress address; - -#ifdef WIN32 - // Initialize the socket subsystem - WSADATA wsaData; - int err; - err = WSAStartup(MAKEWORD(2, 2), &wsaData); - if(err != 0) - { - return NULL; - } -#endif - - address = (InetAddress) malloc( sizeof(InetAddressStruct) ); - if( address == NULL ) - { - return NULL; - } - - host = gethostbyname(addressString); - if(host == NULL) - { - return NULL; - } - else - { - memcpy(address, host->h_addr_list[0], sizeof(InetAddressStruct)); - return address; - } -} - -int inetAddressToString(InetAddress address, char *string) -{ - struct in_addr inAddress; - - memset(&inAddress, 0, sizeof(inAddress)); - inAddress.s_addr = address->value; - - return sprintf(string, "%s", inet_ntoa(inAddress)); -} - -void inetAddressToBuffer(InetAddress address, char *string, int length) -{ -#ifdef WIN32 - struct in_addr inAddress; - struct sockaddr_in in; - - memset(&inAddress, 0, sizeof(inAddress)); - inAddress.s_addr = address->value; - - memset(&in, 0, sizeof(in)); - in.sin_family = AF_INET; - memcpy(&in.sin_addr, &inAddress, sizeof(struct in_addr)); - getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in), string, length, NULL, 0, NI_NUMERICHOST); - -#else - struct in_addr inAddress; - - memset(&inAddress, 0, sizeof(inAddress)); - inAddress.s_addr = address->value; - inet_ntop(AF_INET, &inAddress, string, length); -#endif -} diff --git a/lib/openjaus/libopenJaus/src/utils/multicastSocket.c b/lib/openjaus/libopenJaus/src/utils/multicastSocket.c deleted file mode 100644 index d656f73a745aed300367b00e013ca638944e5b41..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/utils/multicastSocket.c +++ /dev/null @@ -1,302 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: multicastSocket.c -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes the functionality associated with a MulicastSocket object. -// Inspired by the class of the same name in the JAVA language. - -#include -#include -#include -#include "utils/multicastSocket.h" - -MulticastSocket multicastSocketCreate(short port, InetAddress ipAddress) -{ - MulticastSocket multicastSocket; - struct sockaddr_in address; - socklen_t addressLength = sizeof(address); - -#ifdef WIN32 - // Initialize the socket subsystem - WSADATA wsaData; - int err; - err = WSAStartup(MAKEWORD(2, 2), &wsaData); - if(err != 0) - { - return NULL; - } -#endif - - multicastSocket = (MulticastSocket)malloc( sizeof(MulticastSocketStruct) ); - if(multicastSocket == NULL) - { - return NULL; - } - multicastSocket->address = inetAddressCreate(); - multicastSocket->unicastSocketDescriptor = -1; - multicastSocket->multicastSocketDescriptor = -1; - - // Open a socket with: Protocol Family (PF) IPv4, of Datagram Socket Type, and using UDP IP protocol explicitly - multicastSocket->unicastSocketDescriptor = (int) socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); - if(multicastSocket->unicastSocketDescriptor == -1) - { - multicastSocketDestroy(multicastSocket); - return NULL; - } - - memset(&address, 0, sizeof(address)); // Clear the data structure to zero - address.sin_family = AF_INET; // Set Internet Socket (sin), Family to: Address Family (AF) IPv4 (INET) - address.sin_addr.s_addr = ipAddress->value; // Set Internet Socket (sin), Address to: The ipAddressString argument - address.sin_port = htons(port); // Set Internet Socket (sin), Port to: the port argument - - // Bind our open socket to a free port on the given interface, with our defined ipAddress - if(bind(multicastSocket->unicastSocketDescriptor, (struct sockaddr *)&address, sizeof(address))) - { - multicastSocketDestroy(multicastSocket); - return NULL; - } - - if(getsockname(multicastSocket->unicastSocketDescriptor, (struct sockaddr *)&address, &addressLength)) - { - multicastSocketDestroy(multicastSocket); - return NULL; - } - - // Tell the kernel to send multicast packets from this interface - if(setsockopt(multicastSocket->unicastSocketDescriptor, IPPROTO_IP, IP_MULTICAST_IF, (char *)&ipAddress->value, sizeof(ipAddress->value))) - { - multicastSocketDestroy(multicastSocket); - return NULL; - } - - ipAddress->value = address.sin_addr.s_addr; - multicastSocket->address->value = ipAddress->value; - multicastSocket->port = ntohs(address.sin_port); - multicastSocket->timeout.tv_sec = 0; - multicastSocket->timeout.tv_usec = 0; - multicastSocket->blocking = 1; - multicastSocket->multicastSocketDescriptor = -1; - - return multicastSocket; -} - -void multicastSocketDestroy(MulticastSocket multicastSocket) -{ - if(multicastSocket->unicastSocketDescriptor != -1) - { - CLOSE_SOCKET(multicastSocket->unicastSocketDescriptor); - } - - if(multicastSocket->multicastSocketDescriptor != -1) - { - CLOSE_SOCKET(multicastSocket->multicastSocketDescriptor); - } - - inetAddressDestroy(multicastSocket->address); - free(multicastSocket); - -#ifdef WIN32 - // Initialize the socket subsystem - WSACleanup(); -#endif - -} - -int multicastSocketJoinGroup(MulticastSocket multicastSocket, InetAddress groupIpAddress) -{ - struct ip_mreq multicastRequest; - - if(multicastSocket == NULL) - { - return -1; - } - - if(groupIpAddress == NULL) - { - return -1; - } - - multicastRequest.imr_multiaddr.s_addr = groupIpAddress->value; - multicastRequest.imr_interface.s_addr = multicastSocket->address->value; - -#if defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - // Open a socket with: Protocol Family (PF) IPv4, of Datagram Socket Type, and using UDP IP protocol explicitly - multicastSocket->multicastSocketDescriptor = (int) socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); - if(multicastSocket->multicastSocketDescriptor == -1) - { - return -1; - } - - struct sockaddr_in address; - memset(&address, 0, sizeof(address)); // Clear the data structure to zero - address.sin_family = AF_INET; // Set Internet Socket (sin), Family to: Address Family (AF) IPv4 (INET) - address.sin_addr.s_addr = groupIpAddress->value; // Set Internet Socket (sin), Address to: The ipAddressString argument - address.sin_port = htons(multicastSocket->port); // Set Internet Socket (sin), Port to: the port argument - - // Bind our open socket to a free port on the given interface, with our defined ipAddress - if(bind(multicastSocket->multicastSocketDescriptor, (struct sockaddr *)&address, sizeof(address))) - { - printf("Error: Cannot bind multicast socket to %s:%d\n", inet_ntoa(address.sin_addr), ntohs(address.sin_port)); - CLOSE_SOCKET(multicastSocket->multicastSocketDescriptor); - return -1; - } - - return setsockopt(multicastSocket->multicastSocketDescriptor, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&multicastRequest, sizeof(multicastRequest)); -#else - return setsockopt(multicastSocket->unicastSocketDescriptor, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&multicastRequest, sizeof(multicastRequest)); -#endif - -} - -int multicastSocketSend(MulticastSocket multicastSocket, DatagramPacket packet) -{ - struct sockaddr_in toAddress; - int bytesSent = 0; - - memset(&toAddress, 0, sizeof(toAddress)); - toAddress.sin_family = AF_INET; // Set Internet Socket (sin), Family to: Address Family (AF) IPv4 (INET) - toAddress.sin_addr.s_addr = packet->address->value; // Set Internet Socket (sin), Address to: The packet ipAddressString - toAddress.sin_port = htons(packet->port); // Set Internet Socket (sin), Port to: the packet port - - bytesSent = sendto(multicastSocket->unicastSocketDescriptor, (void *)packet->buffer, packet->bufferSizeBytes, 0, (struct sockaddr *)&toAddress, sizeof(toAddress)); - - return bytesSent; -} - -int multicastSocketReceive(MulticastSocket multicastSocket, DatagramPacket packet) -{ - struct timeval timeout; - struct timeval *timeoutPtr = NULL; - fd_set readSet; - struct sockaddr_in fromAddress; - socklen_t fromAddressLength; - int bytesReceived = 0; - int count = 0; - int socket = 0; - - memset(&fromAddress, 0, sizeof(fromAddress)); - - if(!multicastSocket->blocking) - { - timeout = multicastSocket->timeout; - timeoutPtr = &timeout; - } - - FD_ZERO(&readSet); - FD_SET(multicastSocket->unicastSocketDescriptor, &readSet); - socket = multicastSocket->unicastSocketDescriptor; - - if(multicastSocket->multicastSocketDescriptor != -1) - { - FD_SET(multicastSocket->multicastSocketDescriptor, &readSet); - socket = multicastSocket->multicastSocketDescriptor; - } - - count = select(socket + 1, &readSet, NULL, NULL, timeoutPtr); - if(count > 0) - { - fromAddressLength = sizeof(fromAddress); - - if(FD_ISSET(multicastSocket->unicastSocketDescriptor, &readSet)) - { - bytesReceived = recvfrom(multicastSocket->unicastSocketDescriptor, packet->buffer, packet->bufferSizeBytes, 0, (struct sockaddr*)&fromAddress, &fromAddressLength); - } - if(multicastSocket->multicastSocketDescriptor != -1 && FD_ISSET(multicastSocket->multicastSocketDescriptor, &readSet)) - { - bytesReceived = recvfrom(multicastSocket->multicastSocketDescriptor, packet->buffer, packet->bufferSizeBytes, 0, (struct sockaddr*)&fromAddress, &fromAddressLength); - } - } - else - { - return -1; - } - - if(bytesReceived != -1) - { - packet->port = ntohs(fromAddress.sin_port); - packet->address->value = fromAddress.sin_addr.s_addr; - return bytesReceived; - } - else - { - return -1; - } -} - -void multicastSocketSetTimeout(MulticastSocket multicastSocket, double timeoutSec) -{ - long sec, usec; - - sec = (long)timeoutSec; - usec = (long)((timeoutSec - (double)sec) * 1.0e6); - - multicastSocket->timeout.tv_sec = sec; - multicastSocket->timeout.tv_usec = usec; - multicastSocket->blocking = 0; -} - -int multicastSocketSetTTL(MulticastSocket multicastSocket, unsigned int ttl) -{ - if(ttl > 255) - { - ttl = 255; - } - - if(ttl < 1) - { - ttl = 1; - } - - if(multicastSocket->multicastSocketDescriptor != -1) - { - return (setsockopt(multicastSocket->multicastSocketDescriptor, IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(unsigned int)) && - setsockopt(multicastSocket->unicastSocketDescriptor, IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(unsigned int)) ); - } - else - { - return setsockopt(multicastSocket->unicastSocketDescriptor, IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(unsigned int)); - } -} - -int multicastSocketSetLoopback(MulticastSocket multicastSocket, unsigned int loop) -{ - return setsockopt(multicastSocket->unicastSocketDescriptor, IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&loop, sizeof(unsigned int)); -} - diff --git a/lib/openjaus/libopenJaus/src/utils/queue.c b/lib/openjaus/libopenJaus/src/utils/queue.c deleted file mode 100644 index b344b528a51ce3bb58e58223742ba6c4104d7388..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/utils/queue.c +++ /dev/null @@ -1,168 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: queue.c -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: This file describes the functionality associated with a generic void pointer Queue object. - -#include -#include -#include "utils/queue.h" - -Queue queueCreate(void) -{ - Queue queue = NULL; - - queue = (Queue)malloc( sizeof(QueueStruct) ); - if(queue == NULL) - { - return NULL; - } - - queue->firstObject = NULL; - queue->lastObject = NULL; - queue->size = 0; - pthread_mutex_init(&queue->mutex, NULL); - - return queue; -} - -void queueDestroy(Queue queue, void (*objectDestroy)(void *)) -{ - if(queue == NULL) - { - return; - } - - queueEmpty(queue, objectDestroy); - - pthread_mutex_destroy(&queue->mutex); - - free(queue); -} - -void *queuePopNoLock(Queue queue) -{ - QueueObject *queueObject; - void *object; - - queueObject = queue->firstObject; - - if(queueObject) - { - queue->firstObject = queueObject->nextObject; - if(queue->firstObject == NULL) - { - queue->lastObject = NULL; - } - queue->size--; - - object = queueObject->object; - - free(queueObject); - } - else - { - object = NULL; - } - - return object; -} - -void queueEmpty(Queue queue, void (*objectDestroy)(void *)) -{ - void *object; - - if(queue) - { - pthread_mutex_lock(&queue->mutex); - - while(queue->size) - { - object = queuePopNoLock(queue); - - if(objectDestroy) - { - objectDestroy(object); - } - } - - pthread_mutex_unlock(&queue->mutex); - } -} - -void *queuePop(Queue queue) -{ - void *object; - - pthread_mutex_lock(&queue->mutex); - - object = queuePopNoLock(queue); - - pthread_mutex_unlock(&queue->mutex); - - return object; -} - -void queuePush(Queue queue, void *object) -{ - QueueObject *queueObject; - - queueObject = (QueueObject*)malloc( sizeof(QueueObject) ); - queueObject->object = object; - queueObject->nextObject = NULL; - - pthread_mutex_lock(&queue->mutex); - - if(queue->firstObject == NULL) - { - queue->firstObject = queueObject; - } - - if(queue->lastObject) - { - queue->lastObject->nextObject = queueObject; - } - - queue->lastObject = queueObject; - - queue->size++; - - pthread_mutex_unlock(&queue->mutex); -} diff --git a/lib/openjaus/libopenJaus/src/utils/timeLib.c b/lib/openjaus/libopenJaus/src/utils/timeLib.c deleted file mode 100644 index 9f8fa021ba1bfe289cdb5f26beb65326505409c3..0000000000000000000000000000000000000000 --- a/lib/openjaus/libopenJaus/src/utils/timeLib.c +++ /dev/null @@ -1,107 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: timeLib.c -// -// Written by: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: CIMAR timing library header file - -#include "utils/timeLib.h" - -#ifdef WIN32 - #include - #include - - double getTimeSeconds(void) - { - static char init = 0; - static TIMECAPS timerInfo; - - if(!init) - { - timeGetDevCaps(&timerInfo, sizeof(TIMECAPS)); - timeBeginPeriod(timerInfo.wPeriodMin); - init = 1; - } - - return (double) (timeGetTime() / 1000.0); - } - - double ojGetTimeSec(void) - { - // TODO: the following code could have a 1 second inaccuracy if a second transition occurs after the GetSystemTime call - SYSTEMTIME st; - GetSystemTime(&st); - return time(NULL) + st.wMilliseconds / 1000.0; - } - - void ojSleepMsec(int msec) - { - Sleep(msec); - } - -#else - - #include - #include - #include - - double getTimeSeconds(void) - { - static struct timeval time; - - gettimeofday(&time, NULL); - - return (double)time.tv_sec + (double)time.tv_usec/1.0e6; - } - - double ojGetTimeSec(void) - { - static struct timeval time; - - gettimeofday(&time, NULL); - - return (double)time.tv_sec + (double)time.tv_usec/1.0e6; - } - - void ojSleepMsec(int msec) - { - usleep(msec * 1000); - } - -#endif diff --git a/lib/openjaus/ojNodeManager/nodeManager.conf.template b/lib/openjaus/ojNodeManager/nodeManager.conf.template deleted file mode 100644 index 2d2137bd1e8d5394f99197545c81c63b1c7881da..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojNodeManager/nodeManager.conf.template +++ /dev/null @@ -1,27 +0,0 @@ -# This subsection defines the JAUS characteristics of the node -[JAUS] -SubsystemId: -NodeId: -Subsystem_Identification: OJSubsystem -Node_Identification: OJNode - -# This subsection defines the interfaces and their options for component communication -[Component_Communications] -JAUS_OPC_UDP_Interface: true -OpenJAUS_UDP_Interface: true - -# This subsection defines the interfaces and their options for node communication -[Node_Communications] -Enabled: false -#JUDP_Interface: true -#JUDP_IP_Address: -#JAUS_OPC_UDP_Interface: true -#JAUS_OPC_UDP_IP_Address: - -# This subsection defines the interfaces and their options for subsystem communication -[Subsystem_Communications] -Enabled: true -JUDP_Interface: true -JUDP_IP_Address: -#JAUS_OPC_UDP_Interface: true -#JAUS_OPC_UDP_IP_Address: diff --git a/lib/openjaus/ojNodeManager/ojNodeManager.pro b/lib/openjaus/ojNodeManager/ojNodeManager.pro deleted file mode 100644 index 1aec76e4e9169b6e500d683a1c5347f77ca5d644..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojNodeManager/ojNodeManager.pro +++ /dev/null @@ -1,42 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Sa Mai 2 12:30:56 2009 -###################################################################### - -TEMPLATE = app - -QT -= gui -CONFIG += static - -VERSION = 3.3.0a - -BASEDIR = . -BUILDDIR = Build - -INCLUDEPATH += $$BASEDIR/../libjaus/include \ - $$BASEDIR/../libopenJaus/include - -LANGUAGE = C++ - -OBJECTS_DIR = $$BUILDDIR/obj -MOC_DIR = $$BUILDDIR/moc - -macx { -TARGET = bin/mac/nodemanager -LIBS += -L$$BASEDIR/../libjaus/lib/mac/libjaus.a -ljaus \ - -L$$BASEDIR/../libopenJaus/lib/mac/libopenjaus.a -lopenjaus -} - -linux-g++ { -TARGET = bin/linux/nodemanager -LIBS += -L$$BASEDIR/../libjaus/lib/linux/libjaus.a -ljaus \ - -L$$BASEDIR/../libopenJaus/lib/linux/libopenjaus.a -lopenjaus -} - -win32 { -TARGET = bin/win32/nodemanager -LIBS += -L$$BASEDIR/../libjaus/lib/win32/libjaus.a -ljaus \ - -L$$BASEDIR/../libopenJaus/lib/win32/libopenjaus.a -lopenjaus -} - -# Input -SOURCES += src/main.cpp diff --git a/lib/openjaus/ojNodeManager/src/main.cpp b/lib/openjaus/ojNodeManager/src/main.cpp deleted file mode 100644 index a21b1990c01d7800fb2a440607a112b40decb041..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojNodeManager/src/main.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: ojNodeManager.cpp -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.3.0a -// -// Date: 08/07/08 -// -// Description: - -#include "openJaus.h" - -#if defined(WIN32) - #include - #define CLEAR_COMMAND "cls" -#elif defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - #include - #include - #include - #define CLEAR_COMMAND "clear" -#endif - -void printHelpMenu(); -void parseUserInput(char input); - -static NodeManager *nm; - -class MyHandler : public EventHandler -{ -public: - ~MyHandler() - { - - } - - void handleEvent(NodeManagerEvent *e) - { - SystemTreeEvent *treeEvent; - ErrorEvent *errorEvent; - JausMessageEvent *messageEvent; - DebugEvent *debugEvent; - ConfigurationEvent *configEvent; - - switch(e->getType()) - { - case NodeManagerEvent::SystemTreeEvent: - treeEvent = (SystemTreeEvent *)e; - printf("%s\n", treeEvent->toString().c_str()); - delete e; - break; - - case NodeManagerEvent::ErrorEvent: - errorEvent = (ErrorEvent *)e; - printf("%s\n", errorEvent->toString().c_str()); - delete e; - break; - - case NodeManagerEvent::JausMessageEvent: - messageEvent = (JausMessageEvent *)e; - // If you turn this on, the system gets spam-y this is very useful for debug purposes - if(messageEvent->getJausMessage()->commandCode != JAUS_REPORT_HEARTBEAT_PULSE) - { - //printf("%s\n", messageEvent->toString().c_str()); - } - else - { - //printf("%s\n", messageEvent->toString().c_str()); - } - delete e; - break; - - case NodeManagerEvent::DebugEvent: - debugEvent = (DebugEvent *)e; - //printf("%s\n", debugEvent->toString().c_str()); - delete e; - break; - - case NodeManagerEvent::ConfigurationEvent: - configEvent = (ConfigurationEvent *)e; - printf("%s\n", configEvent->toString().c_str()); - delete e; - break; - - default: - delete e; - break; - } - } -}; - -#if defined(WIN32) -int main(int argc, char **args) -{ - // Console parameters - HANDLE handleStdin; - INPUT_RECORD inputEvents[128]; - DWORD eventCount; - - // Control parameter - bool running = true; - int i = 0; - - printf("\nOpenJAUS Node Manager Version %s (August 7, 2008)\n\n", OJ_NODE_MANAGER_VERSION); - - // Setup the console window's input handle - handleStdin = GetStdHandle(STD_INPUT_HANDLE); - - MyHandler *handler = new MyHandler(); - FileLoader *configData = new FileLoader("nodeManager.conf"); - - try - { - nm = new NodeManager(configData, handler); - printHelpMenu(); - } - catch(char *exceptionString) - { - printf("%s\n", exceptionString); - printf("Terminating Program...\n"); - running = false; - } - catch(...) - { - printf("Node Manager Construction Failed. Terminating Program...\n"); - running = false; - } - - while(running) - { - // See how many events are waiting for us, this prevents blocking if none - GetNumberOfConsoleInputEvents(handleStdin, &eventCount); - - if(eventCount > 0) - { - // Check for user input here - ReadConsoleInput( - handleStdin, // input buffer handle - inputEvents, // buffer to read into - 128, // size of read buffer - &eventCount); // number of records read - } - - // Parse console input events - for (i = 0; i < (int) eventCount; i++) - { - switch(inputEvents[i].EventType) - { - case KEY_EVENT: // keyboard input - if(inputEvents[i].Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) - { - running = false; - } - else if(inputEvents[i].Event.KeyEvent.bKeyDown) - { - parseUserInput(inputEvents[i].Event.KeyEvent.uChar.AsciiChar); - } - break; - - default: - break; - } - } - - Sleep((DWORD)(0.2*1e3)); - } - - delete nm; - delete configData; - delete handler; - - system("pause"); - - return 0; -} - -#elif defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - -int main(int argc, char **args) -{ - struct termios newTermio; - struct termios storedTermio; - bool running = true; - char choice[8] = {0}; - int count = 0; - - tcgetattr(0,&storedTermio); - memcpy(&newTermio,&storedTermio,sizeof(struct termios)); - - // Disable canonical mode, and set buffer size to 0 byte(s) - newTermio.c_lflag &= (~ICANON); - newTermio.c_lflag &= (~ECHO); - newTermio.c_cc[VTIME] = 0; - newTermio.c_cc[VMIN] = 1; - tcsetattr(0,TCSANOW,&newTermio); - - printf("\nOpenJAUS Node Manager Version %s (JULY 9, 2008)\n\n", OJ_NODE_MANAGER_VERSION); - - FileLoader *configData = new FileLoader("nodeManager.conf"); - MyHandler *handler = new MyHandler(); - - try - { - nm = new NodeManager(configData, handler); - printHelpMenu(); - } - catch(char *exceptionString) - { - printf("%s", exceptionString); - printf("Terminating Program...\n"); - running = false; - } - catch(...) - { - printf("Node Manager Construction Failed. Terminating Program...\n"); - running = false; - } - - while(running) - { - bzero(choice, 8); - count = read(0, &choice, 8); - if(count == 1 && choice[0] == 27) // ESC - { - running = false; - } - else if(count == 1) - { - parseUserInput(choice[0]); - } - } - - delete nm; - delete handler; - delete configData; - - tcsetattr(0, TCSANOW, &storedTermio); - return 0; -} -#endif - -void parseUserInput(char input) -{ - switch(input) - { - case 'T': - printf("\n\n%s", nm->systemTreeToDetailedString().c_str()); - break; - - case 't': - printf("\n\n%s", nm->systemTreeToString().c_str()); - break; - - case 'c': - case 'C': - system(CLEAR_COMMAND); - break; - - case '?': - printHelpMenu(); - - default: - break; - } - -} - -void printHelpMenu() -{ - printf("\n\nOpenJAUS Node Manager Help\n"); - printf(" t - Print System Tree\n"); - printf(" T - Print Detailed System Tree\n"); - printf(" c - Clear console window\n"); - printf(" ? - This Help Menu\n"); - printf(" ESC - Exit Node Manager\n"); -} diff --git a/lib/openjaus/ojVehicleSim/config/gpos.conf b/lib/openjaus/ojVehicleSim/config/gpos.conf deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/openjaus/ojVehicleSim/config/pd.conf b/lib/openjaus/ojVehicleSim/config/pd.conf deleted file mode 100644 index 86985980bd10a0201226b35d14996372c6484c26..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/config/pd.conf +++ /dev/null @@ -1 +0,0 @@ -# TODO: Add various "Platform Specifications stuff" \ No newline at end of file diff --git a/lib/openjaus/ojVehicleSim/config/vehicleSim.conf b/lib/openjaus/ojVehicleSim/config/vehicleSim.conf deleted file mode 100644 index d79acab83f7cece0e0c17bb907cf9ff4447fa2ff..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/config/vehicleSim.conf +++ /dev/null @@ -1,3 +0,0 @@ -INITIAL_LAT_DEGREES = 37.2136 -INITIAL_LON_DEGREES = -80.4376 -INITIAL_HEADING_DEGREES = 0.0 diff --git a/lib/openjaus/ojVehicleSim/config/vss.conf b/lib/openjaus/ojVehicleSim/config/vss.conf deleted file mode 100644 index d12109576a8d21ab44be6e57d4c0cb4c02fab8ba..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/config/vss.conf +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _DESCRIPTORS_H_ -#define _DESCRIPTORS_H_ - -#include "sift.h" -#include "gradient.h" - -void normalize_histogram(float* L_begin, float* L_end); -void computeKeypointDescriptor(float* descr_pt, Keypoint keypoint, float angle0); - - -#endif // _DESCRIPTORS_H diff --git a/lib/openjaus/ojVehicleSim/config/wd.conf b/lib/openjaus/ojVehicleSim/config/wd.conf deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/config/wd.conf +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lib/openjaus/ojVehicleSim/include/getline.h b/lib/openjaus/ojVehicleSim/include/getline.h deleted file mode 100644 index 33c3437f36ab55a9cea994f9e4fc422c7870cca9..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/getline.h +++ /dev/null @@ -1,50 +0,0 @@ -/* getline.c -- Replacement for GNU C library function getline - -Copyright (C) 1993 Free Software Foundation, Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This program 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 -General Public License for more details. */ - -/* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */ - -/* - * Modified for WinCvs/MacCVS : Alexandre Parenteau --- April 1998 - */ - -#ifndef _getline_h_ -#define _getline_h_ 1 - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined (__GNUC__) || (defined (__STDC__) && __STDC__) || defined(__cplusplus) -#define __PROTO(args) args -#else -#define __PROTO(args) () -#endif /* GCC. */ - -#ifndef __ssize_t_defined -#define __ssize_t int -#endif -__ssize_t - getline __PROTO ((char **_lineptr, size_t *_n, FILE *_stream)); -int - getstr __PROTO ((char **_lineptr, size_t *_n, FILE *_stream, - char _terminator, int _offset)); - -#ifdef __cplusplus -} -#endif - -#endif /* _getline_h_ */ - diff --git a/lib/openjaus/ojVehicleSim/include/gpos.h b/lib/openjaus/ojVehicleSim/include/gpos.h deleted file mode 100644 index 4819c9df15def2e4525cba6cd0c1272a06e6c14a..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/gpos.h +++ /dev/null @@ -1,63 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File: gpos.h -// Version: 0.4 alpha -// Written by: Tom Galluzzo (galluzzt@ufl.edu) -// Date: 07/01/2005 -// Description: This file contains the skeleton C header file code for implementing the gpos.c file - -#ifndef GPOS_H -#define GPOS_H - -#include -#include - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - - -OjCmpt gposCreate(void); -void gposDestroy(OjCmpt gpos); - -// USER: Insert prototypes for added public function here -double gposGetLatitude(OjCmpt gpos); -double gposGetLongitude(OjCmpt gpos); -double gposGetYaw(OjCmpt gpos); -int gposGetScActive(OjCmpt gpos); - -#endif // GPOS_H diff --git a/lib/openjaus/ojVehicleSim/include/gui.h b/lib/openjaus/ojVehicleSim/include/gui.h deleted file mode 100644 index 4c3e7fb627f4ef3354aadf63541979807d6edc4f..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/gui.h +++ /dev/null @@ -1,59 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -#ifndef GUI_H -#define GUI_H - -#include -#include - -typedef struct -{ - Display *display; - Window window; - GLXContext context; - XSetWindowAttributes attr; - int screen; - int x; - int y; - unsigned int width; - unsigned int height; - unsigned int depth; -}GlWindow; - -void guiResizeWindow(unsigned int, unsigned int); -void guiUpdateWindow(GlWindow); -void guiDestroyWindow(GlWindow); -GlWindow guiCreateWindow(char* title, int width, int height); - -#endif // GUI_H diff --git a/lib/openjaus/ojVehicleSim/include/pd.h b/lib/openjaus/ojVehicleSim/include/pd.h deleted file mode 100644 index d583d9e8ed899ff52288ae60c8d57b46f21907ca..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/pd.h +++ /dev/null @@ -1,73 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File: pd.h -// Version: 0.4 alpha -// Written by: Tom Galluzzo (galluzzt@ufl.edu) -// Date: 07/01/2005 -// Description: This file contains the skeleton C header file code for implementing the pd.c file - -// How To Use This File: -// All comments labled "USER:" specify lines of code that the end user must change to implement thier individual component -// The end user must also change all functions and variables in this file begining with "pd" -// This substring must be changed to the component identifier acronym of the individual component, and -// this file should also be renamed likewise -// Ex: For a Primitive Driver component change all "pd" to "pd" -// Also Change all "PD" to your component acronym (ALL CAPS) - -#ifndef PD_H -#define PD_H - -#include -#include - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -#define PD_THREAD_DESIRED_RATE_HZ 50.0 // USER: Modify this rate as needed - -// USER: All defines should start with "PD_", where your component acronym replaces "PD" - -OjCmpt pdCreate(void); -void pdDestroy(OjCmpt pd); - -// USER: Insert prototypes for added public function here -JausBoolean pdGetControllerScStatus(OjCmpt pd); -JausState pdGetControllerState(OjCmpt pd); -SetWrenchEffortMessage pdGetWrenchEffort(OjCmpt pd); - -#endif // PD_H diff --git a/lib/openjaus/ojVehicleSim/include/properties.h b/lib/openjaus/ojVehicleSim/include/properties.h deleted file mode 100644 index 16272acefa39a0a6bc9139ac58efef9d371e235c..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/properties.h +++ /dev/null @@ -1,64 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: properties.h -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.2 -// -// Date: 08/04/06 -// -// Description: This file describes the functionality associated with a Properties object. -// Inspired by the class of the same name in the JAVA language. - -#ifndef PROPERTIES_H -#define PROPERTIES_H - -#include - -typedef struct propertyStruct -{ - char *property; - char *value; - struct propertyStruct *nextProperty; -}PropertyStruct; - -typedef PropertyStruct *Properties; - -Properties propertiesCreate(void); -void propertiesDestroy(Properties); -Properties propertiesLoad(Properties, FILE *); -char *propertiesGetProperty(Properties, char *); - -#endif // PROPERTIES_H diff --git a/lib/openjaus/ojVehicleSim/include/utm/cproj.h b/lib/openjaus/ojVehicleSim/include/utm/cproj.h deleted file mode 100644 index 912e242344e9a7e2d3cec1cd1e4baa7583c9030d..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/utm/cproj.h +++ /dev/null @@ -1,76 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -#include -#include "proj.h" - -#ifndef PI -#define PI 3.141592653589793238 -#endif - -#define HALF_PI (PI*0.5) - -#ifndef TWO_PI -#define TWO_PI (PI*2.0) -#endif - -#define EPSLN 1.0e-10 - -#ifndef R2D -#define R2D 57.2957795131 -#endif - -#ifndef D2R -#define D2R 1.745329251994328e-2 -#endif - -#define S2R 4.848136811095359e-6 - -#ifndef OK -#define OK 0 -#endif - -#define UTM_ERROR -1 -#define IN_BREAK -2 - -/* Misc macros - -----------*/ -#define SQUARE(x) x * x /* x**2 */ -#define CUBE(x) x * x * x /* x**3 */ -#define QUAD(x) x * x * x * x /* x**4 */ - -#define GMAX(A, B) ((A) > (B) ? (A) : (B)) /* assign maximum of a and b */ -#define GMIN(A, B) ((A) < (B) ? (A) : (B)) /* assign minimum of a and b */ - -#define IMOD(A, B) (A) - (((A) / (B)) * (B)) /* Integer mod function */ - diff --git a/lib/openjaus/ojVehicleSim/include/utm/greatCircle.h b/lib/openjaus/ojVehicleSim/include/utm/greatCircle.h deleted file mode 100644 index 6e6547f0b982ec979c893d7f24159696cb0779e2..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/utm/greatCircle.h +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: greatCircle.c -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) and Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.2 -// -// Date: 08/04/06 -// -// Description: This file describes the functions that comprise great circle calculations. These provide -// a converstion method from Latitude and Longitude to Meters based on the approximation that the circumference -// of the earth is a great circle. - -#ifndef GREAT_CIRCLE_H -#define GREAT_CIRCLE_H - -#define GREAT_CIRCLE_EARTH_RADIUS_M 6378137.0 - -double greatCircleDistance(double lat1, double lon1, double lat2, double lon2); -double greatCircleCourse(double lat1, double lon1, double lat2, double lon2); -double greatCircleLat(double lat1, double d, double tc); -double greatCircleLon(double lat1, double lon1, double d, double tc); - -#endif // GREAT_CIRCLE_H diff --git a/lib/openjaus/ojVehicleSim/include/utm/pointLla.h b/lib/openjaus/ojVehicleSim/include/utm/pointLla.h deleted file mode 100644 index 687eb2f36018e10ddf66a6b793cbf3999695504b..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/utm/pointLla.h +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: pointLla.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.2 -// -// Date: 08/04/06 -// -// Description: This file defines the functions of a PointLla Object - -#ifndef POINTLLA_H -#define POINTLLA_H - -typedef struct{ - double latitudeRadians; - double longitudeRadians; - double altitudeMeters; -} PointLlaStruct; - -typedef PointLlaStruct *PointLla; - -PointLla pointLlaCreate(void); -void pointLlaDestroy(PointLla); - -#endif diff --git a/lib/openjaus/ojVehicleSim/include/utm/pointUtm.h b/lib/openjaus/ojVehicleSim/include/utm/pointUtm.h deleted file mode 100644 index 062129743b7d59cc47c1898b380efb1175fdeb3d..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/utm/pointUtm.h +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: pointUtm.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.2 -// -// Date: 08/04/06 -// -// Description: This file defines the functions of a PointUtm object - -#ifndef POINTUTM_H -#define POINTUTM_H - -typedef struct{ - double xMeters; - double yMeters; - double zMeters; -} PointUtmStruct; - -typedef PointUtmStruct *PointUtm; - -PointUtm pointUtmCreate(void); -void pointUtmDestroy(PointUtm); - -#endif diff --git a/lib/openjaus/ojVehicleSim/include/utm/proj.h b/lib/openjaus/ojVehicleSim/include/utm/proj.h deleted file mode 100644 index ee92c693c4bb850cd6a1c171ca42a5be7a5cdc46..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/utm/proj.h +++ /dev/null @@ -1,381 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -/* Projection codes - - - 0 = Geographic - 1 = Universal Transverse Mercator (UTM) - 2 = State Plane Coordinates - 3 = Albers Conical Equal Area - 4 = Lambert Conformal Conic - 5 = Mercator - 6 = Polar Stereographic - 7 = Polyconic - 8 = Equidistant Conic - 9 = Transverse Mercator - 10 = Stereographic - 11 = Lambert Azimuthal Equal Area - 12 = Azimuthal Equidistant - 13 = Gnomonic - 14 = Orthographic - 15 = General Vertical Near-Side Perspective - 16 = Sinusiodal - 17 = Equirectangular - 18 = Miller Cylindrical - 19 = Van der Grinten - 20 = (Hotine) Oblique Mercator - 21 = Robinson - 22 = Space Oblique Mercator (SOM) - 23 = Alaska Conformal - 24 = Interrupted Goode Homolosine - 25 = Mollweide - 26 = Interrupted Mollweide - 27 = Hammer - 28 = Wagner IV - 29 = Wagner VII - 30 = Oblated Equal Area - 99 = User defined -*/ - -/* Define projection codes */ -#define GEO 0 -#define UTM 1 -#define SPCS 2 -#define ALBERS 3 -#define LAMCC 4 -#define MERCAT 5 -#define PS 6 -#define POLYC 7 -#define EQUIDC 8 -#define TM 9 -#define STEREO 10 -#define LAMAZ 11 -#define AZMEQD 12 -#define GNOMON 13 -#define ORTHO 14 -#define GVNSP 15 -#define SNSOID 16 -#define EQRECT 17 -#define MILLER 18 -#define VGRINT 19 -#define HOM 20 -#define ROBIN 21 -#define SOM 22 -#define ALASKA 23 -#define GOOD 24 -#define MOLL 25 -#define IMOLL 26 -#define HAMMER 27 -#define WAGIV 28 -#define WAGVII 29 -#define OBEQA 30 -#define USDEF 99 - -/* Define unit code numbers to their names */ - -#define RADIAN 0 /* Radians */ -#define FEET 1 /* Feed */ -#define METER 2 /* Meters */ -#define SECOND 3 /* Seconds */ -#define DEGREE 4 /* Decimal degrees */ -#define INT_FEET 5 /* International Feet */ - -/* The STPLN_TABLE unit value is specifically used for State Plane -- if units - equals STPLN_TABLE and Datum is NAD83--actual units are retrieved from - a table according to the zone. If Datum is NAD27--actual units will be feet. - An error will occur with this unit if the projection is not State Plane. */ - -#define STPLN_TABLE 6 - -/* General code numbers */ - -#define IN_BREAK -2 /* Return status if the interupted projection - point lies in the break area */ -#define COEFCT 15 /* projection coefficient count */ -#define PROJCT 30 /* projection count */ -#define SPHDCT 31 /* spheroid count */ - -#define MAXPROJ 31 /* Maximum projection number */ -#define MAXUNIT 5 /* Maximum unit code number */ -#define GEO_TERM 0 /* Array index for print-to-term flag */ -#define GEO_FILE 1 /* Array index for print-to-file flag */ -#define GEO_TRUE 1 /* True value for geometric true/false flags */ -#define GEO_FALSE -1 /* False val for geometric true/false flags */ - -/* GCTP Function prototypes */ - -long alberforint(double r_maj, double r_min, double lat1, double lat2, - double lon0, double lat0, double false_east, double false_north); -long alberfor(double lon, double lat, double *x, double *y); -long alberinvint( double r_maj, double r_min, double lat1, double lat2, - double lon0, double lat0, double false_east, double false_north); -long alberinv( double x, double y, double *lon, double *lat); -long alconforint( double r_maj, double r_min, double false_east, - double false_north); -long alconfor(double lon, double lat, double *x, double *y); -long alconinvint( double r_maj, double r_min, double false_east, - double false_north); -long alconinv( double x, double y, double *lon, double *lat); -long azimforint( double r_maj, double center_lon, double center_lat, - double false_east, double false_north); -long azimfor( double lon, double lat, double *x, double *y); -long aziminvint( double r_maj, double center_lon, double center_lat, - double false_east, double false_north); -long aziminv( double x, double y, double *lon, double *lat); - -/* Functions residing in cproj.c */ -void sincos( double val, double *sin_val, double *cos_val); -double asinz (double con); -double msfnz (double eccent, double sinphi, double cosphi); -double qsfnz (double eccent, double sinphi, double cosphi); -double phi1z (double eccent, double qs, long *flag); -double phi2z(double eccent, double ts, long *flag); -double phi3z(double ml, double e0, double e1, double e2, double e3, - long *flag); -double phi4z (double eccent, double e0, double e1, double e2, double e3, - double a, double b, double *c, double *phi); -double pakcz(double pak); -double pakr2dm(double pak); -double tsfnz(double eccent, double phi, double sinphi); -int sign(double x); -double adjust_lon(double x); -double e0fn(double x); -double e1fn(double x); -double e2fn(double x); -double e3fn(double x); -double e4fn(double x); -double mlfn(double e0,double e1,double e2,double e3,double phi); -long calc_utm_zone(double lon); -/* End of functions residing in cproj.h */ - -long eqconforint(double r_maj, double r_min, double lat1, double lat2, - double center_lon, double center_lat, double false_east, - double false_north, - long mode); -long eqconfor(double lon, double lat, double *x, double *y); -long eqconinvint(double r_maj, double r_min, double lat1, double lat2, - double center_lon, double center_lat, double false_east, - double false_north, long mode); -long eqconinv(double x, double y, double *lon, double *lat); -long equiforint(double r_maj, double center_lon, double lat1, - double false_east, double false_north); -long equifor(double lon, double lat, double *x, double *y); -long equiinvint(double r_maj, double center_lon, double lat1, - double false_east, double false_north); -long equiinv(double x, double y, double *lon, double *lat); -void for_init(long outsys, long outzone, double *outparm, long outspheroid, - char *fn27, char *fn83, long *iflg, long (*for_trans[])()); -void gctp(double *incoor, long *insys, long *inzone, double *inparm, - long *inunit, long *inspheroid, long *ipr, char *efile, long *jpr, - char *pfile, double *outcoor, long *outsys, long *outzone, - double *outparm, long *outunit, long *outspheroid, char fn27[], - char fn83[], long *iflg); -long gnomforint(double r, double center_long, double center_lat, - double false_east, double false_north); -long gnomfor(double lon, double lat, double *x, double *y); -long gnominvint(double r, double center_long, double center_lat, - double false_east, double false_north); -long gnominv(double x, double y, double *lon, double *lat); -long goodforint(double r); -long goodfor(double lon, double lat, double *x, double *y); -long goodinvint(double r); -long goodinv(double x, double y, double *lon, double *lat); -long gvnspforint(double r, double h, double center_long, double center_lat, - double false_east, double false_north); -long gvnspfor(double lon, double lat, double *x, double *y); -long gvnspinvint(double r, double h, double center_long, double center_lat, - double false_east, double false_north); -long gvnspinv(double x, double y, double *lon, double *lat); -long hamforint(double r, double center_long, double false_east, - double false_north); -long hamfor(double lon, double lat, double *x, double *y); -long haminvint(double r, double center_long, double false_east, - double false_north); -long haminv(double x, double y, double *lon, double *lat); -long imolwforint(double r); -long imolwfor(double lon, double lat, double *x, double *y); -long imolwinvint(double r); -long imolwinv(double x, double y, double *lon, double *lat); -void inv_init(long insys, long inzone, double *inparm, long inspheroid, - char *fn27, char *fn83, long *iflg, long (*inv_trans[])()); -long lamazforint(double r, double center_long, double center_lat, - double false_east, double false_north); -long lamazfor(double lon, double lat, double *x, double *y); -long lamazinvint(double r, double center_long, double center_lat, - double false_east, double false_north); -long lamazinv(double x, double y, double *lon, double *lat); -long lamccforint(double r_maj, double r_min, double lat1, double lat2, - double c_lon, double c_lat, double false_east, double false_north); -long lamccfor(double lon, double lat, double *x, double *y); -long lamccinvint(double r_maj, double r_min, double lat1, double lat2, - double c_lon, double c_lat, double false_east, double false_north); -long lamccinv(double x, double y, double *lon, double *lat); -long merforint(double r_maj, double r_min, double center_lon, double center_lat, - double false_east, double false_north); -long merfor(double lon, double lat, double *x, double *y); -long merinvint(double r_maj, double r_min, double center_lon, double center_lat, - double false_east, double false_north); -long merinv(double x, double y, double *lon, double *lat); -long millforint(double r, double center_long, double false_east, - double false_north); -long millfor(double lon, double lat, double *x, double *y); -long millinvint(double r, double center_long, double false_east, - double false_north); -long millinv(double x, double y, double *lon, double *lat); -long molwforint(double r, double center_long, double false_east, - double false_north); -long molwfor(double lon, double lat, double *x, double *y); -long molwinvint(double r, double center_long, double false_east, - double false_north); -long molwinv(double x, double y, double *lon, double *lat); -long obleqforint(double r, double center_long, double center_lat, - double shape_m, double shape_n, double angle, double false_east, - double false_north); -long obleqfor(double lon, double lat, double *x, double *y); -long obleqinvint(double r, double center_long, double center_lat, - double shape_m, double shape_n, double angle, double false_east, - double false_north); -long omerforint(double r_maj, double r_min, double scale_fact, - double azimuth, double lon_orig, double lat_orig, double false_east, - double false_north, double lon1, double lat1, double lon2, double lat2, - long mode); -long omerfor(double lon, double lat, double *x, double *y); -long omerinvint(double r_maj, double r_min, double scale_fact, double azimuth, - double lon_orig, double lat_orig, double false_east, double false_north, - double lon1, double lat1, double lon2, double lat2, long mode); -long omerinv(double x, double y, double *lon, double *lat); -long orthforint(double r_maj, double center_lon, double center_lat, - double false_east, double false_north); -long orthfor( double lon, double lat, double *x, double *y); -long orthinvint(double r_maj, double center_lon, double center_lat, - double false_east, double false_north); -long orthinv(double x, double y, double *lon, double *lat); -double paksz(double ang, long *iflg); -long polyforint(double r_maj, double r_min, double center_lon, - double center_lat, double false_east, double false_north); -long polyfor(double lon, double lat, double *x, double *y); -long polyinvint(double r_maj, double r_min, double center_lon, - double center_lat, double false_east, double false_north); -long polyinv(double x, double y, double *lon, double *lat); -long psforint(double r_maj, double r_min, double c_lon, double c_lat, - double false_east, double false_north); -long psfor( double lon, double lat, double *x, double *y); -long psinvint(double r_maj, double r_min, double c_lon, double c_lat, - double false_east, double false_north); -long psinv( double x, double y, double *lon, double *lat); - -/* functions in report.c */ -void close_file(); -long init(long ipr, long jpr, char *efile, char *pfile); -void ptitle(char *A); -void radius(double A); -void radius2(double A, double B); -void cenlon( double A); -void cenlonmer(double A); -void cenlat(double A); -void origin(double A); -void stanparl(double A,double B); -void stparl1(double A); -void offsetp(double A, double B); -void genrpt(double A, char *S); -void genrpt_long(long A, char *S); -void pblank(); -void p_error(char *what, char *where); -/* End of the report.c functions */ - -long robforint(double r, double center_long, double false_east, - double false_north); -long robfor( double lon, double lat, double *x, double *y); -long robinvint(double r, double center_long, double false_east, - double false_north); -long robinv(double x, double y, double *lon, double *lat); -long sinforint(double r, double center_long, double false_east, - double false_north); -long sinfor(double lon, double lat, double *x, double *y); -long sininvint(double r, double center_long, double false_east, - double false_north); -long sininv(double x, double y, double *lon, double *lat); -long somforint(double r_major, double r_minor, long satnum, long path, - double alf_in, double lon, double false_east, double false_north, - double time, long start1, long flag); -long somfor(double lon, double lat, double *x, double *y); -/*static double som_series(double *fb, double *fa2, double *fa4, double *fc1, - double *fc3,double *dlam);*/ -long sominvint(double r_major, double r_minor, long satnum, long path, - double alf_in, double lon, double false_east, double false_north, - double time, long start1, long flag); -long sominv(double x, double y, double *lon, double *lat); -void sphdz(long isph, double *parm, double *r_major, double *r_minor, - double *radius); -long sterforint(double r_maj, double center_lon, double center_lat, - double false_east, double false_north); -long sterfor(double lon, double lat, double *x, double *y); -long sterinvint(double r_maj, double center_lon, double center_lat, - double false_east, double false_north); -long sterinv(double x, double y, double *lon, double *lat); -long stplnforint(long zone, long sphere, char *fn27, char *fn83); -long stplnfor(double lon, double lat, double *x, double *y); -long stplninvint(long zone, long sphere, char *fn27, char *fn83); -long stplninv(double x, double y, double *lon, double *lat); -long tmforint(double r_maj, double r_min, double scale_fact, - double center_lon, double center_lat, double false_east, - double false_north); -long tmfor(double lon, double lat, double *x, double *y); -long tminvint(double r_maj, double r_min, double scale_fact, - double center_lon, double center_lat, double false_east, - double false_north); -long tminv(double x, double y, double *lon, double *lat); -long untfz(long inunit, long outunit, double *factor); -long utmforint(double r_maj, double r_min, double scale_fact, long zone); -long utmfor(double lon, double lat, double *x, double *y); -long utminvint(double r_maj, double r_min, double scale_fact, long zone); -long utminv(double x, double y, double *lon, double *lat); -long vandgforint(double r, double center_long, double false_east, - double false_north); -long vandgfor( double lon, double lat, double *x, double *y); -long vandginvint(double r, double center_long, double false_east, - double false_north); -long vandginv(double x, double y, double *lon, double *lat); -long wivforint(double r, double center_long, double false_east, - double false_north); -long wivfor(double lon, double lat, double *x, double *y); -long wivinvint(double r, double center_long, double false_east, - double false_north); -long wivinv(double x, double y, double *lon, double *lat); -long wviiforint(double r, double center_long, double false_east, - double false_north); -long wviifor(double lon, double lat, double *x, double *y); -long wviiinvint( double r, double center_long, double false_east, - double false_north); -long wviiinv(double x, double y, double *lon, double *lat); diff --git a/lib/openjaus/ojVehicleSim/include/utm/utmLib.h b/lib/openjaus/ojVehicleSim/include/utm/utmLib.h deleted file mode 100644 index 7a532bfca244f8862630f3b38e58e4e623553d96..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/utm/utmLib.h +++ /dev/null @@ -1,76 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: utmLib.h -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.2 -// -// Date: 08/04/06 -// -// Description: This file provides an interface to the cproj library for use as a UTM conversion engine - -#ifndef UTM_WRAPPER_H -#define UTM_WRAPPER_H - -#include -#include "cproj.h" -#include "pointUtm.h" -#include "pointLla.h" -#include "greatCircle.h" - -#ifndef RAD_PER_DEG -#define RAD_PER_DEG D2R -#endif - -#ifndef DEG_PER_RAD -#define DEG_PER_RAD R2D -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -unsigned char utmInitCheck(void); -unsigned char utmZoneCheck(PointLla pointLla); -long utmConversionInit(PointLla pointLla); - -PointLla pointUtmToPointLla(PointUtm pointUtm); -PointUtm pointLlaToPointUtm(PointLla pointLla); - -#endif diff --git a/lib/openjaus/ojVehicleSim/include/vehicle.h b/lib/openjaus/ojVehicleSim/include/vehicle.h deleted file mode 100644 index 692e1317cd196ed6d90facbf62d2b84c35243d1f..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/vehicle.h +++ /dev/null @@ -1,63 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File: vehicle.h -// Version: 0.1 -// Written by: Bob Touchton (btouch@ufl.edu) and Tom Galluzzo (galluzzt@ufl.edu) -// Date: 07/22/2005 - -#ifndef VEHICLE_H -#define VEHICLE_H - -#define VEHICLE_MAX_PHI_RATE_EFFORT_PER_SEC 60.0 // Tuned: 8/13/2005, Roberto and Tom -#define VEHICLE_CURVATURE_PER_EFFORT 0.0016f // Changed from 0.00078f per Tom 8/19/05 Tuned: 8/13/2005, Danny and Tom -#define VEHICLE_MAX_PHI_EFFORT 100.0 - -typedef struct VehicleState -{ - float xM; - float yM; - float yawRad; - float speedMps; - float desiredSpeedMps; - float phiEffort; - float desiredPhiEffort; -}* VehicleState; - -VehicleState vehicleStateCreate(void); -void vehicleStateDestroy(VehicleState); - -void vehicleModelTimeStep(VehicleState, float); -void vehicleModelDistStep(VehicleState, float); - -#endif // VEHICLE_H diff --git a/lib/openjaus/ojVehicleSim/include/vehicleSim.h b/lib/openjaus/ojVehicleSim/include/vehicleSim.h deleted file mode 100644 index 29346605bcf119ff65c9b07ce7ea2546c7633ea6..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/vehicleSim.h +++ /dev/null @@ -1,88 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -#ifndef VEHICLE_SIM_H -#define VEHICLE_SIM_H - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -#define VEHICLE_SIM_LOAD_CONFIGURATION_ERROR -1 -#define VEHICLE_SIM_MALLOC_ERROR -2 -#define VEHICLE_SIM_THREAD_CREATE_ERROR -4 - -#define VEHICLE_SIM_THREAD_TIMEOUT_SEC 1.0 - -#define VEHICLE_SIM_UNDEFINED_STATE -1 -#define VEHICLE_SIM_UNKNOWN_STATE -1 -#define VEHICLE_SIM_INVALID_STATE -1 -#define VEHICLE_SIM_MANUAL_STATE 0 -#define VEHICLE_SIM_HOMING_STATE 1 -#define VEHICLE_SIM_READY_STATE 2 -#define VEHICLE_SIM_SHUTDOWN_STATE 3 - -#define VEHICLE_SIM_RUN 0 -#define VEHICLE_SIM_PAUSE 1 - -#define VEHICLE_SIM_AUTO_STATE 1 - -#include "utm/pointLla.h" -#include "utm/pointUtm.h" -#include "utm/utmLib.h" - -int vehicleSimStartup(void); -int vehicleSimShutdown(void); - -double vehicleSimGetUpdateRate(void); -int vehicleSimGetState(void); - -PointLla vehicleSimGetPositionLla(void); -double vehicleSimGetX(void); -double vehicleSimGetY(void); -double vehicleSimGetH(void); -double vehicleSimGetSpeed(void); - -double vehicleSimGetRotateEffort(void); - -int vehicleSimGetRunPause(void); -void vehicleSimToggleRunPause(void); -void vehicleSimSetCommand(double, double, double); -double vehicleSimGetLinearEffortX(void); -double vehicleSimGetResistiveEffortX(void); -double vehicleSimGetRotationalEffort(void); - -#endif // VEHICLE_SIM_H diff --git a/lib/openjaus/ojVehicleSim/include/vss.h b/lib/openjaus/ojVehicleSim/include/vss.h deleted file mode 100644 index bc0dbbc0e00ef06a3ff9970dc510829500674bfb..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/vss.h +++ /dev/null @@ -1,63 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File: vss.h -// Version: 0.4 alpha -// Written by: Tom Galluzzo (galluzzt@ufl.edu) -// Date: 07/01/2005 -// Description: This file contains the skeleton C header file code for implementing the vss.c file - -#ifndef VSS_H -#define VSS_H - -#include - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -#define VSS_THREAD_DESIRED_RATE_HZ 50.0 - -// USER: All defines should start with "VSS_", where your component acronym replaces "VSS" - -OjCmpt vssCreate(void); -void vssDestroy(OjCmpt vss); - -// USER: Insert prototypes for added public function here -double vssGetVelocityX(OjCmpt vss); -int vssGetScActive(OjCmpt vss); - -#endif // VSS_H diff --git a/lib/openjaus/ojVehicleSim/include/wd.h b/lib/openjaus/ojVehicleSim/include/wd.h deleted file mode 100644 index cb7f9fc968f49c334bdafca18e8b18d7e5d55b97..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/include/wd.h +++ /dev/null @@ -1,84 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products depdrived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File: wd.h -// -// Version: 1.0 -// -// Written by: Danny Kent (jaus AT dannykent DOT com) -// -// Date: 08/24/06 -// -// Description: This file contains the skeleton C header file code for implementing the wd.c file - -#ifndef WD_H -#define WD_H - -#include -#include "vehicle.h" - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -#define WD_THREAD_DESIRED_RATE_HZ 50.0 // USER: Modify this rate as needed - -OjCmpt wdCreate(void); -void wdDestroy(OjCmpt wd); -// USER: Insert prototypes for added public function here -ReportWrenchEffortMessage wdGetReportedWrench(OjCmpt wd); -SetWrenchEffortMessage wdGetCommandedWrench(OjCmpt wd); -ReportVelocityStateMessage wdGetVss(OjCmpt wd); -ReportGlobalPoseMessage wdGetGpos(OjCmpt wd); -SetTravelSpeedMessage wdGetTravelSpeed(OjCmpt wd); -SetGlobalWaypointMessage wdGetGlobalWaypoint(OjCmpt wd); - -JausState wdGetPdState(OjCmpt wd); -JausBoolean wdGetPdWrenchScStatus(OjCmpt wd); -JausBoolean wdGetPdStatusScStatus(OjCmpt wd); -JausBoolean wdGetVssScStatus(OjCmpt wd); -JausBoolean wdGetGposScStatus(OjCmpt wd); -JausBoolean wdGetInControlStatus(OjCmpt wd); -VehicleState wdGetDesiredVehicleState(OjCmpt wd); -double wdGetWaypointDistanceM(OjCmpt wd); -int wdGetActiveWaypoint(OjCmpt wd); -int wdGetWaypointCount(OjCmpt wd); -void wdToggleRequestControl(OjCmpt wd); -JausBoolean wdGetRequestControl(OjCmpt wd); -void wdCreateWaypoint(OjCmpt wd); -void wdSetSpeed(OjCmpt wd); - -#endif // WD_H diff --git a/lib/openjaus/ojVehicleSim/src/getLine.c b/lib/openjaus/ojVehicleSim/src/getLine.c deleted file mode 100644 index 8c700da20d1620043b507e8093a3f0a547c47721..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/getLine.c +++ /dev/null @@ -1,148 +0,0 @@ -/* getline.c -- Replacement for GNU C library function getline - -Copyright (C) 1993 Free Software Foundation, Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -This program 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 -General Public License for more details. */ - -/* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */ - -/* - * Modified for WinCvs/MacCVS : Alexandre Parenteau --- April 1998 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include - -#include -#include -#include - -#if STDC_HEADERS || defined(WIN32) || defined(TARGET_OS_MAC) || defined(__linux__) -#include -#else -char *malloc (), *realloc (); -#endif - -#include "getline.h" - -/* Always add at least this many bytes when extending the buffer. */ -#define MIN_CHUNK 64 - -/* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR - + OFFSET (and null-terminate it). *LINEPTR is a pointer returned from - malloc (or NULL), pointing to *N characters of space. It is realloc'd - as necessary. Return the number of characters read (not including the - null terminator), or -1 on error or EOF. On a -1 return, the caller - should check feof(), if not then errno has been set to indicate - the error. */ - -int -getstr (char **lineptr, size_t *n, FILE *stream, char terminator, int offset) -{ - int nchars_avail; /* Allocated but unused chars in *LINEPTR. */ - char *read_pos; /* Where we're reading into *LINEPTR. */ - int ret; - - if (!lineptr || !n || !stream) - { - errno = EINVAL; - return -1; - } - - if (!*lineptr) - { - *n = MIN_CHUNK; - *lineptr = (char *)malloc (*n); - if (!*lineptr) - { - errno = ENOMEM; - return -1; - } - } - - nchars_avail = (int) *n - offset; - read_pos = *lineptr + offset; - - for (;;) - { - int save_errno; - register int c = getc (stream); - - save_errno = errno; - - /* We always want at least one char left in the buffer, since we - always (unless we get an error while reading the first char) - NUL-terminate the line buffer. */ - - assert((*lineptr + *n) == (read_pos + nchars_avail)); - if (nchars_avail < 2) - { - if (*n > MIN_CHUNK) - *n *= 2; - else - *n += MIN_CHUNK; - - nchars_avail = (int)(*n + *lineptr - read_pos); - *lineptr = (char *)realloc (*lineptr, *n); - if (!*lineptr) - { - errno = ENOMEM; - return -1; - } - read_pos = *n - nchars_avail + *lineptr; - assert((*lineptr + *n) == (read_pos + nchars_avail)); - } - - if (ferror (stream)) - { - /* Might like to return partial line, but there is no - place for us to store errno. And we don't want to just - lose errno. */ - errno = save_errno; - return -1; - } - - if (c == EOF) - { - /* Return partial line, if any. */ - if (read_pos == *lineptr) - return -1; - else - break; - } - -#ifdef TARGET_OS_MAC - if (terminator == '\n' && c == '\r') - c = '\n'; -#endif - - *read_pos++ = c; - nchars_avail--; - - if (c == terminator) - /* Return the line. */ - break; - } - - /* Done - NUL terminate and return the number of chars read. */ - *read_pos = '\0'; - - ret = (int)(read_pos - (*lineptr + offset)); - return ret; -} - -__ssize_t -getline (char **lineptr, size_t *n, FILE *stream) -{ - return getstr (lineptr, n, stream, '\n', 0); -} diff --git a/lib/openjaus/ojVehicleSim/src/gpos.c b/lib/openjaus/ojVehicleSim/src/gpos.c deleted file mode 100644 index 0a24c6a43a3aee8cc36af3603a0a9f178b86c191..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/gpos.c +++ /dev/null @@ -1,226 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ - -// File: gpos.c -// Version: 3.3 -// Written by: Tom Galluzzo (galluzzt@ufl.edu) -// Date: 6/3/2008 -// Description: This file contains the skeleton C code for implementing a JAUS component in a Linux environment -// This code is designed to work with the node manager and JAUS library software written by CIMAR - -#include // JAUS message set (USER: JAUS libraries must be installed first) -#include // Node managment functions for sending and receiving JAUS messages (USER: Node Manager must be installed) -#include -#include -#include "gpos.h" // USER: Implement and rename this header file. Include prototypes for all public functions contained in this file. -#include "vehicleSim.h" -#include "utm/pointLla.h" - -#if defined (WIN32) - #define _USE_MATH_DEFINES - #include -#endif - -#define GPOS_THREAD_DESIRED_RATE_HZ 50.0 - -// Private function prototypes -void gposReadyState(OjCmpt gpos); -void gposQueryGlobalPoseCallback(OjCmpt gpos, JausMessage query); - -// Function: gposStartup -// Access: Public -// Description: This function allows the abstracted component functionality contained in this file to be started from an external source. -// It must be called first before the component state machine and node manager interaction will begin -// Each call to "gposStartup" should be followed by one call to the "gposShutdown" function -OjCmpt gposCreate(void) -{ - OjCmpt cmpt; - ReportGlobalPoseMessage message; - JausAddress gposAddr; - - cmpt = ojCmptCreate("gpos", JAUS_GLOBAL_POSE_SENSOR, GPOS_THREAD_DESIRED_RATE_HZ); - - ojCmptAddService(cmpt, JAUS_GLOBAL_POSE_SENSOR); - ojCmptAddServiceInputMessage(cmpt, JAUS_GLOBAL_POSE_SENSOR, JAUS_QUERY_GLOBAL_POSE, 0xFF); - ojCmptAddServiceOutputMessage(cmpt, JAUS_GLOBAL_POSE_SENSOR, JAUS_REPORT_GLOBAL_POSE, 0xFF); - - ojCmptSetStateCallback(cmpt, JAUS_READY_STATE, gposReadyState); - ojCmptSetMessageCallback(cmpt, JAUS_QUERY_GLOBAL_POSE, gposQueryGlobalPoseCallback); - ojCmptAddSupportedSc(cmpt, JAUS_REPORT_GLOBAL_POSE); - - message = reportGlobalPoseMessageCreate(); - gposAddr = ojCmptGetAddress(cmpt); - jausAddressCopy(message->source, gposAddr); - jausAddressDestroy(gposAddr); - - ojCmptSetUserData(cmpt, (void *)message); - - ojCmptSetState(cmpt, JAUS_READY_STATE); - - if(ojCmptRun(cmpt)) - { - ojCmptDestroy(cmpt); - return NULL; - } - - return cmpt; -} - -// Function: gposShutdown -// Access: Public -// Description: This function allows the abstracted component functionality contained in this file to be stoped from an external source. -// If the component is in the running state, this function will terminate all threads running in this file -// This function will also close the Jms connection to the Node Manager and check out the component from the Node Manager -void gposDestroy(OjCmpt gpos) -{ - ReportGlobalPoseMessage message; - - message = (ReportGlobalPoseMessage)ojCmptGetUserData(gpos); - - // Remove support for ReportGlobalPose Service Connections - ojCmptRemoveSupportedSc(gpos, JAUS_REPORT_GLOBAL_POSE); - ojCmptDestroy(gpos); - - reportGlobalPoseMessageDestroy(message); -} - -// The series of functions below allow public access to essential component information -// Access: Public (All) -double gposGetLatitude(OjCmpt gpos) -{ - ReportGlobalPoseMessage message; - - message = (ReportGlobalPoseMessage)ojCmptGetUserData(gpos); - - return message->latitudeDegrees; -} - -double gposGetLongitude(OjCmpt gpos) -{ - ReportGlobalPoseMessage message; - - message = (ReportGlobalPoseMessage)ojCmptGetUserData(gpos); - return message->longitudeDegrees; -} - -double gposGetYaw(OjCmpt gpos) -{ - ReportGlobalPoseMessage message; - - message = (ReportGlobalPoseMessage)ojCmptGetUserData(gpos); - return message->yawRadians; -} - -int gposGetScActive(OjCmpt gpos) -{ - return ojCmptIsOutgoingScActive(gpos, JAUS_REPORT_GLOBAL_POSE); -} - -void gposQueryGlobalPoseCallback(OjCmpt gpos, JausMessage query) -{ - ReportGlobalPoseMessage message; - JausMessage txMessage; - QueryGlobalPoseMessage queryGlobalPose; - - message = (ReportGlobalPoseMessage)ojCmptGetUserData(gpos); - - queryGlobalPose = queryGlobalPoseMessageFromJausMessage(query); - if(queryGlobalPose) - { - jausAddressCopy(message->destination, queryGlobalPose->source); - message->presenceVector = queryGlobalPose->presenceVector; - message->sequenceNumber = 0; - message->properties.scFlag = 0; - - txMessage = reportGlobalPoseMessageToJausMessage(message); - ojCmptSendMessage(gpos, txMessage); - jausMessageDestroy(txMessage); - - queryGlobalPoseMessageDestroy(queryGlobalPose); - } - else - { - ////cError("gpos: Error unpacking %s message.\n", jausMessageCommandCodeString(message)); - } - -} - -void gposReadyState(OjCmpt gpos) -{ - JausMessage txMessage; - ServiceConnection scList; - ServiceConnection sc; - PointLla vehiclePosLla; - ReportGlobalPoseMessage message; - - message = (ReportGlobalPoseMessage)ojCmptGetUserData(gpos); - - vehiclePosLla = vehicleSimGetPositionLla(); - if(vehiclePosLla) - { - message->latitudeDegrees = vehiclePosLla->latitudeRadians * DEG_PER_RAD; - message->longitudeDegrees = vehiclePosLla->longitudeRadians * DEG_PER_RAD; - } - - message->yawRadians = -(vehicleSimGetH() - M_PI/2.0); - - message->elevationMeters = 0; - message->positionRmsMeters = 1.0; - message->rollRadians = 0.0; - message->pitchRadians = 0.0; - message->attitudeRmsRadians = 0.05; - jausTimeSetCurrentTime(message->time); - - // Send message - if(ojCmptIsOutgoingScActive(gpos, JAUS_REPORT_GLOBAL_POSE)) - { - scList = ojCmptGetScSendList(gpos, JAUS_REPORT_GLOBAL_POSE); - sc = scList; - while(sc) - { - jausAddressCopy(message->destination, sc->address); - message->presenceVector = sc->presenceVector; - message->sequenceNumber = sc->sequenceNumber; - message->properties.scFlag = JAUS_SERVICE_CONNECTION_MESSAGE; - - txMessage = reportGlobalPoseMessageToJausMessage(message); - ojCmptSendMessage(gpos, txMessage); - jausMessageDestroy(txMessage); - - sc = sc->nextSc; - } - - ojCmptDestroySendList(scList); - } -} diff --git a/lib/openjaus/ojVehicleSim/src/main.c b/lib/openjaus/ojVehicleSim/src/main.c deleted file mode 100644 index 583ac136f1daffc2234e11aa3ecd3bd655fdc637..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/main.c +++ /dev/null @@ -1,557 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#if defined(WIN32) - #undef MOUSE_MOVED // conflict between PDCURSES and WIN32 - #include - #include - #define CLEAR "cls" -#elif defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - #include - #include - #include - #define CLEAR "clear" -#endif - -#include "pd.h" -#include "gpos.h" -#include "vss.h" -#include "vehicleSim.h" -#include "wd.h" - -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - -#define DEFAULT_STRING_LENGTH 128 -#define KEYBOARD_LOCK_TIMEOUT_SEC 60.0 - -static int mainRunning = FALSE; -static int verbose = FALSE; -static int keyboardLock = FALSE; -static FILE *logFile = NULL; -static char timeString[DEFAULT_STRING_LENGTH] = ""; - -// Operating specific console handles -#if defined(WIN32) - static HANDLE handleStdin; -#elif defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - static struct termios newTermio; - static struct termios storedTermio; -#endif - -OjCmpt gpos; -OjCmpt vss; -OjCmpt pd; -OjCmpt wd; - -// Refresh screen in curses mode -void updateScreen(int keyboardLock, int keyPress) -{ - int row = 0; - int col = 0; - char string[256] = {0}; - PointLla vehiclePosLla; - static int lastChoice = '1'; - JausAddress address; - - if(!keyboardLock && keyPress != -1 && keyPress != 27 && keyPress != 12) //Magic Numbers: 27 = ESC, 12 = Ctrl+l - { - switch(keyPress) - { - case ' ': - wdToggleRequestControl(wd); - break; - - case 'S': - wdSetSpeed(wd); - break; - - case 'W': - wdCreateWaypoint(wd); - break; - - default: - lastChoice = keyPress; - } - } - - clear(); - - mvprintw(row,35,"Keyboard Lock: %s", keyboardLock?"ON, Press ctrl+L to unlock":"OFF, Press ctrl+L to lock"); - - mvprintw(row++,0,"+---------------------------+"); - mvprintw(row++,0,"| Component Menu |"); - mvprintw(row++,0,"| |"); - mvprintw(row++,0,"| 1. Vehicle Sim |"); - mvprintw(row++,0,"| 2. Primitive Driver |"); - mvprintw(row++,0,"| 3. GPOS / VSS |"); - mvprintw(row++,0,"| 4. Waypoint Driver |"); - mvprintw(row++,0,"| |"); - mvprintw(row++,0,"| ESC to Exit |"); - mvprintw(row++,0,"+---------------------------+"); - - row = 2; - col = 40; - switch(lastChoice) - { - case '1': - mvprintw(row++,col,"Vehicle Simulator"); - mvprintw(row++,col,"VS Update Rate: %7.2f", vehicleSimGetUpdateRate()); - mvprintw(row++,col,"VS Run/Pause: %s", vehicleSimGetRunPause() == VEHICLE_SIM_PAUSE ? "Pause" : "Run"); - row++; - mvprintw(row++,col,"VS Vehicle X:\t%9.2f", vehicleSimGetX()); - mvprintw(row++,col,"VS Vehicle Y:\t%9.2f", vehicleSimGetY()); - mvprintw(row++,col,"VS Vehicle H:\t%9.2f", vehicleSimGetH()); - mvprintw(row++,col,"VS Vehicle Speed: %7.2f", vehicleSimGetSpeed()); - - row++; - mvprintw(row++,col,"VS Throttle:\t%9.2f", vehicleSimGetLinearEffortX()); - mvprintw(row++,col,"VS Brake:\t%9.2f", vehicleSimGetResistiveEffortX()); - mvprintw(row++,col,"VS Steering:\t%9.2f", vehicleSimGetRotationalEffort()); - - row++; - vehiclePosLla = vehicleSimGetPositionLla(); - mvprintw(row++,col,"VS Vehicle Latitude: %+10.7f", vehiclePosLla? vehiclePosLla->latitudeRadians*DEG_PER_RAD : 0.0); - mvprintw(row++,col,"VS Vehicle Longitude: %+10.7f", vehiclePosLla? vehiclePosLla->longitudeRadians*DEG_PER_RAD : 0.0); - break; - - case '2': - mvprintw(row++,col,"Primitive Driver"); - mvprintw(row++,col,"PD Update Rate: %5.2f", ojCmptGetRateHz(pd)); - address = ojCmptGetAddress(pd); - jausAddressToString(address, string); - jausAddressDestroy(address); - mvprintw(row++,col,"PD Address:\t%s", string); - mvprintw(row++,col,"PD State:\t%s", jausStateGetString(ojCmptGetState(pd))); - - row++; - if(ojCmptHasController(pd)) - { - address = ojCmptGetControllerAddress(pd); - jausAddressToString(address, string); - jausAddressDestroy(address); - mvprintw(row++,col,"PD Controller: %s", string); - } - else - { - mvprintw(row++,col,"PD Controller: None"); - } - mvprintw(row++,col,"PD Controller SC: %s", pdGetControllerScStatus(pd)?"Active":"Inactive"); - mvprintw(row++,col,"PD Controller State: %s", jausStateGetString(pdGetControllerState(pd))); - - row++; - mvprintw(row++,col,"PD Prop Effort X: %0.0lf", pdGetWrenchEffort(pd)? pdGetWrenchEffort(pd)->propulsiveLinearEffortXPercent:-1.0); - mvprintw(row++,col,"PD Rstv Effort X: %0.0lf", pdGetWrenchEffort(pd)? pdGetWrenchEffort(pd)->resistiveLinearEffortXPercent:-1.0); - mvprintw(row++,col,"PD Rtat Effort Z: %0.0lf", pdGetWrenchEffort(pd)? pdGetWrenchEffort(pd)->propulsiveRotationalEffortZPercent:-1.0); - break; - - case '3': - mvprintw(row++,col,"Global Pose Sensor"); - mvprintw(row++,col,"GPOS Update Rate: %7.2f", ojCmptGetRateHz(gpos)); - address = ojCmptGetAddress(gpos); - jausAddressToString(address, string ); - jausAddressDestroy(address); - mvprintw(row++,col,"GPOS Address:\t %s", string); - mvprintw(row++,col,"GPOS State:\t %s", jausStateGetString(ojCmptGetState(gpos))); - mvprintw(row++,col,"GPOS SC State:\t %s", gposGetScActive(gpos)? "Active" : "Inactive"); - - row++; - mvprintw(row++,col,"Velocity State Sensor"); - mvprintw(row++,col,"VSS Update Rate: %7.2f", ojCmptGetRateHz(vss)); - address = ojCmptGetAddress(vss); - jausAddressToString(address, string ); - jausAddressDestroy(address); - mvprintw(row++,col,"VSS Address:\t %s", string); - mvprintw(row++,col,"VSS State:\t %s", jausStateGetString(ojCmptGetState(vss))); - mvprintw(row++,col,"VSS SC State:\t %s", vssGetScActive(vss)? "Active" : "Inactive"); - break; - - case '4': - mvprintw(row++,col,"Waypoint Driver"); - mvprintw(row++,col,"WD Update Rate: %7.2f", ojCmptGetRateHz(wd)); - - address = ojCmptGetAddress(wd); - jausAddressToString(address, string ); - jausAddressDestroy(address); - mvprintw(row++,col,"WD Address:\t %s", string); - mvprintw(row++,col,"WD State:\t %s", jausStateGetString(ojCmptGetState(wd))); - - address = ojCmptGetControllerAddress(wd); - if(address) - { - jausAddressToString(address, string); - mvprintw(row++,col,"WD Controller:\t %s", string); - jausAddressDestroy(address); - } - else - { - mvprintw(row++,col,"WD Controller:\t None"); - } - - row = 11; - col = 2; - mvprintw(row++,col,"GPOS SC:\t %s", wdGetGposScStatus(wd)? "Active" : "Inactive"); - mvprintw(row++,col,"VSS SC:\t %s", wdGetVssScStatus(wd)? "Active" : "Inactive"); - mvprintw(row++,col,"PD Wrench SC:\t %s", wdGetPdWrenchScStatus(wd)? "Active" : "Inactive"); - mvprintw(row++,col,"PD State SC:\t %s", wdGetPdStatusScStatus(wd)? "Active" : "Inactive"); - row++; - mvprintw(row++,col,"WD Request Control:\t%s", wdGetRequestControl(wd)? "True" : "False"); - mvprintw(row++,col,"(Space to Toggle)"); - mvprintw(row++,col,"WD Control:\t\t%s", wdGetInControlStatus(wd)? "True" : "False"); - mvprintw(row++,col,"PD State:\t\t%s", jausStateGetString(wdGetPdState(wd))); - - row = 11; - col = 40; - if(wdGetGlobalWaypoint(wd)) - { - mvprintw(row++,col,"Global Waypoint: (%9.7lf,%9.7lf)", wdGetGlobalWaypoint(wd)->latitudeDegrees, wdGetGlobalWaypoint(wd)->longitudeDegrees); - } - else - { - mvprintw(row++,col,"Global Waypoint: None"); - } - - if(wdGetTravelSpeed(wd)) - { - mvprintw(row++,col,"Travel Speed: %7.2f", wdGetTravelSpeed(wd)->speedMps); - } - else - { - mvprintw(row++,col,"Travel Speed: None"); - } - - mvprintw(row++,col,"dSpeedMps: %7.2f", wdGetDesiredVehicleState(wd)? wdGetDesiredVehicleState(wd)->desiredSpeedMps : 0.0); - mvprintw(row++,col,"dPhi: %7.2f", wdGetDesiredVehicleState(wd)? wdGetDesiredVehicleState(wd)->desiredPhiEffort : 0.0); - - break; - - default: - mvprintw(row++,col,"NONE."); - break; - } - - move(24,0); - refresh(); -} - -void parseUserInput(char input) -{ - switch(input) - { - case 12: // 12 == 'ctrl + L' - keyboardLock = !keyboardLock; - break; - - case 27: // 27 - if(!keyboardLock) - { - mainRunning = FALSE; - } - break; - - default: - break; - } - return; -} - -void parseCommandLine(int argCount, char **argString) -{ - int i = 0; - int debugLevel = 0; - char debugLogicString[DEFAULT_STRING_LENGTH] = ""; - - for(i=1; i= '0' && argString[i][3] <= '9') - { - debugLevel = atoi(&argString[i][3]); - } - else - { - printf("main: Incorrect use of arguments\n"); - break; - } - } - else if(argString[i][2] == '-') - { - //setDebugLogic(DEBUG_LESS_THAN); - sprintf(debugLogicString, "Less than or equal to: "); - if(argString[i][3] >= '0' && argString[i][3] <= '9') - { - debugLevel = atoi(&argString[i][3]); - } - else - { - printf("main: Incorrect use of arguments\n"); - break; - } - } - else if(argString[i][2] == '=') - { - //setDebugLogic(DEBUG_EQUAL_TO); - if(argString[i][3] >= '0' && argString[i][3] <= '9') - { - debugLevel = atoi(&argString[i][3]); - } - else - { - printf("main: Incorrect use of arguments\n"); - break; - } - } - else if(argString[i][2] >= '0' && argString[i][2] <= '9') - { - debugLevel = atoi(&argString[i][2]); - } - else - { - printf("main: Incorrect use of arguments\n"); - break; - } - printf("main: Switching to debug level: %s%d\n", debugLogicString, debugLevel); - //setDebugLevel(debugLevel); - break; - - case 'l': - if(argCount > i+1 && argString[i+1][0] != '-') - { - logFile = fopen(argString[i+1], "w"); - if(logFile != NULL) - { - fprintf(logFile, "CIMAR %s Log -- %s\n", argString[0], timeString); - //setLogFile(logFile); - } - else printf("main: Error creating log file, switching to default\n"); - } - else - { - printf("main: Incorrect use of arguments\n"); - } - break; - - default: - printf("main: Incorrect use of arguments\n"); - break; - } - } - } -} - -void setupTerminal() -{ - if(verbose) - { -#if defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - tcgetattr(0,&storedTermio); - memcpy(&newTermio,&storedTermio,sizeof(struct termios)); - - // Disable canonical mode, and set buffer size to 0 byte(s) - newTermio.c_lflag &= (~ICANON); - newTermio.c_lflag &= (~ECHO); - newTermio.c_cc[VTIME] = 0; - newTermio.c_cc[VMIN] = 0; - tcsetattr(0,TCSANOW,&newTermio); -#elif defined(WIN32) - // Setup the console window's input handle - handleStdin = GetStdHandle(STD_INPUT_HANDLE); -#endif - } - else - { - // Start up Curses window - initscr(); - cbreak(); - noecho(); - nodelay(stdscr, 1); // Don't wait at the getch() function if the user hasn't hit a key - keypad(stdscr, 1); // Allow Function key input and arrow key input - } -} - -void cleanupConsole() -{ - if(verbose) - { -#if defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - tcsetattr(0,TCSANOW,&storedTermio); -#endif - } - else - { - // Stop Curses - clear(); - endwin(); - } -} - -char getUserInput() -{ - char retVal = FALSE; - int choice; -#if defined(WIN32) - int i = 0; -#endif - - if(verbose) - { - #if defined(WIN32) - INPUT_RECORD inputEvents[128]; - DWORD eventCount; - - // See how many events are waiting for us, this prevents blocking if none - GetNumberOfConsoleInputEvents(handleStdin, &eventCount); - - if(eventCount > 0) - { - // Check for user input here - ReadConsoleInput( - handleStdin, // input buffer handle - inputEvents, // buffer to read into - 128, // size of read buffer - &eventCount); // number of records read - } - - // Parse console input events - for (i = 0; i < (int) eventCount; i++) - { - switch(inputEvents[i].EventType) - { - case KEY_EVENT: // keyboard input - parseUserInput(inputEvents[i].Event.KeyEvent.uChar.AsciiChar); - retVal = TRUE; - break; - - default: - break; - } - } - #elif defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - choice = getc(stdin); - if(choice > -1) - { - parseUserInput(choice); - retVal = TRUE; - } - #endif - } - else - { - choice = getch(); // Get the key that the user has selected - updateScreen(keyboardLock, choice); - if(choice > -1) - { - parseUserInput(choice); - retVal = TRUE; - } - } - - return retVal; -} - - -int main(int argCount, char **argString) -{ - char keyPressed = FALSE; - int keyboardLock = FALSE; - double keyboardLockTime = ojGetTimeSec() + KEYBOARD_LOCK_TIMEOUT_SEC; - time_t timeStamp; - - //Get and Format Time String - time(&timeStamp); - strftime(timeString, DEFAULT_STRING_LENGTH-1, "%m-%d-%Y %X", localtime(&timeStamp)); - - system(CLEAR); - - //cDebug(1, "main: Starting Up %s Node Software\n", simulatorGetName()); -// if(simulatorStartup()) -// { -// printf("main: %s Node Startup failed\n", simulatorGetName()); -// //cDebug(1, "main: Exiting %s Node Software\n", simulatorGetName()); -//#if defined(WIN32) -// system("pause"); -//#else -// printf("Press ENTER to exit\n"); -// getch(); -//#endif -// return 0; -// } - vehicleSimStartup(); - pd = pdCreate(); - gpos = gposCreate(); - vss = vssCreate(); - wd = wdCreate(); - - setupTerminal(); - - mainRunning = TRUE; - - while(mainRunning) - { - keyPressed = getUserInput(); - - if(keyPressed) - { - keyboardLockTime = ojGetTimeSec() + KEYBOARD_LOCK_TIMEOUT_SEC; - } - else if(ojGetTimeSec() > keyboardLockTime) - { - keyboardLock = TRUE; - } - - //if(verbose) - //{ - // choice = getc(stdin); - //} - //else // Not in verbose mode - //{ - // choice = getch(); // Get the key that the user has selected - // updateScreen(keyboardLock, choice); - //} - - ojSleepMsec(100); - } - - cleanupConsole(); - - //cDebug(1, "main: Shutting Down %s Node Software\n", simulatorGetName()); - wdDestroy(wd); - pdDestroy(pd); - gposDestroy(gpos); - vssDestroy(vss); - vehicleSimShutdown(); - - if(logFile != NULL) - { - fclose(logFile); - } - - return 0; -} diff --git a/lib/openjaus/ojVehicleSim/src/pd.c b/lib/openjaus/ojVehicleSim/src/pd.c deleted file mode 100644 index dd14cd23f18efdc30010445b5735a3af51f8dfc1..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/pd.c +++ /dev/null @@ -1,378 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File: pd.c -// Version: 3.3 -// Written by: Tom Galluzzo (galluzzt@ufl.edu) and Danny Kent (kentd@ufl.edu) -// Date: 06/03/2008 - -#include -#include -#include -#include -#include "vehicleSim.h" -#include "pd.h" - -#define CONTROLLER_STATUS_TIMEOUT_SEC 1.5 -#define CONTROLLER_STATUS_UPDATE_RATE_HZ 5.0 -#define CONTROLLER_STATUS_QUEUE_SIZE 1 -#define CONTROLLER_STATUS_PRESENCE_VECTOR 0 - -// USER: Insert any private function prototypes here -void pdSendReportWrenchEffort(OjCmpt pd); -void pdStandbyState(OjCmpt pd); -void pdReadyState(OjCmpt pd); -void pdProcessMessage(OjCmpt pd, JausMessage message); - -typedef struct -{ - SetWrenchEffortMessage setWrenchEffort; - SetDiscreteDevicesMessage setDiscreteDevices; - ReportWrenchEffortMessage reportWrenchEffort; - ReportComponentStatusMessage controllerStatus; - int controllerSc; -}PdData; - -OjCmpt pdCreate(void) -{ - OjCmpt cmpt; - PdData *data; - JausAddress pdAddr; - - cmpt = ojCmptCreate("pd", JAUS_PRIMITIVE_DRIVER, PD_THREAD_DESIRED_RATE_HZ); - - ojCmptAddService(cmpt, JAUS_PRIMITIVE_DRIVER); - ojCmptAddServiceInputMessage(cmpt, JAUS_PRIMITIVE_DRIVER, JAUS_SET_WRENCH_EFFORT, 0xFF); - ojCmptAddServiceInputMessage(cmpt, JAUS_PRIMITIVE_DRIVER, JAUS_SET_DISCRETE_DEVICES, 0xFF); - ojCmptAddServiceInputMessage(cmpt, JAUS_PRIMITIVE_DRIVER, JAUS_QUERY_PLATFORM_SPECIFICATIONS, 0xFF); - ojCmptAddServiceInputMessage(cmpt, JAUS_PRIMITIVE_DRIVER, JAUS_QUERY_WRENCH_EFFORT, 0xFF); - ojCmptAddServiceOutputMessage(cmpt, JAUS_PRIMITIVE_DRIVER, JAUS_REPORT_PLATFORM_SPECIFICATIONS, 0xFF); - ojCmptAddServiceOutputMessage(cmpt, JAUS_PRIMITIVE_DRIVER, JAUS_REPORT_WRENCH_EFFORT, 0xFF); - ojCmptAddSupportedSc(cmpt, JAUS_REPORT_WRENCH_EFFORT); - - ojCmptSetMessageProcessorCallback(cmpt, pdProcessMessage); - ojCmptSetStateCallback(cmpt, JAUS_STANDBY_STATE, pdStandbyState); - ojCmptSetStateCallback(cmpt, JAUS_READY_STATE, pdReadyState); - ojCmptSetState(cmpt, JAUS_STANDBY_STATE); - - pdAddr = ojCmptGetAddress(cmpt); - - data = (PdData*)malloc(sizeof(PdData)); - data->setWrenchEffort = setWrenchEffortMessageCreate(); - data->setDiscreteDevices = setDiscreteDevicesMessageCreate(); - data->reportWrenchEffort = reportWrenchEffortMessageCreate(); - data->controllerStatus = reportComponentStatusMessageCreate(); - data->controllerSc = -1; - jausAddressCopy(data->reportWrenchEffort->source, pdAddr); - - jausAddressDestroy(pdAddr); - - ojCmptSetUserData(cmpt, (void *)data); - - if(ojCmptRun(cmpt)) - { - ojCmptDestroy(cmpt); - return NULL; - } - - return cmpt; -} - -void pdDestroy(OjCmpt pd) -{ - PdData *data; - - data = (PdData*)ojCmptGetUserData(pd); - - if(ojCmptIsIncomingScActive(pd, data->controllerSc)) - { - ojCmptTerminateSc(pd, data->controllerSc); - } - ojCmptRemoveSupportedSc(pd, JAUS_REPORT_WRENCH_EFFORT); - ojCmptDestroy(pd); - - - setWrenchEffortMessageDestroy(data->setWrenchEffort); - setDiscreteDevicesMessageDestroy(data->setDiscreteDevices); - reportWrenchEffortMessageDestroy(data->reportWrenchEffort); - reportComponentStatusMessageDestroy(data->controllerStatus); - free(data); -} - -// The series of functions below allow public access to essential component information -// Access: Public (All) -JausBoolean pdGetControllerScStatus(OjCmpt pd) -{ - PdData *data; - - data = (PdData*)ojCmptGetUserData(pd); - - return ojCmptIsIncomingScActive(pd, data->controllerSc); -} - -JausState pdGetControllerState(OjCmpt pd) -{ - PdData *data; - - data = (PdData*)ojCmptGetUserData(pd); - - return data->controllerStatus->primaryStatusCode; -} - -SetWrenchEffortMessage pdGetWrenchEffort(OjCmpt pd) -{ - PdData *data; - - data = (PdData*)ojCmptGetUserData(pd); - - return data->setWrenchEffort; -} - -// Function: pdProcessMessage -// Access: Private -// Description: This function is responsible for handling incoming JAUS messages from the Node Manager. -// Incoming messages are processed according to message type. -void pdProcessMessage(OjCmpt pd, JausMessage message) -{ - ReportComponentStatusMessage reportComponentStatus; - ReportPlatformSpecificationsMessage reportPlatformSpecifications; - SetWrenchEffortMessage setWrenchEffort; - SetDiscreteDevicesMessage setDiscreteDevices; - QueryPlatformSpecificationsMessage queryPlatformSpecifications; - JausAddress address; - JausMessage txMessage; - PdData *data; - - data = (PdData*)ojCmptGetUserData(pd); - - // This block of code is intended to reject commands from non-controlling components - if(ojCmptHasController(pd) && jausMessageIsRejectableCommand(message) ) - { - address = ojCmptGetControllerAddress(pd); - if(!jausAddressEqual(message->source, address)) - { - //jausAddressToString(message->source, buf); - //cError("pd: Received command message %s from non-controlling component (%s).\n", jausMessageCommandCodeString(message), buf); - jausAddressDestroy(address); - return; - } - jausAddressDestroy(address); - } - - switch(message->commandCode) // Switch the processing algorithm according to the JAUS message type - { - case JAUS_REPORT_COMPONENT_STATUS: - reportComponentStatus = reportComponentStatusMessageFromJausMessage(message); - if(reportComponentStatus) - { - address = ojCmptGetControllerAddress(pd); - if(jausAddressEqual(reportComponentStatus->source, address)) - { - reportComponentStatusMessageDestroy(data->controllerStatus); - data->controllerStatus = reportComponentStatus; - } - else - { - reportComponentStatusMessageDestroy(reportComponentStatus); - } - jausAddressDestroy(address); - } - break; - - case JAUS_SET_WRENCH_EFFORT: - setWrenchEffort = setWrenchEffortMessageFromJausMessage(message); - if(setWrenchEffort) - { - setWrenchEffortMessageDestroy(data->setWrenchEffort); - data->setWrenchEffort = setWrenchEffort; - } - break; - - case JAUS_SET_DISCRETE_DEVICES: - setDiscreteDevices = setDiscreteDevicesMessageFromJausMessage(message); - if(setDiscreteDevices) - { - setDiscreteDevicesMessageDestroy(data->setDiscreteDevices); - data->setDiscreteDevices = setDiscreteDevices; - } - break; - - case JAUS_QUERY_PLATFORM_SPECIFICATIONS: - queryPlatformSpecifications = queryPlatformSpecificationsMessageFromJausMessage(message); - if(queryPlatformSpecifications) - { - reportPlatformSpecifications = reportPlatformSpecificationsMessageCreate(); - - jausAddressCopy(reportPlatformSpecifications->destination, queryPlatformSpecifications->source); - jausAddressCopy(reportPlatformSpecifications->source, queryPlatformSpecifications->destination); - - reportPlatformSpecifications->maximumVelocityXMps = 10.0; - - txMessage = reportPlatformSpecificationsMessageToJausMessage(reportPlatformSpecifications); - ojCmptSendMessage(pd, txMessage); - jausMessageDestroy(txMessage); - - reportPlatformSpecificationsMessageDestroy(reportPlatformSpecifications); - queryPlatformSpecificationsMessageDestroy(queryPlatformSpecifications); - } - break; - - default: - ojCmptDefaultMessageProcessor(pd, message); - break; - } -} - - -void pdStandbyState(OjCmpt pd) -{ - PdData *data; - - data = (PdData*)ojCmptGetUserData(pd); - - pdSendReportWrenchEffort(pd); - - if( vehicleSimGetState() == VEHICLE_SIM_READY_STATE ) - { - ojCmptSetState(pd, JAUS_READY_STATE); - } - else - { - if(data->controllerSc > -1) - { - ojCmptTerminateSc(pd, data->controllerSc); - data->controllerSc = -1; - } - data->controllerStatus->primaryStatusCode = JAUS_UNKNOWN_STATE; - } -} - -void pdReadyState(OjCmpt pd) -{ - PdData *data; - JausAddress address; - - data = (PdData*)ojCmptGetUserData(pd); - - pdSendReportWrenchEffort(pd); - - if( vehicleSimGetState() != VEHICLE_SIM_READY_STATE ) - { - ojCmptSetState(pd, JAUS_STANDBY_STATE); - return; - } - - if(ojCmptHasController(pd)) - { - if(data->controllerSc == -1) - { - address = ojCmptGetControllerAddress(pd); - data->controllerSc = ojCmptEstablishSc( pd, - JAUS_REPORT_COMPONENT_STATUS, - CONTROLLER_STATUS_PRESENCE_VECTOR, - address, - CONTROLLER_STATUS_UPDATE_RATE_HZ, - CONTROLLER_STATUS_TIMEOUT_SEC, - CONTROLLER_STATUS_QUEUE_SIZE); - jausAddressDestroy(address); - } - - if(ojCmptIsIncomingScActive(pd, data->controllerSc)) - { - if(data->controllerStatus->primaryStatusCode == JAUS_READY_STATE || data->controllerStatus->primaryStatusCode == JAUS_STANDBY_STATE) - { - if(vehicleSimGetRunPause() == VEHICLE_SIM_RUN) - { - vehicleSimSetCommand( data->setWrenchEffort->propulsiveLinearEffortXPercent, - data->setWrenchEffort->resistiveLinearEffortXPercent, - data->setWrenchEffort->propulsiveRotationalEffortZPercent - ); - } - else - { - vehicleSimSetCommand(0, 80, data->setWrenchEffort->propulsiveRotationalEffortZPercent); - } - } - else - { - vehicleSimSetCommand(0, 80, 0); - } - } - else - { - vehicleSimSetCommand(0, 80, 0); - } - } - else - { - if(data->controllerSc > -1) - { - ojCmptTerminateSc(pd, data->controllerSc); - data->controllerSc = -1; - } - - data->controllerStatus->primaryStatusCode = JAUS_UNKNOWN_STATE; - - vehicleSimSetCommand(0, 80, 0); - } - -} - -void pdSendReportWrenchEffort(OjCmpt pd) -{ - PdData *data; - JausMessage txMessage; - ServiceConnection scList; - ServiceConnection sc; - - data = (PdData*)ojCmptGetUserData(pd); - - scList = ojCmptGetScSendList(pd, JAUS_REPORT_WRENCH_EFFORT); - sc = scList; - while(sc) - { - jausAddressCopy(data->reportWrenchEffort->destination, sc->address); - data->reportWrenchEffort->presenceVector = sc->presenceVector; - data->reportWrenchEffort->sequenceNumber = sc->sequenceNumber; - data->reportWrenchEffort->properties.scFlag = JAUS_SERVICE_CONNECTION_MESSAGE; - - txMessage = reportWrenchEffortMessageToJausMessage(data->reportWrenchEffort); - ojCmptSendMessage(pd, txMessage); - jausMessageDestroy(txMessage); - - sc = sc->nextSc; - } - - ojCmptDestroySendList(scList); -} - diff --git a/lib/openjaus/ojVehicleSim/src/properties.c b/lib/openjaus/ojVehicleSim/src/properties.c deleted file mode 100644 index 7f6300c5cbf3da7fbf1e74f1cdb78dfa2634bcf9..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/properties.c +++ /dev/null @@ -1,145 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: properties.c -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) -// -// Version: 3.2 -// -// Date: 08/04/06 -// -// Description: This file describes the functionality associated with a Properties object. -// Inspired by the class of the same name in the JAVA language. - -#if defined(__GNUC__) - #define _GNU_SOURCE -#endif - -#if defined(__APPLE__) || defined(WIN32) - #include "getline.h" -#endif - -#include -#include -#include -#include "properties.h" - -Properties propertiesCreate(void) -{ - return NULL; -} - -void propertiesDestroy(Properties properties) -{ - Properties deadProperty; - - while(properties) - { - free(properties->property); - free(properties->value); - deadProperty = properties; - properties = properties->nextProperty; - free(deadProperty); - } -} - -Properties propertiesLoad(Properties properties, FILE *file) -{ - const char delimeters[] = "\t\n\r="; - char *buf = NULL; - char *tempProperty, *tempValue; - size_t bufSizeChars = 0; - Properties property = properties; - Properties firstProperty = properties; - - while( getline(&buf, &bufSizeChars, file ) > -1) - { - tempProperty = strtok(buf, delimeters); - tempValue = strtok(NULL, delimeters); - if(tempProperty && tempProperty[0] != '#') - { - if(property) - { - property->nextProperty = (Properties)malloc( sizeof(PropertyStruct) ); - property = property->nextProperty; - - property->property = (char *)malloc( strlen(tempProperty) + 1 ); - sprintf(property->property, "%s", tempProperty); - - property->value = (char *)malloc( strlen(tempValue) + 1 ); - sprintf(property->value, "%s", tempValue); - - property->nextProperty = NULL; - } - else - { - property = (Properties)malloc( sizeof(PropertyStruct) ); - - property->property = (char *)malloc( strlen(tempProperty) + 1 ); - sprintf(property->property, "%s", tempProperty); - - property->value = (char *)malloc( strlen(tempValue) + 1 ); - sprintf(property->value, "%s", tempValue); - - property->nextProperty = NULL; - firstProperty = property; - } - // printf("%s = %s\n", tempProperty, tempValue); - } - } - - if(buf) - { - free(buf); - } - - return firstProperty; -} - -char *propertiesGetProperty(Properties properties, char * testProperty) -{ - while(properties) - { - if(strcmp(properties->property, testProperty)) - { - properties = properties->nextProperty; - } - else - { - return properties->value; - } - } - - return NULL; -} diff --git a/lib/openjaus/ojVehicleSim/src/utm/cproj.c b/lib/openjaus/ojVehicleSim/src/utm/cproj.c deleted file mode 100644 index 2bacdf73b382426bca5b80b62a0d91b54ba8ccd2..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/utm/cproj.c +++ /dev/null @@ -1,479 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -/******************************************************************************* -NAME Projection support routines listed below. - -PURPOSE: The following functions are included in CPROJ.C. - - SINCOS: Calculates the sine and cosine. - ASINZ: Eliminates roundoff errors. - MSFNZ: Computes the constant small m for Oblique Equal Area. - QSFNZ: Computes the constant small q for Oblique Equal Area. - PHI1Z: Computes phi1 for Albers Conical Equal-Area. - PHI2Z: Computes the latitude angle, phi2, for Lambert - Conformal Conic and Polar Stereographic. - PHI3Z: Computes the latitude, phi3, for Equidistant Conic. - PHI4Z: Computes the latitude, phi4, for Polyconic. - PAKCZ: Converts a 2 digit alternate packed DMS format to - standard packed DMS format. - PAKR2DM: Converts radians to 3 digit packed DMS format. - TSFNZ: Computes the small t for Lambert Conformal Conic and - Polar Stereographic. - SIGN: Returns the sign of an argument. - ADJUST_LON: Adjusts a longitude angle to range -180 to 180. - E0FN, E1FN, E2FN, E3FN: - Computes the constants e0,e1,e2,and e3 for - calculating the distance along a meridian. - E4FN: Computes e4 used for Polar Stereographic. - MLFN: Computes M, the distance along a meridian. - CALC_UTM_ZONE: Calculates the UTM zone number. - -PROGRAMMER DATE REASON ----------- ---- ------ -D. Steinwand, EROS July, 1991 Initial development -T. Mittan, EROS May, 1993 Modified from Fortran GCTP for C GCTP -S. Nelson, EROS June, 1993 Added inline comments -S. Nelson, EROS Nov, 1993 Added loop counter in ADJUST_LON -S. Nelson, EROS Jan, 1998 Changed misspelled error message - -*******************************************************************************/ -#include "utm/utmLib.h" - -#define MAX_VAL 4 -#define MAXLONG 2147483647. -#define DBLLONG 4.61168601e18 - -/* Function to calculate the sine and cosine in one call. Some computer - systems have implemented this function, resulting in a faster implementation - than calling each function separately. It is provided here for those - computer systems which don`t implement this function - ----------------------------------------------------*/ -void sincos(val, sin_val, cos_val) -double val; -double *sin_val; -double *cos_val; -{ -*sin_val = sin(val); -*cos_val = cos(val); -return; -} - -/* Function to eliminate roundoff errors in asin -----------------------------------------------*/ -double asinz (con) - -double con; -{ - if (fabs(con) > 1.0) - { - if (con > 1.0) - con = 1.0; - else - con = -1.0; - } - return(asin(con)); -} - -/* Function to compute the constant small m which is the radius of - a parallel of latitude, phi, divided by the semimajor axis. ----------------------------------------------------------------*/ -double msfnz (eccent,sinphi,cosphi) - double eccent; - double sinphi; - double cosphi; -{ -double con; - - con = eccent * sinphi; - return((cosphi / (sqrt (1.0 - con * con)))); -} - -/* Function to compute constant small q which is the radius of a - parallel of latitude, phi, divided by the semimajor axis. -------------------------------------------------------------*/ -double qsfnz (eccent,sinphi,cosphi) - double eccent; - double sinphi; - double cosphi; -{ -double con; - - if (eccent > 1.0e-7) - { - con = eccent * sinphi; - return (( 1.0- eccent * eccent) * (sinphi /(1.0 - con * con) - (.5/eccent)* - log((1.0 - con)/(1.0 + con)))); - } - else - return(2.0 * sinphi); -} - -/* Function to compute phi1, the latitude for the inverse of the - Albers Conical Equal-Area projection. --------------------------------------------*/ -double phi1z (eccent,qs,flag) - double eccent; /* Eccentricity angle in radians */ - double qs; /* Angle in radians */ - long *flag; /* Error flag number */ -{ -double eccnts; -double dphi; -double con; -double com; -double sinpi; -double cospi; -double phi; -long i; - - phi = asinz(.5 * qs); - if (eccent < EPSLN) - return(phi); - eccnts = eccent * eccent; - for (i = 1; i <= 25; i++) - { - sincos(phi,&sinpi,&cospi); - con = eccent * sinpi; - com = 1.0 - con * con; - dphi = .5 * com * com / cospi * (qs / (1.0 - eccnts) - sinpi / com + - .5 / eccent * log ((1.0 - con) / (1.0 + con))); - phi = phi + dphi; - if (fabs(dphi) <= 1e-7) - return(phi); - } - p_error ("Convergence error","phi1z-conv"); - *flag = 001; - return(UTM_ERROR); -} - -/* Function to compute the latitude angle, phi2, for the inverse of the - Lambert Conformal Conic and Polar Stereographic projections. -----------------------------------------------------------------*/ -double phi2z(eccent,ts,flag) - -double eccent; /* Spheroid eccentricity */ -double ts; /* Constant value t */ -long *flag; /* Error flag number */ - -{ -double eccnth; -double phi; -double con; -double dphi; -double sinpi; -long i; - - *flag = 0; - eccnth = .5 * eccent; - phi = HALF_PI - 2 * atan(ts); - for (i = 0; i <= 15; i++) - { - sinpi = sin(phi); - con = eccent * sinpi; - dphi = HALF_PI - 2 * atan(ts *(pow(((1.0 - con)/(1.0 + con)),eccnth))) - - phi; - phi += dphi; - if (fabs(dphi) <= .0000000001) - return(phi); - } - p_error ("Convergence error","phi2z-conv"); - *flag = 002; - return(002); -} - -/* Function to compute latitude, phi3, for the inverse of the Equidistant - Conic projection. ------------------------------------------------------------------*/ -double phi3z(ml,e0,e1,e2,e3,flag) - -double ml; /* Constant */ -double e0; /* Constant */ -double e1; /* Constant */ -double e2; /* Constant */ -double e3; /* Constant */ -long *flag; /* Error flag number */ - -{ -double phi; -double dphi; -long i; - -phi = ml; -for (i = 0; i < 15; i++) - { - dphi = (ml + e1 * sin(2.0 * phi) - e2 * sin(4.0 * phi) + e3 * sin(6.0 * phi)) - / e0 - phi; - phi += dphi; - if (fabs(dphi) <= .0000000001) - { - *flag = 0; - return(phi); - } - } -p_error("Latitude failed to converge after 15 iterations","PHI3Z-CONV"); -*flag = 3; -return(3); -} - -/* Function to compute, phi4, the latitude for the inverse of the - Polyconic projection. -------------------------------------------------------------*/ -double phi4z (eccent,e0,e1,e2,e3,a,b,c,phi) - -double eccent; /* Spheroid eccentricity squared */ -double e0; -double e1; -double e2; -double e3; -double a; -double b; -double *c; -double *phi; -{ -double sinphi; -double sin2ph; -double tanphi; -double ml; -double mlp; -double con1; -double con2; -double con3; -double dphi; -long i; - - *phi = a; - for (i = 1; i <= 15; i++) - { - sinphi = sin(*phi); - tanphi = tan(*phi); - *c = tanphi * sqrt (1.0 - eccent * sinphi * sinphi); - sin2ph = sin (2.0 * *phi); -/* - ml = e0 * *phi - e1 * sin2ph + e2 * sin (4.0 * *phi); - mlp = e0 - 2.0 * e1 * cos (2.0 * *phi) + 4.0 * e2 * - cos (4.0 * *phi); -*/ - ml = e0 * *phi - e1 * sin2ph + e2 * sin (4.0 * *phi) - e3 * - sin (6.0 * *phi); - mlp = e0 - 2.0 * e1 * cos (2.0 * *phi) + 4.0 * e2 * - cos (4.0 * *phi) - 6.0 * e3 * cos (6.0 * *phi); - con1 = 2.0 * ml + *c * (ml * ml + b) - 2.0 * a * (*c * ml + 1.0); - con2 = eccent * sin2ph * (ml * ml + b - 2.0 * a * ml) / (2.0 * *c); - con3 = 2.0 * (a - ml) * (*c * mlp - 2.0 / sin2ph) - 2.0 * mlp; - dphi = con1 / (con2 + con3); - *phi += dphi; - if (fabs(dphi) <= .0000000001 ) - return(OK); - } -p_error("Latitude failed to converge","phi4z-conv"); -return(004); -} - -/* Function to convert 2 digit alternate packed DMS format (+/-)DDDMMSS.SSS - to 3 digit standard packed DMS format (+/-)DDDMMMSSS.SSS. ------------------------------------------------------------------*/ -double pakcz(pak) - - double pak; /* Angle in alternate packed DMS format */ - { - double con; - double secs; - long degs,mins; - char sgna; - - sgna = ' '; - if (pak < 0.0) - sgna = '-'; - con = fabs (pak); - degs = (long) ((con / 10000.0) + .001); - con = con - degs * 10000; - mins = (long) ((con / 100.0) + .001); - secs = con - mins * 100; - con = (double) (degs) * 1000000.0 + (double) (mins) * 1000.0 + secs; - if (sgna == '-') - con = - con; - return(con); - } - -/* Function to convert radians to 3 digit packed DMS format (+/-)DDDMMMSSS.SSS -----------------------------------------------------------------------------*/ -double pakr2dm(pak) - - double pak; /* Angle in radians */ - { - double con; - double secs; - long degs,mins; - char sgna; - - sgna = ' '; - pak *= R2D; - if (pak < 0.0) - sgna = '-'; - con = fabs (pak); - degs = (long) (con); - con = (con - degs) * 60; - mins = (long) con; - secs = (con - mins) * 60; - con = (double) (degs) * 1000000.0 + (double) (mins) * 1000.0 + secs; - if (sgna == '-') - con = - con; - return(con); - } - -/* Function to compute the constant small t for use in the forward - computations in the Lambert Conformal Conic and the Polar - Stereographic projections. ---------------------------------------------------------------*/ -double tsfnz(eccent,phi,sinphi) - double eccent; /* Eccentricity of the spheroid */ - double phi; /* Latitude phi */ - double sinphi; /* Sine of the latitude */ - { - double con; - double com; - - con = eccent * sinphi; - com = .5 * eccent; - con = pow(((1.0 - con) / (1.0 + con)),com); - return (tan(.5 * (HALF_PI - phi))/con); - } - - -/* Function to return the sign of an argument - ------------------------------------------*/ -int sign(x) -double x; -{ -if (x < 0.0) - return(-1); -else - return(1); -} - -/* Function to adjust a longitude angle to range from -180 to 180 radians - added if statments - -----------------------------------------------------------------------*/ -double adjust_lon(x) - -double x; /* Angle in radians */ -{ -//long temp; -long count = 0; -for(;;) - { - if (fabs(x)<=PI) - break; - else - if (((long) fabs(x / PI)) < 2) - x = x-(sign(x) *TWO_PI); - else - if (((long) fabs(x / TWO_PI)) < MAXLONG) - { - x = x-(((long)(x / TWO_PI))*TWO_PI); - } - else - if (((long) fabs(x / (MAXLONG * TWO_PI))) < MAXLONG) - { - x = x-(((long)(x / (MAXLONG * TWO_PI))) * (TWO_PI * MAXLONG)); - } - else - if (((long) fabs(x / (DBLLONG * TWO_PI))) < MAXLONG) - { - x = x-(((long)(x / (DBLLONG * TWO_PI))) * (TWO_PI * DBLLONG)); - } - else - x = x-(sign(x) *TWO_PI); - count++; - if (count > MAX_VAL) - break; - } - -return(x); -} - -/* Functions to compute the constants e0, e1, e2, and e3 which are used - in a series for calculating the distance along a meridian. The - input x represents the eccentricity squared. -----------------------------------------------------------------*/ -double e0fn(x) -double x; -{ -return(1.0-0.25*x*(1.0+x/16.0*(3.0+1.25*x))); -} -double e1fn(x) -double x; -{ -return(0.375*x*(1.0+0.25*x*(1.0+0.46875*x))); -} -double e2fn(x) -double x; -{ -return(0.05859375*x*x*(1.0+0.75*x)); -} -double e3fn(x) -double x; -{ -return(x*x*x*(35.0/3072.0)); -} - -/* Function to compute the constant e4 from the input of the eccentricity - of the spheroid, x. This constant is used in the Polar Stereographic - projection. ---------------------------------------------------------------------*/ -double e4fn(x) -double x; -{ - double con; - double com; - con = 1.0 + x; - com = 1.0 - x; - return (sqrt((pow(con,con))*(pow(com,com)))); - } - -/* Function computes the value of M which is the distance along a meridian - from the Equator to latitude phi. -------------------------------------------------*/ -double mlfn(e0,e1,e2,e3,phi) -double e0,e1,e2,e3,phi; -{ -return(e0*phi-e1*sin(2.0*phi)+e2*sin(4.0*phi)-e3*sin(6.0*phi)); -} - -/* Function to calculate UTM zone number--NOTE Longitude entered in DEGREES!!! - ---------------------------------------------------------------------------*/ -long calc_utm_zone(lon) -double lon; -{ - return((long)(((lon + 180.0) / 6.0) + 1.0)); -} diff --git a/lib/openjaus/ojVehicleSim/src/utm/greatCircle.c b/lib/openjaus/ojVehicleSim/src/utm/greatCircle.c deleted file mode 100644 index 1e14d08b4a75a53f171d5ca258c7f69b2f62a7a0..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/utm/greatCircle.c +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: greatCircle.h -// -// Written By: Tom Galluzzo (galluzzo AT gmail DOT com) and Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.2 -// -// Date: 08/04/06 -// -// Description: This file describes the functions that comprise great circle calculations. These provide -// a converstion method from Latitude and Longitude to Meters based on the approximation that the circumference -// of the earth is a great circle. - -#if defined(WIN32) - #define _USE_MATH_DEFINES -#endif - -#include -#include "utm/utmLib.h" - -double greatCircleDistance(double lat1, double lon1, double lat2, double lon2) -{ - static double d; - - lon1 = -lon1; - lon2 = -lon2; - d = 2*asin( sqrt( pow( sin((lat1-lat2)/2), 2.0 ) + cos(lat1)*cos(lat2)*pow(sin((lon1-lon2)/2),2.0))); - return GREAT_CIRCLE_EARTH_RADIUS_M*d; -} - -double greatCircleCourse(double lat1, double lon1, double lat2, double lon2) -{ - lon1 = -lon1; - lon2 = -lon2; - return fmod(atan2(sin(lon1-lon2)*cos(lat2),cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2)*cos(lon1-lon2)), 2*M_PI); -} - -double greatCircleLat(double lat1, double d, double tc) -{ - d /= GREAT_CIRCLE_EARTH_RADIUS_M; - return asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc)); -} - -double greatCircleLon(double lat1, double lon1, double d, double tc) -{ - lon1 = -lon1; - d /= GREAT_CIRCLE_EARTH_RADIUS_M; - return -(fmod(lon1-asin(sin(tc)*sin(d)/cos(lat1))+M_PI,2*M_PI)-M_PI); -} diff --git a/lib/openjaus/ojVehicleSim/src/utm/pointLla.c b/lib/openjaus/ojVehicleSim/src/utm/pointLla.c deleted file mode 100644 index df1f5bfd543439e4cb7903f4bce24b2cd033820b..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/utm/pointLla.c +++ /dev/null @@ -1,69 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: pointLla.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.2 -// -// Date: 08/04/06 -// -// Description: This file defines the functions of a PointLla Object - -#include -#include -#include "utm/utmLib.h" - -PointLla pointLlaCreate(void) -{ - PointLla pointLla; - - pointLla = (PointLla)malloc(sizeof(PointLlaStruct)); - - if(pointLla) - { - pointLla->latitudeRadians = 10.0; - pointLla->longitudeRadians = 10.0; - pointLla->altitudeMeters = 0.0; - - return pointLla; - } - else - return NULL; -} - -void pointLlaDestroy(PointLla pointLla) -{ - free(pointLla); -} diff --git a/lib/openjaus/ojVehicleSim/src/utm/pointUtm.c b/lib/openjaus/ojVehicleSim/src/utm/pointUtm.c deleted file mode 100644 index 35bdeb156bfce228b0f7197110146d7ab23d04ea..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/utm/pointUtm.c +++ /dev/null @@ -1,70 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File Name: pointUtm.c -// -// Written By: Danny Kent (jaus AT dannykent DOT com) -// -// Version: 3.2 -// -// Date: 08/04/06 -// -// Description: This file defines the functions of a PointUtm object - -#include -#include -#include "utm/utmLib.h" - -PointUtm pointUtmCreate(void) -{ - PointUtm pointUtm; - - pointUtm = (PointUtm)malloc(sizeof(PointUtmStruct)); - if(pointUtm) - { - pointUtm->xMeters = 0.0; - pointUtm->yMeters = 0.0; - pointUtm->zMeters = 0.0; - - return pointUtm; - } - else - return NULL; -} - - -void pointUtmDestroy(PointUtm pointUtm) -{ - free(pointUtm); -} - diff --git a/lib/openjaus/ojVehicleSim/src/utm/utmLib.c b/lib/openjaus/ojVehicleSim/src/utm/utmLib.c deleted file mode 100644 index 5f86616b6cf8caa2d2499f658ab5d43f60544a0a..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/utm/utmLib.c +++ /dev/null @@ -1,197 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -/* **************************************************************** */ -/* utmLib.c */ -/* */ -/* A library of functions to convert from Latitude and Longitude */ -/* to X and Y within a UTM Zone using the WGS84 Spheroid. */ -/* */ -/* This Library is based on the GPTC Projection Algorithms */ -/* avalible from USGS at: */ -/* ftp://edcftp.cr.usgs.gov/pub/software/gctpc/gctpc20.tar.Z */ -/* */ -/* Adapted by: Daniel A. Kent (jaus AT dannykent DOT com) */ -/* 2004 */ -/* */ -/* Functions: utmConversionInit() - Initialize Converstions */ -/* pointLlaToPointUtm() - (Lat,Lon) to (X,Y) */ -/* pointUtmToPointLla() - (X,Y) to (Lat,Lon) */ -/* */ -/* Library Files: cproj.c */ -/* utmfor.c */ -/* utminv.c */ -/* utmLib.c */ -/* cproj.h */ -/* proj.h */ -/* utmLib.h */ -/* */ -/* **************************************************************** */ - -#include -#include -#include "utm/utmLib.h" - -static unsigned char utmLibInitFlag = FALSE; // Place holder to test if the library has been initialized -static long utmLibZone = 0; // Place holder to remember the last zone the library was initialized to - -/* **************************************************************** */ -/* Function: utmInitCheck() */ -/* Inputs: none */ -/* Outputs: TRUE if the Library has been initialized */ -/* Description: Used to check the status of the UTM Engine */ -/* **************************************************************** */ -unsigned char utmInitCheck(void) -{ - return utmLibInitFlag; -} - -/* **************************************************************** */ -/* Function: utmZoneCheck() */ -/* Inputs: PointLLA */ -/* Outputs: TRUE if zones are equal */ -/* Description: Function takes a value for Longitude, */ -/* calculates the UTM Zone and checks whether the */ -/* utmLib has been setup for that zone. */ -/* Use this to detect changes in zone during operation */ -/* Units: LAT and LON in RADIANS */ -/* **************************************************************** */ -unsigned char utmZoneCheck(PointLla point) -{ - long zone = 0; - - if(point->longitudeRadians > PI || point->longitudeRadians < -PI) - { - p_error("Invalid Test Point for UTM Zone Check. Check Radians??",""); - return FALSE; - } - - zone = calc_utm_zone(point->longitudeRadians * DEG_PER_RAD); - - if(zone == utmLibZone) - return TRUE; - else - return FALSE; -} - -/* **************************************************************** */ -/* Function: utmConversionInit() */ -/* Inputs: PointLLA */ -/* Outputs: 0 if sucessful */ -/* Description: Function takes a seed value for Longitude, */ -/* calculates the UTM Zone and intializes the */ -/* utmForward and utmInverse functions. */ -/* Constructs the conversion for the WGS84 Spheroid */ -/* Units: LAT and LON in RADIANS */ -/* **************************************************************** */ -long utmConversionInit(PointLla point) -{ - long zone = 0; - double r_maj = 6378137; // Magic Number: These are the values - double r_min = 6356752.3142; // needed for the UTM ellipsoid - double scale_fact = .9996; -// long val; - - if(point->longitudeRadians > PI || point->longitudeRadians < -PI) - { - p_error("Invalid Seed Point for UTM Init. Check Radians??",""); - return(-1); - } - - zone = calc_utm_zone(point->longitudeRadians*R2D); - - // Check if the zone is different than what was done before - if(zone != utmLibZone) - { - if(utmforint(r_maj, r_min, scale_fact, zone) != OK) return -1; - if(utminvint(r_maj, r_min, scale_fact, zone) != OK) return -1; - - utmLibInitFlag = 1; - utmLibZone = zone; - return OK; - } - else - { - // Zone is the same, no need to re-init - return OK; - } -} - -/* **************************************************************** */ -/* Function: UTM2LLA() */ -/* Inputs: PointXYZ */ -/* Outputs: PointLLA */ -/* Description: Converts the point given in X and Y to Lat */ -/* and Lon using the UTM projection for the */ -/* WGS84 Spheroid and the seeded UTM zone. */ -/* Units: LAT and LON in RADIANS */ -/* X and Y in METERS */ -/* **************************************************************** */ -PointLla pointUtmToPointLla(PointUtm pointUtm) -{ - PointLla pointLla = pointLlaCreate(); - - utminv(pointUtm->xMeters, pointUtm->yMeters, &pointLla->longitudeRadians, &pointLla->latitudeRadians); - - return pointLla; -} - -/* **************************************************************** */ -/* Function: LLA2UTM() */ -/* Inputs: PointXYZ */ -/* Outputs: PointLLA */ -/* Description: Converts the point given in Lat and Lon to */ -/* Lat and Lon using the UTM projection for */ -/* the WGS84 Spheroid and the seeded UTM Zone. */ -/* Units: LAT and LON in RADIANS */ -/* X and Y in METERS */ -/* **************************************************************** */ -PointUtm pointLlaToPointUtm(PointLla pointLla) -{ - PointUtm pointUtm = pointUtmCreate(); - - utmfor(pointLla->longitudeRadians, pointLla->latitudeRadians, &pointUtm->xMeters, &pointUtm->yMeters); - - return pointUtm; -} - -/* **************************************************************** */ -/* Function: p_error() */ -/* Inputs: char what */ -/* Outputs: void */ -/* Description: Provides p_error functions used in GCTP functions */ -/* **************************************************************** */ -void p_error(char *what, char *where) -{ - printf(what); printf("\n"); -} diff --git a/lib/openjaus/ojVehicleSim/src/utm/utmfor.c b/lib/openjaus/ojVehicleSim/src/utm/utmfor.c deleted file mode 100644 index fbe52dbcf6019ffdc488195f2d54092f7a460c3e..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/utm/utmfor.c +++ /dev/null @@ -1,193 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -/******************************************************************************* -NAME UNIVERSAL TRANSVERSE MERCATOR - -PURPOSE: Transforms input longitude and latitude to Easting and - Northing for the Universal Transverse Mercator projection. - The longitude and latitude must be in radians. The Easting - and Northing values will be returned in meters. - -PROGRAMMER DATE REASON ----------- ---- ------ -D. Steinwand, EROS Nov, 1991 -T. Mittan Mar, 1993 -S. Nelson Feb, 1995 Divided tmfor.c into two files, one - for UTM (utmfor.c) and one for - TM (tmfor.c). This was a - necessary change to run forward - projection conversions for both - UTM and TM in the same process. - -ALGORITHM REFERENCES - -1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological - Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United - State Government Printing Office, Washington D.C., 1987. - -2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", - U.S. Geological Survey Professional Paper 1453 , United State Government - Printing Office, Washington D.C., 1989. -*******************************************************************************/ -#include -#include "utm/utmLib.h" - -/* Variables common to all subroutines in this code file - -----------------------------------------------------*/ -static double r_major; /* major axis */ -static double r_minor; /* minor axis */ -static double scale_factor; /* scale factor */ -static double lon_center; /* Center longitude (projection center) */ -static double lat_origin; /* center latitude */ -static double e0,e1,e2,e3; /* eccentricity constants */ -static double e,es,esp; /* eccentricity constants */ -static double ml0; /* small value m */ -static double false_northing; /* y offset in meters */ -static double false_easting; /* x offset in meters */ -static double ind; /* spherical flag */ - -/* Initialize the Universal Transverse Mercator (UTM) projection - -------------------------------------------------------------*/ -long utmforint(r_maj,r_min,scale_fact,zone) - -double r_maj; /* major axis */ -double r_min; /* minor axis */ -double scale_fact; /* scale factor */ -long zone; /* zone number */ -{ -double temp; /* temporary variable */ - -if ((abs(zone) < 1) || (abs(zone) > 60)) - { - p_error("Illegal zone number","utm-forint"); - return(11); - } -r_major = r_maj; -r_minor = r_min; -scale_factor = scale_fact; -lat_origin = 0.0; -lon_center = ((6 * abs(zone)) - 183) * D2R; -false_easting = 500000.0; -false_northing = (zone < 0) ? 10000000.0 : 0.0; - -temp = r_minor / r_major; -es = 1.0 - SQUARE(temp); -e = sqrt(es); -e0 = e0fn(es); -e1 = e1fn(es); -e2 = e2fn(es); -e3 = e3fn(es); -ml0 = r_major * mlfn(e0, e1, e2, e3, lat_origin); -esp = es / (1.0 - es); - -if (es < .00001) - ind = 1; - -/* Report parameters to the user - -----------------------------*/ -/* REMOVED FEB 2004 BY DK, CIMAR */ -/* -ptitle("UNIVERSAL TRANSVERSE MERCATOR (UTM)"); -genrpt_long(zone, "Zone: "); -radius2(r_major, r_minor); -genrpt(scale_factor,"Scale Factor at C. Meridian: "); -cenlonmer(lon_center); -*/ -return(OK); -} - - -/* Universal Transverse Mercator forward equations--mapping lat,long to x,y - Note: The algorithm for UTM is exactly the same as TM and therefore - if a change is implemented, also make the change to TMFOR.c - -----------------------------------------------------------------------*/ -long utmfor(lon, lat, x, y) -double lon; /* (I) Longitude */ -double lat; /* (I) Latitude */ -double *x; /* (O) X projection coordinate */ -double *y; /* (O) Y projection coordinate */ -{ -double delta_lon; /* Delta longitude (Given longitude - center */ -//double theta; /* angle */ -//double delta_theta; /* adjusted longitude */ -double sin_phi, cos_phi;/* sin and cos value */ -double al, als; /* temporary values */ -double b; /* temporary values */ -double c, t, tq; /* temporary values */ -double con, n, ml; /* cone constant, small m */ - -/* Forward equations - -----------------*/ -delta_lon = adjust_lon(lon - lon_center); -sincos(lat, &sin_phi, &cos_phi); - -/* This part was in the fortran code and is for the spherical form -----------------------------------------------------------------*/ -if (ind != 0) - { - b = cos_phi * sin(delta_lon); - if ((fabs(fabs(b) - 1.0)) < .0000000001) - { - p_error("Point projects into infinity","utm-for"); - return(93); - } - else - { - *x = .5 * r_major * scale_factor * log((1.0 + b)/(1.0 - b)); - con = acos(cos_phi * cos(delta_lon)/sqrt(1.0 - b*b)); - if (lat < 0) - con = - con; - *y = r_major * scale_factor * (con - lat_origin); - return(OK); - } - } - -al = cos_phi * delta_lon; -als = SQUARE(al); -c = esp * SQUARE(cos_phi); -tq = tan(lat); -t = SQUARE(tq); -con = 1.0 - es * SQUARE(sin_phi); -n = r_major / sqrt(con); -ml = r_major * mlfn(e0, e1, e2, e3, lat); - -*x = scale_factor * n * al * (1.0 + als / 6.0 * (1.0 - t + c + als / 20.0 * - (5.0 - 18.0 * t + SQUARE(t) + 72.0 * c - 58.0 * esp))) + false_easting; - -*y = scale_factor * (ml - ml0 + n * tq * (als * (0.5 + als / 24.0 * - (5.0 - t + 9.0 * c + 4.0 * SQUARE(c) + als / 30.0 * (61.0 - 58.0 * t - + SQUARE(t) + 600.0 * c - 330.0 * esp))))) + false_northing; - -return(OK); -} diff --git a/lib/openjaus/ojVehicleSim/src/utm/utminv.c b/lib/openjaus/ojVehicleSim/src/utm/utminv.c deleted file mode 100644 index 10b58941e9cfb66d04c1cde56c93dd2f544c21cf..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/utm/utminv.c +++ /dev/null @@ -1,224 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -/******************************************************************************* -NAME UNIVERSAL TRANSVERSE MERCATOR - -PURPOSE: Transforms input Easting and Northing to longitude and - latitude for the Universal Transverse Mercator projection. - The Easting and Northing must be in meters. The longitude - and latitude values will be returned in radians. - -PROGRAMMER DATE REASON ----------- ---- ------ -D. Steinwand, EROS Nov, 1991 -T. Mittan Mar, 1993 -S. Nelson Feb, 1995 Divided tminv.c into two files, one - for UTM (utminv.c) and one for - TM (tminv.c). This was a necessary - change to run inverse projection - conversions for both UTM and TM - in the same process. - -ALGORITHM REFERENCES - -1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological - Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United - State Government Printing Office, Washington D.C., 1987. - -2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", - U.S. Geological Survey Professional Paper 1453 , United State Government - Printing Office, Washington D.C., 1989. -*******************************************************************************/ -#include -#include "utm/utmLib.h" - - -/* Variables common to all subroutines in this code file - -----------------------------------------------------*/ -static double r_major; /* major axis */ -static double r_minor; /* minor axis */ -static double scale_factor; /* scale factor */ -static double lon_center; /* Center longitude (projection center) */ -static double lat_origin; /* center latitude */ -static double e0,e1,e2,e3; /* eccentricity constants */ -static double e,es,esp; /* eccentricity constants */ -static double ml0; /* small value m */ -static double false_northing; /* y offset in meters */ -static double false_easting; /* x offset in meters */ -static long ind; /* sphere flag value */ - - -/* Initialize the Universal Transverse Mercator (UTM) projection - -------------------------------------------------------------*/ -long utminvint(r_maj,r_min,scale_fact,zone) - -double r_maj; /* major axis */ -double r_min; /* minor axis */ -double scale_fact; /* scale factor */ -long zone; /* zone number */ -{ -double temp; /* temprorary variables */ - -if ((abs(zone) < 1) || (abs(zone) > 60)) - { - p_error("Illegal zone number","utm-invint"); - return(11); - } -r_major = r_maj; -r_minor = r_min; -scale_factor = scale_fact; -lat_origin = 0.0; -lon_center = ((6 * abs(zone)) - 183) * D2R; -false_easting = 500000.0; -false_northing = (zone < 0) ? 10000000.0 : 0.0; - -temp = r_minor / r_major; -es = 1.0 - SQUARE(temp); -e = sqrt(es); -e0 = e0fn(es); -e1 = e1fn(es); -e2 = e2fn(es); -e3 = e3fn(es); -ml0 = r_major * mlfn(e0, e1, e2, e3, lat_origin); -esp = es / (1.0 - es); - -if (es < .00001) - ind = 1; -else - ind = 0; - -/* Report parameters to the user - -----------------------------*/ - -/* REMOVED FEB 2004 BY DK, CIMAR */ -/* -ptitle("UNIVERSAL TRANSVERSE MERCATOR (UTM)"); -genrpt_long(zone, "Zone: "); -radius2(r_major, r_minor); -genrpt(scale_factor,"Scale Factor at C. Meridian: "); -cenlonmer(lon_center); */ -return(OK); -} - -/* Universal Transverse Mercator inverse equations--mapping x,y to lat,long - Note: The algorithm for UTM is exactly the same as TM and therefore - if a change is implemented, also make the change to TMINV.c - -----------------------------------------------------------------------*/ -long utminv(x, y, lon, lat) -double x; /* (I) X projection coordinate */ -double y; /* (I) Y projection coordinate */ -double *lon; /* (O) Longitude */ -double *lat; /* (O) Latitude */ -{ -double con,phi; /* temporary angles */ -double delta_phi; /* difference between longitudes */ -long i; /* counter variable */ -double sin_phi, cos_phi, tan_phi; /* sin cos and tangent values */ -double c, cs, t, ts, n, r, d, ds; /* temporary variables */ -double f, h, g, temp; /* temporary variables */ -long max_iter = 6; /* maximun number of iterations */ - -/* fortran code for spherical form ---------------------------------*/ -if (ind != 0) - { - f = exp(x/(r_major * scale_factor)); - g = .5 * (f - 1/f); - temp = lat_origin + y/(r_major * scale_factor); - h = cos(temp); - con = sqrt((1.0 - h * h)/(1.0 + g * g)); - *lat = asinz(con); - if (temp < 0) - *lat = -*lat; - if ((g == 0) && (h == 0)) - { - *lon = lon_center; - return(OK); - } - else - { - *lon = adjust_lon(atan2(g,h) + lon_center); - return(OK); - } - } - -/* Inverse equations - -----------------*/ -x = x - false_easting; -y = y - false_northing; - -con = (ml0 + y / scale_factor) / r_major; -phi = con; -for (i=0;;i++) - { - delta_phi=((con + e1 * sin(2.0*phi) - e2 * sin(4.0*phi) + e3 * sin(6.0*phi)) - / e0) - phi; -/* - delta_phi = ((con + e1 * sin(2.0*phi) - e2 * sin(4.0*phi)) / e0) - phi; -*/ - phi += delta_phi; - if (fabs(delta_phi) <= EPSLN) break; - if (i >= max_iter) - { - p_error("Latitude failed to converge","UTM-INVERSE"); - return(95); - } - } -if (fabs(phi) < HALF_PI) - { - sincos(phi, &sin_phi, &cos_phi); - tan_phi = tan(phi); - c = esp * SQUARE(cos_phi); - cs = SQUARE(c); - t = SQUARE(tan_phi); - ts = SQUARE(t); - con = 1.0 - es * SQUARE(sin_phi); - n = r_major / sqrt(con); - r = n * (1.0 - es) / con; - d = x / (n * scale_factor); - ds = SQUARE(d); - *lat = phi - (n * tan_phi * ds / r) * (0.5 - ds / 24.0 * (5.0 + 3.0 * t + - 10.0 * c - 4.0 * cs - 9.0 * esp - ds / 30.0 * (61.0 + 90.0 * t + - 298.0 * c + 45.0 * ts - 252.0 * esp - 3.0 * cs))); - *lon = adjust_lon(lon_center + (d * (1.0 - ds / 6.0 * (1.0 + 2.0 * t + - c - ds / 20.0 * (5.0 - 2.0 * c + 28.0 * t - 3.0 * cs + 8.0 * esp + - 24.0 * ts))) / cos_phi)); - } -else - { - *lat = HALF_PI * sign(y); - *lon = lon_center; - } -return(OK); -} diff --git a/lib/openjaus/ojVehicleSim/src/vehicle.c b/lib/openjaus/ojVehicleSim/src/vehicle.c deleted file mode 100644 index f6c838050e19f4759747f452be113d615aea4838..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/vehicle.c +++ /dev/null @@ -1,141 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File: vehicle.c -// Version: 0.4 -// Written by: Tom Galluzzo (galluzzt@ufl.edu) -// Date: 07/22/2005 - -#include -#include -#include - -#include "vehicle.h" - -#define K_MINIMUM_THRESHOLD 0.001 -#define SPEED_MINIMUM_THRESHOLD 0.001 - -VehicleState vehicleStateCreate(void) -{ - VehicleState state; - - state = (VehicleState)malloc( sizeof(struct VehicleState) ); - if(state == NULL) - { - return NULL; - } - - memset(state, 0, sizeof(struct VehicleState) ); - - return state; -} - -void vehicleStateDestroy( VehicleState state) -{ - free(state); -} - -void vehicleModelTimeStep( VehicleState state, float dTime) -{ - float kAve = state->phiEffort; - float dPhi = state->desiredPhiEffort - state->phiEffort; - float dMaxPhi = (float)VEHICLE_MAX_PHI_RATE_EFFORT_PER_SEC * dTime; - float dDistM = state->speedMps * dTime; - float dYawRad; - - if(dPhi > 0) - { - state->phiEffort += dPhi > dMaxPhi? dMaxPhi : dPhi; - } - else - { - state->phiEffort += dPhi < -dMaxPhi? -dMaxPhi : dPhi; - } - - kAve += state->phiEffort; - kAve /= 2.0f; - kAve *= VEHICLE_CURVATURE_PER_EFFORT; - - dYawRad = dDistM * kAve; - - if(kAve < K_MINIMUM_THRESHOLD && kAve > -K_MINIMUM_THRESHOLD) - { - // Project straight line - state->xM += sinf(state->yawRad) * dDistM; - state->yM += cosf(state->yawRad) * dDistM; - } - else - { - // Project path along curve - state->xM += (cosf(state->yawRad)*(1.0f - cosf(dYawRad)) + sinf(state->yawRad)*sinf(dYawRad)) / kAve; - state->yM += (cosf(state->yawRad)*sinf(dYawRad) - sinf(state->yawRad)*(1.0f - cosf(dYawRad))) / kAve; - } - - state->yawRad += dYawRad; -} - -void vehicleModelDistStep( VehicleState state, float dDistM) -{ - float kAve; - float dYawRad; - - if(state->speedMps > SPEED_MINIMUM_THRESHOLD) - { - vehicleModelTimeStep( state, dDistM / state->speedMps); - } - else - { - kAve = state->phiEffort; - state->phiEffort = state->desiredPhiEffort; - kAve += state->phiEffort; - kAve /= 2.0f; - kAve *= VEHICLE_CURVATURE_PER_EFFORT; - - dYawRad = dDistM * kAve; - - if(kAve < K_MINIMUM_THRESHOLD && kAve > -K_MINIMUM_THRESHOLD) - { - // Project straight line - state->xM += sinf(state->yawRad) * dDistM; - state->yM += cosf(state->yawRad) * dDistM; - } - else - { - // Project path along curve - state->xM += (cosf(state->yawRad)*(1.0f - cosf(dYawRad)) + sinf(state->yawRad)*sinf(dYawRad)) / kAve; - state->yM += (cosf(state->yawRad)*sinf(dYawRad) - sinf(state->yawRad)*(1.0f - cosf(dYawRad))) / kAve; - } - - state->yawRad += dYawRad; - } -} diff --git a/lib/openjaus/ojVehicleSim/src/vehicleSim.c b/lib/openjaus/ojVehicleSim/src/vehicleSim.c deleted file mode 100644 index 07cba41abbc646478c30719c729c6cfef2b5a0c6..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/vehicleSim.c +++ /dev/null @@ -1,395 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -#include // JAUS message set (USER: JAUS libraries must be installed first) -#include -#include // Multi-threading functions (standard to unix) -#include -//#include // Unix standard functions -#include -#include "properties.h" -#include "vehicleSim.h" - -#if defined (WIN32) - #define _USE_MATH_DEFINES - #include - #define CONFIG_DIRECTORY ".\\config\\" -#elif defined(__linux) || defined(linux) || defined(__linux__) || defined(__APPLE__) - #define CONFIG_DIRECTORY "./config/" -#endif - -#define MIN_TURNING_RADIUS_M 4.25 - -#define IDLE_FORCE_N 200.0 - -#define VEHICLE_MASS_KG 1700.0 - -#define DRAG_COEFF_N_PER_MPS_SQ 100.0 - -#define K_STEERING 2.0 -#define MAX_STEERING_RATE 50.0 - -#define K_THROTTLE 40.0 - -#define BRAKE_TAU 1.0 - -#define K_DYNAMIC_BRAKE 60.0 -#define K_STATIC_BRAKE 100.0 - -void *vehicleSimThread(void *); - -static int vehicleSimRun = FALSE; -static double vehicleSimThreadHz = 0; // Stores the calculated uvehicleSimate rate for main state thread -static int vehicleSimThreadRunning = FALSE; -static pthread_t vehicleSimThreadId; // pthread component thread identifier - -static Properties vehicleSimProperties; - -static int vehicleRunPause = VEHICLE_SIM_RUN; - -static PointLla vehiclePosLla = NULL; -static PointUtm vehiclePosUtm = NULL; - -static double vehicleH = 0; -static double vehicleSpeed = 0; - -static double vehicleDesiredRotationalEffort = 0; -static double vehicleDesiredLinearEffortX = 0; -static double vehicleDesiredResistiveEffortX = 0; - -static double vehicleRotationalEffort = 0; -static double vehicleLinearEffortX = 0; -static double vehicleResistiveEffortX = 0; - -int vehicleSimStartup(void) -{ - FILE * propertyFile = NULL; - char *property = NULL; - pthread_attr_t attr; // Thread attributed for the component threads spawned in this function - char fileName[128] = {0}; - - // Create vehiclePosLla object - vehiclePosLla = pointLlaCreate(); - if(!vehiclePosLla) - { - //cError("vehicleSim: Could not create vehicleSimThread\n"); - vehicleSimShutdown(); - return VEHICLE_SIM_MALLOC_ERROR; - } - - sprintf(fileName, "%svehicleSim.conf", CONFIG_DIRECTORY); - propertyFile = fopen(fileName, "r"); - if(propertyFile) - { - vehicleSimProperties = propertiesCreate(); - vehicleSimProperties = propertiesLoad(vehicleSimProperties, propertyFile); - fclose(propertyFile); - } - else - { - //cError("vehicleSim: Cannot find or open properties file\n"); - return VEHICLE_SIM_LOAD_CONFIGURATION_ERROR; - } - - property = propertiesGetProperty(vehicleSimProperties, "INITIAL_LAT_DEGREES"); - if(property) - { - vehiclePosLla->latitudeRadians = atof( property ); - //cDebug(3, "vehicleSim: Property loaded INITIAL_LAT_DEGREES: %lf\n", vehiclePosLla->latitudeRadians); - vehiclePosLla->latitudeRadians *= RAD_PER_DEG; - } - else - { - //cDebug(3, "vehicleSim: Property INITIAL_LAT_DEGREES not found, using default value: %lf\n", vehiclePosLla->latitudeRadians); - } - - property = propertiesGetProperty(vehicleSimProperties, "INITIAL_LON_DEGREES"); - if(property) - { - vehiclePosLla->longitudeRadians = atof( property ); - //cDebug(3, "vehicleSim: Property loaded INITIAL_LON_DEGREES: %lf\n", vehiclePosLla->longitudeRadians); - vehiclePosLla->longitudeRadians *= RAD_PER_DEG; - } - else - { - //cDebug(3, "vehicleSim: Property INITIAL_LON_DEGREES not found, using default value: %lf\n", vehiclePosLla->longitudeRadians); - } - - property = propertiesGetProperty(vehicleSimProperties, "INITIAL_HEADING_DEGREES"); - if(property) - { - vehicleH = atof( property ); - //cDebug(3, "vehicleSim: Property loaded INITIAL_HEADING_DEGREES: %lf\n", vehicleH); - } - else - { - //cDebug(3, "vehicleSim: Property INITIAL_HEADING_DEGREES not found, using default value: %lf\n", vehicleH); - } - - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - - vehicleSimRun = TRUE; - - if(pthread_create(&vehicleSimThreadId, &attr, vehicleSimThread, NULL) != 0) - { - //cError("vehicleSim: Could not create vehicleSimThread\n"); - vehicleSimShutdown(); - pthread_attr_destroy(&attr); - return VEHICLE_SIM_THREAD_CREATE_ERROR; - } - pthread_attr_destroy(&attr); - - return 0; -} - -// Function: vehicleSimShutdown -// Access: Public -// Description: This function allows the abstracted component functionality contained in this file to be stoped from an external source. -// If the component is in the running state, this function will terminate all threads running in this file -// This function will also close the Jms connection to the Node Manager and check out the component from the Node Manager -int vehicleSimShutdown(void) -{ - double timeOutSec; - - vehicleSimRun = FALSE; - - timeOutSec = ojGetTimeSec() + VEHICLE_SIM_THREAD_TIMEOUT_SEC; - while(vehicleSimThreadRunning) - { - ojSleepMsec(100); - if(ojGetTimeSec() >= timeOutSec) - { - pthread_cancel(vehicleSimThreadId); - vehicleSimThreadRunning = FALSE; - //cError("vehicleSim: vehicleSimThread Shutdown Improperly\n"); - break; - } - } - - propertiesDestroy(vehicleSimProperties); - - return 0; -} - -int vehicleSimGetState(void) -{ - return VEHICLE_SIM_READY_STATE; -} - -int vehicleSimGetRunPause(void) -{ - return vehicleRunPause; -} - -void vehicleSimToggleRunPause(void) -{ - vehicleRunPause = vehicleRunPause == VEHICLE_SIM_PAUSE ? VEHICLE_SIM_RUN : VEHICLE_SIM_PAUSE; -} - -double vehicleSimGetUpdateRate(void) -{ - return vehicleSimThreadHz; -} - -PointLla vehicleSimGetPositionLla(void) -{ - return vehiclePosLla; -} - -double vehicleSimGetX(void) -{ - if(vehiclePosUtm) - { - return vehiclePosUtm->xMeters; - } - else - { - return 0; - } -} - -double vehicleSimGetY(void) -{ - if(vehiclePosUtm) - { - return vehiclePosUtm->yMeters; - } - else - { - return 0; - } -} - -double vehicleSimGetH(void) -{ - return vehicleH; -} - -double vehicleSimGetSpeed(void) -{ - return vehicleSpeed; -} - -double vehicleSimGetRotateEffort(void) -{ - return vehicleRotationalEffort; -} - -double vehicleSimGetLinearEffortX(void) -{ - return vehicleDesiredLinearEffortX; -} - -double vehicleSimGetResistiveEffortX(void) -{ - return vehicleDesiredResistiveEffortX; -} - -double vehicleSimGetRotationalEffort(void) -{ - return vehicleDesiredRotationalEffort; -} - -void vehicleSimSetCommand(double throttle, double brake, double steering) -{ - if(throttle <= 100.0 && throttle >= 0.0) - { - vehicleDesiredLinearEffortX = throttle; - } - - if(brake <= 100.0 && brake >= 0.0) - { - vehicleDesiredResistiveEffortX = brake; - } - - if(steering <= 100.0 && steering >= -100.0) - { - vehicleDesiredRotationalEffort = steering; - } -} - -// Function: vehicleSimThread -// Access: Private -// Description: All core component functionality is contained in this thread. -// All of the JAUS component state machine code can be found here. -void *vehicleSimThread(void *threadData) -{ - double time, prevTime, dt; - double steeringRate; - - double motorForce; - double brakeForce; - double dragForce; - - double turningCurvature; - double deltaH; - - vehicleSimThreadRunning = TRUE; - - // Initialize the UTM engine - utmConversionInit(vehiclePosLla); - vehiclePosUtm = pointLlaToPointUtm(vehiclePosLla); - - time = ojGetTimeSec(); - - while(vehicleSimRun) // Execute state machine code while not in the SHUTDOWN state - { - prevTime = time; - time = ojGetTimeSec(); - dt = time - prevTime; - vehicleSimThreadHz = 1.0/dt; // Compute the update rate of this thread - - steeringRate = K_STEERING * (vehicleDesiredRotationalEffort - vehicleRotationalEffort); - if(steeringRate > MAX_STEERING_RATE) - { - steeringRate = MAX_STEERING_RATE; - } - else if(steeringRate < -MAX_STEERING_RATE) - { - steeringRate = -MAX_STEERING_RATE; - } - - vehicleRotationalEffort += steeringRate * dt; - turningCurvature = -vehicleRotationalEffort / 100.0 / MIN_TURNING_RADIUS_M; - - vehicleLinearEffortX = vehicleDesiredLinearEffortX; - motorForce = K_THROTTLE * vehicleLinearEffortX + IDLE_FORCE_N; - - vehicleResistiveEffortX += BRAKE_TAU * (vehicleDesiredResistiveEffortX - vehicleResistiveEffortX); - - if(vehicleSpeed > 0.005) - { - brakeForce = K_DYNAMIC_BRAKE * vehicleResistiveEffortX; - } - else - { - brakeForce = K_STATIC_BRAKE * vehicleResistiveEffortX; - if(brakeForce > motorForce) - { - brakeForce = motorForce + 1.0; - } - } - dragForce = DRAG_COEFF_N_PER_MPS_SQ * vehicleSpeed * vehicleSpeed; - - - vehicleSpeed += ( motorForce - brakeForce - dragForce) / VEHICLE_MASS_KG * dt; - if(vehicleSpeed < 0) - { - vehicleSpeed = 0; - } - - deltaH = turningCurvature * vehicleSpeed * dt; - - vehiclePosUtm->xMeters += cos(vehicleH + deltaH / 2.0) * vehicleSpeed * dt; - vehiclePosUtm->yMeters += sin(vehicleH + deltaH / 2.0) * vehicleSpeed * dt; - - vehicleH += deltaH; - vehicleH = fmod(vehicleH, 2*M_PI); - - if(vehiclePosLla) - { - pointLlaDestroy(vehiclePosLla); - } - vehiclePosLla = pointUtmToPointLla(vehiclePosUtm); - - ojSleepMsec(25); - } - - ojSleepMsec(50); // Sleep for 50 milliseconds and then exit - - vehicleSimThreadRunning = FALSE; - - return NULL; -} - diff --git a/lib/openjaus/ojVehicleSim/src/vss.c b/lib/openjaus/ojVehicleSim/src/vss.c deleted file mode 100644 index 156a6adcb1d93a673faae576047aba40c5f3b64a..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/vss.c +++ /dev/null @@ -1,183 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File: vss.c -// Version: 0.4 alpha -// Written by: Tom Galluzzo (galluzzt@ufl.edu) and Danny Kent (kentd@ufl.edu) -// Date: 07/01/2005 -// Description: This file contains the skeleton C code for implementing a JAUS component in a Linux environment -// This code is designed to work with the node manager and JAUS library software written by CIMAR - -#include // JAUS message set (USER: JAUS libraries must be installed first) -#include // Node managment functions for sending and receiving JAUS messages (USER: Node Manager must be installed) -#include -#include "vss.h" // USER: Implement and rename this header file. Include prototypes for all public functions contained in this file. -#include "vehicleSim.h" - -// Private function prototypes -void vssReadyState(OjCmpt vss); -void vssQueryVelocityStateCallback(OjCmpt vss, JausMessage query); - - -OjCmpt vssCreate(void) -{ - OjCmpt cmpt; - ReportVelocityStateMessage message; - JausAddress vssAddr; - - cmpt = ojCmptCreate("vss", JAUS_VELOCITY_STATE_SENSOR, VSS_THREAD_DESIRED_RATE_HZ); - - ojCmptAddService(cmpt, JAUS_VELOCITY_STATE_SENSOR); - ojCmptAddServiceInputMessage(cmpt, JAUS_VELOCITY_STATE_SENSOR, JAUS_QUERY_VELOCITY_STATE, 0xFF); - ojCmptAddServiceOutputMessage(cmpt, JAUS_VELOCITY_STATE_SENSOR, JAUS_REPORT_VELOCITY_STATE, 0xFF); - - ojCmptSetStateCallback(cmpt, JAUS_READY_STATE, vssReadyState); - ojCmptSetMessageCallback(cmpt, JAUS_QUERY_VELOCITY_STATE, vssQueryVelocityStateCallback); - ojCmptAddSupportedSc(cmpt, JAUS_REPORT_VELOCITY_STATE); - - message = reportVelocityStateMessageCreate(); - vssAddr = ojCmptGetAddress(cmpt); - jausAddressCopy(message->source, vssAddr); - jausAddressDestroy(vssAddr); - - ojCmptSetUserData(cmpt, (void *)message); - - ojCmptSetState(cmpt, JAUS_READY_STATE); - - if(ojCmptRun(cmpt)) - { - ojCmptDestroy(cmpt); - return NULL; - } - - return cmpt; -} - -void vssDestroy(OjCmpt vss) -{ - ReportVelocityStateMessage message; - - message = (ReportVelocityStateMessage)ojCmptGetUserData(vss); - - ojCmptRemoveSupportedSc(vss, JAUS_REPORT_VELOCITY_STATE); - ojCmptDestroy(vss); - - reportVelocityStateMessageDestroy(message); -} - -// The series of functions below allow public access to essential component information -// Access: Public (All) -double vssGetVelocityX(OjCmpt vss) -{ - ReportVelocityStateMessage message; - - message = (ReportVelocityStateMessage)ojCmptGetUserData(vss); - - return message->velocityXMps; -} - -int vssGetScActive(OjCmpt vss) -{ - return ojCmptIsOutgoingScActive(vss, JAUS_REPORT_VELOCITY_STATE); -} - -void vssQueryVelocityStateCallback(OjCmpt vss, JausMessage query) -{ - ReportVelocityStateMessage message; - JausMessage txMessage; - QueryVelocityStateMessage queryVelocityState; - - message = (ReportVelocityStateMessage)ojCmptGetUserData(vss); - - queryVelocityState = queryVelocityStateMessageFromJausMessage(query); - if(queryVelocityState) - { - jausAddressCopy(message->destination, queryVelocityState->source); - message->presenceVector = queryVelocityState->presenceVector; - message->sequenceNumber = 0; - message->properties.scFlag = 0; - - txMessage = reportVelocityStateMessageToJausMessage(message); - ojCmptSendMessage(vss, txMessage); - jausMessageDestroy(txMessage); - - queryVelocityStateMessageDestroy(queryVelocityState); - } - else - { - ////cError("vss: Error unpacking %s message.\n", jausMessageCommandCodeString(message)); - } -} - - -void vssReadyState(OjCmpt vss) -{ - JausMessage txMessage; - ServiceConnection scList; - ServiceConnection sc; - - ReportVelocityStateMessage message; - - message = (ReportVelocityStateMessage)ojCmptGetUserData(vss); - - message->velocityXMps = vehicleSimGetSpeed(); - message->velocityYMps = 0; - message->velocityZMps = 0; - message->velocityRmsMps = 0.01; - message->rollRateRps = 0.0; - message->pitchRateRps = 0.0; - message->yawRateRps = 0.0; - message->rateRmsRps = 0; - - // send message - if(ojCmptIsOutgoingScActive(vss, JAUS_REPORT_VELOCITY_STATE)) - { - scList = ojCmptGetScSendList(vss, JAUS_REPORT_VELOCITY_STATE); - sc = scList; - while(sc) - { - jausAddressCopy(message->destination, sc->address); - message->presenceVector = sc->presenceVector; - message->sequenceNumber = sc->sequenceNumber; - message->properties.scFlag = JAUS_SERVICE_CONNECTION_MESSAGE; - - txMessage = reportVelocityStateMessageToJausMessage(message); - ojCmptSendMessage(vss, txMessage); - jausMessageDestroy(txMessage); - - sc = sc->nextSc; - } - - ojCmptDestroySendList(scList); - } -} diff --git a/lib/openjaus/ojVehicleSim/src/wd.c b/lib/openjaus/ojVehicleSim/src/wd.c deleted file mode 100644 index 65ba80e90d1de90263019b796f9abbff9bc4f9ad..0000000000000000000000000000000000000000 --- a/lib/openjaus/ojVehicleSim/src/wd.c +++ /dev/null @@ -1,986 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2008, University of Florida. - * All rights reserved. - * - * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD - * license. See the LICENSE file for details. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the University of Florida nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ****************************************************************************/ -// File: wd.c -// -// Version: 1.0 -// -// Written by: Danny Kent (jaus AT dannykent DOT com) -// -// Date: 08/24/06 -// -// Description: This file contains the skeleton C code for implementing a JAUS component in a Linux environment -// This code is designed to work with the node manager and JAUS library software written by CIMAR - -#include // JAUS message set (USER: JAUS libraries must be installed first) -#include // Node managment functions for sending and receiving JAUS messages (USER: Node Manager must be installed) -#include -#include -#include "utm/utmLib.h" -// USER: Add include files here as appropriate - -#include "wd.h" -#include "vehicle.h" - -#if defined (WIN32) - #define _USE_MATH_DEFINES - #include -#endif - -// Incoming Service Connection Defines -#define WD_INC_SC_TIMEOUT_SEC 1.0 // The timeout between receiving service connection messages -#define WD_INC_SC_UPDATE_RATE_HZ 20.0 // Requested service connection update rate -#define WD_INC_SC_PRESENCE_VECTOR 0xFF // The GPOS Presence Vector, set this to the fields desired (default = ALL) -#define WD_INC_SC_QUEUE_SIZE 1 // The Service Connection Manager's queue size (0 = infinite) - -#define MPH_PER_MPS 2.23694 -#define MPS_PER_MPH 0.44704 -//#define ACCEL_GRAVITY_MPSPS 9.81 // Acceleration due to gravity - -#define REQUEST_TIMEOUT_SEC 5.0 // How long to wait between any requests - -#define WAYPOINT_POP_DISTANCE_M 3.0 -#define MISSION_FINISHED_DISTANCE_M 3.0 -#define WD_DEFAULT_MIN_SPEED_MPS 1.0 -#define WD_DEFAULT_MAX_SPEED_MPS 4.0 //11.18 - -// Gains -#define ACCELERATION_MPSPS 0.75 // Mps2 -#define DECCELERATION_MPSPS 2.0 // Mps2 -#define LINEAR_EFFORT_K_FF 14.0 // %Effort / Mps -#define LINEAR_EFFORT_BIAS_FF -57.5 // %Effort -#define LINEAR_EFFORT_K_P 15.0 // %Effort / (Mps Error) -#define LINEAR_EFFORT_K_I 6.5 // %Effort / (M Error) -#define LINEAR_EFFORT_I_LIM 6.5 // M Error -#define LINEAR_EFFORT_K_D 20.0 -#define BRAKE_K -1.3 // %Effort / %Effort -#define THROTTLE_K 0.65 // %Effort / %Effort -#define STICKTION_SPEED_MPS 0.5 -#define STICKTION_EFFORT -17.5 -//#define PITCH_FF_EFFORT_PER_RAD 150 -#define STEERING_FF_EFFORT 200 -#define WHEEL_ROTATION_EFFORT_PER_RAD 100 -#define WHEEL_ROTATION_RAD_PER_EFFORT 0.006 - -// Private function prototypes -void wdProcessMessage(OjCmpt wd, JausMessage message); -void wdInitState(OjCmpt wd); -void wdStandbyState(OjCmpt wd); -void wdReadyState(OjCmpt wd); - -// USER: Insert any private function prototypes here -void wdManagePdControl(OjCmpt wd); -void wdExcecuteControl(OjCmpt wd, VehicleState); -double wdAngleSubtract(double a, double b); - -typedef struct -{ - ReportWrenchEffortMessage reportWrench; - ReportGlobalPoseMessage reportGpos; - ReportVelocityStateMessage reportVss; - SetWrenchEffortMessage setWrench; - SetTravelSpeedMessage setSpeed; - SetGlobalWaypointMessage setWaypoint; - - int gposSc; - int vssSc; - int pdWrenchSc; - int pdStatusSc; - - VehicleState vehicleState; - - JausState pdState; - JausAddress pdAddress; - - JausBoolean inControl; - JausBoolean requestControl; - - JausArray waypoints; // Array of commaned waypoints - int currentWaypoint; - double waypointDistance; - -}WdData; - -OjCmpt wdCreate(void) -{ - OjCmpt cmpt; - WdData *data; - JausAddress addr; - - cmpt = ojCmptCreate("Waypoint Driver", JAUS_GLOBAL_WAYPOINT_DRIVER, WD_THREAD_DESIRED_RATE_HZ); - - ojCmptAddService(cmpt, JAUS_GLOBAL_WAYPOINT_DRIVER); - - ojCmptAddServiceInputMessage(cmpt, JAUS_GLOBAL_WAYPOINT_DRIVER, JAUS_SET_TRAVEL_SPEED, 0xFF); - ojCmptAddServiceInputMessage(cmpt, JAUS_GLOBAL_WAYPOINT_DRIVER, JAUS_REPORT_GLOBAL_POSE, 0xFF); - ojCmptAddServiceInputMessage(cmpt, JAUS_GLOBAL_WAYPOINT_DRIVER, JAUS_REPORT_VELOCITY_STATE, 0xFF); - ojCmptAddServiceInputMessage(cmpt, JAUS_GLOBAL_WAYPOINT_DRIVER, JAUS_REPORT_WRENCH_EFFORT, 0xFF); - ojCmptAddServiceInputMessage(cmpt, JAUS_GLOBAL_WAYPOINT_DRIVER, JAUS_SET_GLOBAL_WAYPOINT, 0xFF); - ojCmptAddServiceInputMessage(cmpt, JAUS_GLOBAL_WAYPOINT_DRIVER, JAUS_QUERY_GLOBAL_WAYPOINT, 0xFF); - ojCmptAddServiceInputMessage(cmpt, JAUS_GLOBAL_WAYPOINT_DRIVER, JAUS_QUERY_WAYPOINT_COUNT, 0xFF); - ojCmptAddServiceOutputMessage(cmpt, JAUS_GLOBAL_WAYPOINT_DRIVER, JAUS_REPORT_WAYPOINT_COUNT, 0xFF); - ojCmptAddServiceOutputMessage(cmpt, JAUS_GLOBAL_WAYPOINT_DRIVER, JAUS_REPORT_GLOBAL_WAYPOINT, 0xFF); - - ojCmptSetMessageProcessorCallback(cmpt, wdProcessMessage); - ojCmptSetStateCallback(cmpt, JAUS_INITIALIZE_STATE, wdInitState); - ojCmptSetStateCallback(cmpt, JAUS_STANDBY_STATE, wdStandbyState); - ojCmptSetStateCallback(cmpt, JAUS_READY_STATE, wdReadyState); - ojCmptSetState(cmpt, JAUS_INITIALIZE_STATE); - - ojCmptSetAuthority(cmpt, 127); - - addr = ojCmptGetAddress(cmpt); - - data = (WdData*)malloc(sizeof(WdData)); - - data->setWrench = setWrenchEffortMessageCreate(); - jausAddressCopy(data->setWrench->source, addr); - data->setWrench->presenceVector = 0; - jausUnsignedShortSetBit(&data->setWrench->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_LINEAR_X_BIT); - jausUnsignedShortSetBit(&data->setWrench->presenceVector, JAUS_WRENCH_PV_PROPULSIVE_ROTATIONAL_Z_BIT); - jausUnsignedShortSetBit(&data->setWrench->presenceVector, JAUS_WRENCH_PV_RESISTIVE_LINEAR_X_BIT); - - data->reportWrench = reportWrenchEffortMessageCreate(); - data->reportGpos = reportGlobalPoseMessageCreate(); - data->reportVss = reportVelocityStateMessageCreate(); - data->setSpeed = setTravelSpeedMessageCreate(); - data->setWaypoint = NULL; - - data->pdAddress = jausAddressCreate(); - data->pdAddress->subsystem = addr->subsystem; - data->pdAddress->component = JAUS_PRIMITIVE_DRIVER; - data->pdState = JAUS_UNDEFINED_STATE; - - data->inControl = JAUS_FALSE; - data->requestControl = JAUS_FALSE; - - addr->subsystem = 0; - addr->node = 0; - addr->instance = 0; - addr->component = JAUS_GLOBAL_POSE_SENSOR; - data->gposSc = ojCmptEstablishSc( cmpt, - JAUS_REPORT_GLOBAL_POSE, - WD_INC_SC_PRESENCE_VECTOR, - addr, - WD_INC_SC_UPDATE_RATE_HZ, - WD_INC_SC_TIMEOUT_SEC, - WD_INC_SC_QUEUE_SIZE); - addr->component = JAUS_VELOCITY_STATE_SENSOR; - data->vssSc = ojCmptEstablishSc( cmpt, - JAUS_REPORT_VELOCITY_STATE, - WD_INC_SC_PRESENCE_VECTOR, - addr, - WD_INC_SC_UPDATE_RATE_HZ, - WD_INC_SC_TIMEOUT_SEC, - WD_INC_SC_QUEUE_SIZE); - addr->component = JAUS_PRIMITIVE_DRIVER; - data->pdWrenchSc = ojCmptEstablishSc( cmpt, - JAUS_REPORT_WRENCH_EFFORT, - WD_INC_SC_PRESENCE_VECTOR, - addr, - WD_INC_SC_UPDATE_RATE_HZ, - WD_INC_SC_TIMEOUT_SEC, - WD_INC_SC_QUEUE_SIZE); - data->pdStatusSc = ojCmptEstablishSc( cmpt, - JAUS_REPORT_COMPONENT_STATUS, - WD_INC_SC_PRESENCE_VECTOR, - addr, - WD_INC_SC_UPDATE_RATE_HZ, - WD_INC_SC_TIMEOUT_SEC, - WD_INC_SC_QUEUE_SIZE); - jausAddressDestroy(addr); - - data->waypoints = jausArrayCreate(); - data->vehicleState = vehicleStateCreate(); - data->waypointDistance = 0; - data->currentWaypoint = 0; - - ojCmptSetUserData(cmpt, (void *)data); - - if(ojCmptRun(cmpt)) - { - ojCmptDestroy(cmpt); - return NULL; - } - - return cmpt; -} - -void wdDestroy(OjCmpt wd) -{ - ReleaseComponentControlMessage releaseControl = NULL; - JausMessage txMessage; - JausAddress address; - WdData *data; - - data = (WdData*)ojCmptGetUserData(wd); - - if(ojCmptIsIncomingScActive(wd, data->gposSc)) - { - ojCmptTerminateSc(wd, data->gposSc); - } - if(ojCmptIsIncomingScActive(wd, data->vssSc)) - { - ojCmptTerminateSc(wd, data->vssSc); - } - if(ojCmptIsIncomingScActive(wd, data->pdWrenchSc)) - { - ojCmptTerminateSc(wd, data->pdWrenchSc); - } - if(ojCmptIsIncomingScActive(wd, data->pdStatusSc)) - { - ojCmptTerminateSc(wd, data->pdStatusSc); - } - - if(data->inControl) - { - releaseControl = releaseComponentControlMessageCreate(); - address = ojCmptGetAddress(wd); - jausAddressCopy(releaseControl->source, address); - jausAddressDestroy(address); - jausAddressCopy(releaseControl->destination, data->pdAddress); - - txMessage = releaseComponentControlMessageToJausMessage(releaseControl); - ojCmptSendMessage(wd, txMessage); - jausMessageDestroy(txMessage); - - releaseComponentControlMessageDestroy(releaseControl); - } - - ojCmptDestroy(wd); - - // Destory Global Messages - if(data->setSpeed) - { - setTravelSpeedMessageDestroy(data->setSpeed); - } - if(data->reportGpos) - { - reportGlobalPoseMessageDestroy(data->reportGpos); - } - if(data->reportVss) - { - reportVelocityStateMessageDestroy(data->reportVss); - } - if(data->reportWrench) - { - reportWrenchEffortMessageDestroy(data->reportWrench); - } - jausArrayDestroy(data->waypoints, (void *)setGlobalWaypointMessageDestroy); - setWrenchEffortMessageDestroy(data->setWrench); - jausAddressDestroy(data->pdAddress); - vehicleStateDestroy(data->vehicleState); - free(data); -} - -ReportWrenchEffortMessage wdGetReportedWrench(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - if(ojCmptIsIncomingScActive(wd, data->pdWrenchSc)) - { - return data->reportWrench; - } - else - { - return NULL; - } -} - -SetWrenchEffortMessage wdGetCommandedWrench(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return data->setWrench; -} - -ReportVelocityStateMessage wdGetVss(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return data->reportVss; -} - -ReportGlobalPoseMessage wdGetGpos(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return data->reportGpos; -} - -SetTravelSpeedMessage wdGetTravelSpeed(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return data->setSpeed; -} - -SetGlobalWaypointMessage wdGetGlobalWaypoint(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - if(data->currentWaypoint < data->waypoints->elementCount) - { - return (SetGlobalWaypointMessage) data->waypoints->elementData[data->currentWaypoint]; - } - else - { - return NULL; - } -} - -JausState wdGetPdState(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return data->pdState; -} - -JausBoolean wdGetPdWrenchScStatus(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return ojCmptIsIncomingScActive(wd, data->pdWrenchSc); -} - -JausBoolean wdGetPdStatusScStatus(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return ojCmptIsIncomingScActive(wd, data->pdStatusSc); -} - -JausBoolean wdGetVssScStatus(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return ojCmptIsIncomingScActive(wd, data->vssSc); -} - -JausBoolean wdGetGposScStatus(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return ojCmptIsIncomingScActive(wd, data->gposSc); -} - -JausBoolean wdGetInControlStatus(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return data->inControl; -} - -VehicleState wdGetDesiredVehicleState(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return data->vehicleState; -} - -double wdGetWaypointDistanceM(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return data->waypointDistance; -} - -int wdGetActiveWaypoint(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return data->currentWaypoint; -} - -int wdGetWaypointCount(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return data->waypoints->elementCount; -} - -void wdToggleRequestControl(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - data->requestControl = !data->requestControl; -} - -JausBoolean wdGetRequestControl(OjCmpt wd) -{ - WdData *data; - data = (WdData*)ojCmptGetUserData(wd); - - return data->requestControl; -} - -void wdCreateWaypoint(OjCmpt wd) -{ - SetGlobalWaypointMessage setWaypoint = NULL; - JausMessage message = NULL; - - setWaypoint = setGlobalWaypointMessageCreate(); - setWaypoint->latitudeDegrees = 29.001; - setWaypoint->longitudeDegrees = -80.001; - - message = setGlobalWaypointMessageToJausMessage(setWaypoint); - setGlobalWaypointMessageDestroy(setWaypoint); - wdProcessMessage(wd, message); -} - -void wdSetSpeed(OjCmpt wd) -{ - SetTravelSpeedMessage setSpeed = NULL; - JausMessage message = NULL; - - setSpeed = setTravelSpeedMessageCreate(); - setSpeed->speedMps = 4.0; - - message = setTravelSpeedMessageToJausMessage(setSpeed); - setTravelSpeedMessageDestroy(setSpeed); - wdProcessMessage(wd, message); -} - -// Function: wdProcessMessage -// Access: Private -// Description: This function is responsible for handling incoming JAUS messages from the Node Manager. -// Incoming messages are processed according to message type. -void wdProcessMessage(OjCmpt wd, JausMessage message) -{ - JausMessage txMessage; - JausAddress address; - ConfirmComponentControlMessage confirmComponentControl; - RejectComponentControlMessage rejectComponentControl; - ReportComponentStatusMessage reportComponentStatus; - QueryGlobalWaypointMessage queryGlobalWaypointMessage; - ReportGlobalWaypointMessage reportGlobalWaypointMessage; - QueryWaypointCountMessage queryWaypointCountMessage; - ReportWaypointCountMessage reportWaypointCountMessage; - SetTravelSpeedMessage setTravelSpeed; - ReportGlobalPoseMessage reportGpos; - ReportVelocityStateMessage reportVss; - ReportWrenchEffortMessage reportWrench; - SetGlobalWaypointMessage tempGlobalWaypoint; - int i; - WdData *data; - - data = (WdData*)ojCmptGetUserData(wd); - - // This block of code is intended to reject commands from non-controlling components - if(ojCmptHasController(wd) && jausMessageIsRejectableCommand(message) ) - { - address = ojCmptGetControllerAddress(wd); - if(!jausAddressEqual(message->source, address)) - { - //jausAddressToString(message->source, buf); - //cError("pd: Received command message %s from non-controlling component (%s).\n", jausMessageCommandCodeString(message), buf); - jausAddressDestroy(address); - return; - } - jausAddressDestroy(address); - } - - switch(message->commandCode) // Switch the processing algorithm according to the JAUS message type - { - case JAUS_REPORT_COMPONENT_STATUS: - reportComponentStatus = reportComponentStatusMessageFromJausMessage(message); - if(reportComponentStatus) - { - if(jausAddressEqual(reportComponentStatus->source, data->pdAddress)) - { - data->pdState = reportComponentStatus->primaryStatusCode; - } - reportComponentStatusMessageDestroy(reportComponentStatus); - } - break; - - case JAUS_CONFIRM_COMPONENT_CONTROL: - confirmComponentControl = confirmComponentControlMessageFromJausMessage(message); - if(confirmComponentControl) - { - if(jausAddressEqual(confirmComponentControl->source, data->pdAddress)) - { - //cDebug(4,"wd: Confirmed control of PD\n"); - data->inControl = JAUS_TRUE; - } - confirmComponentControlMessageDestroy(confirmComponentControl); - } - break; - - case JAUS_REJECT_COMPONENT_CONTROL: - rejectComponentControl = rejectComponentControlMessageFromJausMessage(message); - if(rejectComponentControl) - { - if(jausAddressEqual(rejectComponentControl->source, data->pdAddress)) - { - //cDebug(4,"wd: Lost control of PD\n"); - data->inControl = JAUS_FALSE; - } - rejectComponentControlMessageDestroy(rejectComponentControl); - } - break; - - case JAUS_SET_TRAVEL_SPEED: - setTravelSpeed = setTravelSpeedMessageFromJausMessage(message); - if(setTravelSpeed) - { - setTravelSpeedMessageDestroy(data->setSpeed); - data->setSpeed = setTravelSpeed; - } - break; - - case JAUS_REPORT_GLOBAL_POSE: - reportGpos = reportGlobalPoseMessageFromJausMessage(message); - if(reportGpos) - { - reportGlobalPoseMessageDestroy(data->reportGpos); - data->reportGpos = reportGpos; - } - - if(data->currentWaypoint < data->waypoints->elementCount) - { - // update waypoint index - tempGlobalWaypoint = (SetGlobalWaypointMessage) data->waypoints->elementData[data->currentWaypoint]; - data->waypointDistance = greatCircleDistance( data->reportGpos->latitudeDegrees * RAD_PER_DEG, - data->reportGpos->longitudeDegrees * RAD_PER_DEG, - tempGlobalWaypoint->latitudeDegrees * RAD_PER_DEG, - tempGlobalWaypoint->longitudeDegrees * RAD_PER_DEG); - - if(data->waypointDistance < WAYPOINT_POP_DISTANCE_M) - { - //cError("wd: popping waypoint: %d\n",currentWaypointIndex); - data->currentWaypoint++; - } - } - break; - - case JAUS_REPORT_VELOCITY_STATE: - reportVss = reportVelocityStateMessageFromJausMessage(message); - if(reportVss) - { - reportVelocityStateMessageDestroy(data->reportVss); - data->reportVss = reportVss; - } - break; - - case JAUS_REPORT_WRENCH_EFFORT: - reportWrench = reportWrenchEffortMessageFromJausMessage(message); - if(reportWrench) - { - reportWrenchEffortMessageDestroy(data->reportWrench); - data->reportWrench = reportWrench; - } - break; - - case JAUS_SET_GLOBAL_WAYPOINT: - tempGlobalWaypoint = setGlobalWaypointMessageFromJausMessage(message); - if(tempGlobalWaypoint) - { - data->setWaypoint = tempGlobalWaypoint; - jausArrayAdd(data->waypoints, tempGlobalWaypoint); - } - break; - - case JAUS_QUERY_GLOBAL_WAYPOINT: - queryGlobalWaypointMessage = queryGlobalWaypointMessageFromJausMessage(message); - // loop thru waypoints to find the one that matches the request - // if there's a match, prepare/send the report, else whine - for(i = 0; i < data->waypoints->elementCount; i++) - { - tempGlobalWaypoint = (SetGlobalWaypointMessage) data->waypoints->elementData[i]; - if(tempGlobalWaypoint->waypointNumber == queryGlobalWaypointMessage->waypointNumber) - { - reportGlobalWaypointMessage = reportGlobalWaypointMessageCreate(); - jausAddressCopy(reportGlobalWaypointMessage->destination, queryGlobalWaypointMessage->source); - address = ojCmptGetAddress(wd); - jausAddressCopy(reportGlobalWaypointMessage->source, address); - jausAddressDestroy(address); - reportGlobalWaypointMessage->presenceVector = NO_PRESENCE_VECTOR; - reportGlobalWaypointMessage->waypointNumber = tempGlobalWaypoint->waypointNumber; - reportGlobalWaypointMessage->latitudeDegrees = tempGlobalWaypoint->latitudeDegrees; - reportGlobalWaypointMessage->longitudeDegrees = tempGlobalWaypoint->longitudeDegrees; - txMessage = reportGlobalWaypointMessageToJausMessage(reportGlobalWaypointMessage); - reportGlobalWaypointMessageDestroy(reportGlobalWaypointMessage); - ojCmptSendMessage(wd, txMessage); - jausMessageDestroy(txMessage); - } - } - queryGlobalWaypointMessageDestroy(queryGlobalWaypointMessage); - break; - - case JAUS_QUERY_WAYPOINT_COUNT: - queryWaypointCountMessage = queryWaypointCountMessageFromJausMessage(message); - if(!queryWaypointCountMessage) - { - //cError("wd: Error unpacking %s message.\n", jausMessageCommandCodeString(message)); - } - reportWaypointCountMessage = reportWaypointCountMessageCreate(); - jausAddressCopy(reportWaypointCountMessage->destination, queryWaypointCountMessage->source); - address = ojCmptGetAddress(wd); - jausAddressCopy(reportWaypointCountMessage->source, address); - jausAddressDestroy(address); - reportWaypointCountMessage->waypointCount = data->waypoints->elementCount; - txMessage = reportWaypointCountMessageToJausMessage(reportWaypointCountMessage); - reportWaypointCountMessageDestroy(reportWaypointCountMessage); - ojCmptSendMessage(wd, txMessage); - queryWaypointCountMessageDestroy(queryWaypointCountMessage); - break; - - default: - ojCmptDefaultMessageProcessor(wd, message); - break; - } -} - -void wdInitState(OjCmpt wd) -{ - WdData *data; - - data = (WdData*)ojCmptGetUserData(wd); - - if(data->pdAddress->node == 0) - { - if(ojCmptLookupAddress(wd, data->pdAddress)) - { - jausAddressCopy(data->setWrench->destination, data->pdAddress); - } - } - - wdManagePdControl(wd); - - // Check for critcal service connections or conditions here - if( ojCmptIsIncomingScActive(wd, data->gposSc) && - ojCmptIsIncomingScActive(wd, data->vssSc) && - ojCmptIsIncomingScActive(wd, data->pdWrenchSc) && - ojCmptIsIncomingScActive(wd, data->pdStatusSc) && - data->inControl) - { - // Transition to Standby - ojCmptSetState(wd, JAUS_STANDBY_STATE); - //cDebug(4, "wd: Switching to STANDBY State\n"); - } -} - -void wdStandbyState(OjCmpt wd) -{ - WdData *data; - - data = (WdData*)ojCmptGetUserData(wd); - - if( !ojCmptIsIncomingScActive(wd, data->gposSc) || - !ojCmptIsIncomingScActive(wd, data->vssSc) || - !ojCmptIsIncomingScActive(wd, data->pdWrenchSc) || - !ojCmptIsIncomingScActive(wd, data->pdStatusSc) || - !data->inControl) - { - ojCmptSetState(wd, JAUS_INITIALIZE_STATE); - return; - } - - wdManagePdControl(wd); - - // Setup Vehicle State - data->vehicleState->desiredSpeedMps = 0; - data->vehicleState->desiredPhiEffort = 0; - wdExcecuteControl(wd, data->vehicleState); - - if(data->pdState == JAUS_READY_STATE) - { - ojCmptSetState(wd, JAUS_READY_STATE); - } -} - -void wdReadyState(OjCmpt wd) -{ - SetGlobalWaypointMessage tempGlobalWaypoint; - double waypointHeading = 0; - double headingDelta = 0; - WdData *data; - - data = (WdData*)ojCmptGetUserData(wd); - - if( !ojCmptIsIncomingScActive(wd, data->gposSc) || - !ojCmptIsIncomingScActive(wd, data->vssSc) || - !ojCmptIsIncomingScActive(wd, data->pdWrenchSc) || - !ojCmptIsIncomingScActive(wd, data->pdStatusSc) || - !data->inControl) - { - ojCmptSetState(wd, JAUS_INITIALIZE_STATE); - return; - } - - if(data->pdState != JAUS_READY_STATE) - { - ojCmptSetState(wd, JAUS_STANDBY_STATE); - return; - } - - wdManagePdControl(wd); - - data->vehicleState->speedMps = data->reportVss? (float)data->reportVss->velocityXMps : 0.0f; - - if(data->currentWaypoint < data->waypoints->elementCount) - { - tempGlobalWaypoint = (SetGlobalWaypointMessage) data->waypoints->elementData[data->currentWaypoint]; - - data->waypointDistance = greatCircleDistance( data->reportGpos->latitudeDegrees * RAD_PER_DEG, - data->reportGpos->longitudeDegrees * RAD_PER_DEG, - tempGlobalWaypoint->latitudeDegrees * RAD_PER_DEG, - tempGlobalWaypoint->longitudeDegrees * RAD_PER_DEG); - waypointHeading = greatCircleCourse(data->reportGpos->latitudeDegrees * RAD_PER_DEG, - data->reportGpos->longitudeDegrees * RAD_PER_DEG, - tempGlobalWaypoint->latitudeDegrees * RAD_PER_DEG, - tempGlobalWaypoint->longitudeDegrees * RAD_PER_DEG); - headingDelta = wdAngleSubtract(waypointHeading, data->reportGpos->yawRadians); - - data->vehicleState->desiredPhiEffort = (float)(WHEEL_ROTATION_EFFORT_PER_RAD * headingDelta); - data->vehicleState->desiredSpeedMps = data->setSpeed? (float)data->setSpeed->speedMps : 0.0f; - //cLog("HeadingDelta: %7.2f\n", headingDelta); - //cLog("vehicleState->desiredPhiEffort: %7.2f\n", data->vehicleState->desiredPhiEffort); - } - else - { - //hang out - data->vehicleState->desiredSpeedMps = 0; - data->vehicleState->desiredPhiEffort = 0; - } - - wdExcecuteControl(wd, data->vehicleState); -} - -void wdManagePdControl(OjCmpt wd) -{ - JausAddress address; - JausMessage message = NULL; - ReleaseComponentControlMessage releaseControl = NULL; - RequestComponentControlMessage requestControl = NULL; - WdData *data; - - data = (WdData*)ojCmptGetUserData(wd); - - // Check Control - if(data->requestControl) - { - if(!data->inControl && data->pdAddress->node) - { - //jausAddressToString(pd->address, buf); - //cDebug(4, "wd: Requesting control of PD %s\n", buf); - - requestControl = requestComponentControlMessageCreate(); - address = ojCmptGetAddress(wd); - jausAddressCopy(requestControl->source, address); - jausAddressDestroy(address); - jausAddressCopy(requestControl->destination, data->pdAddress); - requestControl->authorityCode = ojCmptGetAuthority(wd); - - message = requestComponentControlMessageToJausMessage(requestControl); - ojCmptSendMessage(wd, message); - jausMessageDestroy(message); - - requestComponentControlMessageDestroy(requestControl); - } - } - else - { - if(data->inControl) - { - // Release Control - releaseControl = releaseComponentControlMessageCreate(); - address = ojCmptGetAddress(wd); - jausAddressCopy(releaseControl->source, address); - jausAddressDestroy(address); - jausAddressCopy(releaseControl->destination, data->pdAddress); - - message = releaseComponentControlMessageToJausMessage(releaseControl); - ojCmptSendMessage(wd, message); - jausMessageDestroy(message); - - releaseComponentControlMessageDestroy(releaseControl); - - data->inControl = JAUS_FALSE; - } - } -} - -void wdExcecuteControl(OjCmpt wd, VehicleState vehicleState) -{ - static double speedCommand = 0; - static double prevSpeedError = 0; - static double dampedSpeedErrorDerivative = 0; - static double acceleration = ACCELERATION_MPSPS; //Mpsps - static double decceleration = DECCELERATION_MPSPS; //Mpsps - static double lastExcecuteTime = -1; - static double dt; - static double linearEffortInt = 0.0; - double linearEffort; - double speedError; - JausMessage txMessage; - WdData *data; - - data = (WdData*)ojCmptGetUserData(wd); - - if(lastExcecuteTime < 0) - { - lastExcecuteTime = ojGetTimeSec(); - dt = 1.0 / WD_THREAD_DESIRED_RATE_HZ; - } - else - { - dt = ojGetTimeSec() - lastExcecuteTime; - lastExcecuteTime = ojGetTimeSec(); - } - - if(speedCommand < vehicleState->desiredSpeedMps) - { - speedCommand += acceleration * dt; - if(speedCommand > vehicleState->desiredSpeedMps) - { - speedCommand = vehicleState->desiredSpeedMps; - } - } - else - { - speedCommand -= decceleration * dt; - if(speedCommand < vehicleState->desiredSpeedMps) - { - speedCommand = vehicleState->desiredSpeedMps; - } - } - - speedError = speedCommand - vehicleState->speedMps; - - linearEffortInt += speedError * dt; - if(linearEffortInt > LINEAR_EFFORT_I_LIM) - { - linearEffortInt = LINEAR_EFFORT_I_LIM; - } - if(linearEffortInt < -LINEAR_EFFORT_I_LIM) - { - linearEffortInt = -LINEAR_EFFORT_I_LIM; - } - - if(dt > 0.001) - { - dampedSpeedErrorDerivative = 0.9 * dampedSpeedErrorDerivative + 0.1 * (speedError - prevSpeedError) / dt; - prevSpeedError = speedError; - } - - linearEffort = LINEAR_EFFORT_K_FF * speedCommand + LINEAR_EFFORT_BIAS_FF; - linearEffort += LINEAR_EFFORT_K_P * speedError; - linearEffort += LINEAR_EFFORT_K_I * linearEffortInt; - linearEffort += LINEAR_EFFORT_K_D * dampedSpeedErrorDerivative; - - // Pitch feed forward - //linearEffort += PITCH_FF_EFFORT_PER_RAD * sin(wdDampedPitchRad); // Pitch feed forward effort - - // Steering feed forward - if(data->reportWrench) - { - linearEffort += STEERING_FF_EFFORT * (1.0/cos(data->reportWrench->propulsiveRotationalEffortZPercent * WHEEL_ROTATION_RAD_PER_EFFORT) - 1.0); - } - - // Sticktion feed forward - if(speedCommand < WD_DEFAULT_MIN_SPEED_MPS) - { - linearEffort += STICKTION_EFFORT; - } - - if(linearEffort > 0) - { - data->setWrench->propulsiveLinearEffortXPercent = THROTTLE_K * linearEffort; - data->setWrench->resistiveLinearEffortXPercent = 0; - } - else - { - data->setWrench->propulsiveLinearEffortXPercent = 0; - data->setWrench->resistiveLinearEffortXPercent = BRAKE_K * linearEffort; - } - - if(data->setWrench->propulsiveLinearEffortXPercent > 100.0) - { - data->setWrench->propulsiveLinearEffortXPercent = 100.0; - } - if(data->setWrench->propulsiveLinearEffortXPercent < 0.0) - { - data->setWrench->propulsiveLinearEffortXPercent = 0.0; - } - - if(data->setWrench->resistiveLinearEffortXPercent > 100.0) - { - data->setWrench->resistiveLinearEffortXPercent = 100.0; - } - if(data->setWrench->resistiveLinearEffortXPercent < 0.0) - { - data->setWrench->resistiveLinearEffortXPercent = 0.0; - } - - data->setWrench->propulsiveRotationalEffortZPercent = vehicleState->desiredPhiEffort; - - if(data->setWrench->propulsiveRotationalEffortZPercent > 100.0) - { - data->setWrench->propulsiveRotationalEffortZPercent = 100.0; - } - if(data->setWrench->propulsiveRotationalEffortZPercent < -100.0) - { - data->setWrench->propulsiveRotationalEffortZPercent = -100.0; - } - - jausAddressCopy(data->setWrench->destination, data->pdAddress); - - txMessage = setWrenchEffortMessageToJausMessage(data->setWrench); - ojCmptSendMessage(wd, txMessage); - jausMessageDestroy(txMessage); -} - -// Function calculates angle a minus angle b -double wdAngleSubtract(double a, double b) -{ - return atan2(sin(a-b), cos(a-b)); -} diff --git a/lib/opmapcontrol/opmapcontrol.h b/lib/opmapcontrol/opmapcontrol.h deleted file mode 100644 index 4add132fde1d938efb7b8a2854b4b9ea263722d3..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/opmapcontrol.h +++ /dev/null @@ -1 +0,0 @@ -#include "src/mapwidget/opmapwidget.h" diff --git a/lib/opmapcontrol/opmapcontrol.pri b/lib/opmapcontrol/opmapcontrol.pri deleted file mode 100644 index 685899169e29392a5e7c93ff084f72f564a4dc38..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/opmapcontrol.pri +++ /dev/null @@ -1,103 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Sa. Mrz 19 17:12:54 2011 -###################################################################### - -DEPENDPATH += src/core src/internals src/mapwidget src/internals/projections -INCLUDEPATH += src/core src/internals src/internals/projections src/mapwidget - -# Input -HEADERS += opmapcontrol.h \ - src/core/accessmode.h \ - src/core/alllayersoftype.h \ - src/core/cache.h \ - src/core/cacheitemqueue.h \ - src/core/debugheader.h \ - src/core/diagnostics.h \ - src/core/geodecoderstatus.h \ - src/core/kibertilecache.h \ - src/core/languagetype.h \ - src/core/maptype.h \ - src/core/memorycache.h \ - src/core/opmaps.h \ - src/core/placemark.h \ - src/core/point.h \ - src/core/providerstrings.h \ - src/core/pureimage.h \ - src/core/pureimagecache.h \ - src/core/rawtile.h \ - src/core/size.h \ - src/core/tilecachequeue.h \ - src/core/urlfactory.h \ - src/internals/copyrightstrings.h \ - src/internals/core.h \ - src/internals/debugheader.h \ - src/internals/loadtask.h \ - src/internals/mousewheelzoomtype.h \ - src/internals/pointlatlng.h \ - src/internals/pureprojection.h \ - src/internals/rectangle.h \ - src/internals/rectlatlng.h \ - src/internals/sizelatlng.h \ - src/internals/tile.h \ - src/internals/tilematrix.h \ - src/mapwidget/configuration.h \ - src/mapwidget/gpsitem.h \ - src/mapwidget/homeitem.h \ - src/mapwidget/mapgraphicitem.h \ - src/mapwidget/mapripform.h \ - src/mapwidget/mapripper.h \ - src/mapwidget/opmapwidget.h \ - src/mapwidget/trailitem.h \ - src/mapwidget/uavitem.h \ - src/mapwidget/uavmapfollowtype.h \ - src/mapwidget/uavtrailtype.h \ - src/mapwidget/waypointitem.h \ - src/internals/projections/lks94projection.h \ - src/internals/projections/mercatorprojection.h \ - src/internals/projections/mercatorprojectionyandex.h \ - src/internals/projections/platecarreeprojection.h \ - src/internals/projections/platecarreeprojectionpergo.h -FORMS += src/mapwidget/mapripform.ui -SOURCES += src/core/alllayersoftype.cpp \ - src/core/cache.cpp \ - src/core/cacheitemqueue.cpp \ - src/core/diagnostics.cpp \ - src/core/kibertilecache.cpp \ - src/core/languagetype.cpp \ - src/core/memorycache.cpp \ - src/core/opmaps.cpp \ - src/core/placemark.cpp \ - src/core/point.cpp \ - src/core/providerstrings.cpp \ - src/core/pureimage.cpp \ - src/core/pureimagecache.cpp \ - src/core/rawtile.cpp \ - src/core/size.cpp \ - src/core/tilecachequeue.cpp \ - src/core/urlfactory.cpp \ - src/internals/core.cpp \ - src/internals/loadtask.cpp \ - src/internals/MouseWheelZoomType.cpp \ - src/internals/pointlatlng.cpp \ - src/internals/pureprojection.cpp \ - src/internals/rectangle.cpp \ - src/internals/rectlatlng.cpp \ - src/internals/sizelatlng.cpp \ - src/internals/tile.cpp \ - src/internals/tilematrix.cpp \ - src/mapwidget/configuration.cpp \ - src/mapwidget/gpsitem.cpp \ - src/mapwidget/homeitem.cpp \ - src/mapwidget/mapgraphicitem.cpp \ - src/mapwidget/mapripform.cpp \ - src/mapwidget/mapripper.cpp \ - src/mapwidget/opmapwidget.cpp \ - src/mapwidget/trailitem.cpp \ - src/mapwidget/uavitem.cpp \ - src/mapwidget/waypointitem.cpp \ - src/internals/projections/lks94projection.cpp \ - src/internals/projections/mercatorprojection.cpp \ - src/internals/projections/mercatorprojectionyandex.cpp \ - src/internals/projections/platecarreeprojection.cpp \ - src/internals/projections/platecarreeprojectionpergo.cpp -RESOURCES += src/mapwidget/mapresources.qrc diff --git a/lib/opmapcontrol/src/common.pri b/lib/opmapcontrol/src/common.pri deleted file mode 100644 index fa9b16603f16b8df35f7369edef0885e1c5d9bb9..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/common.pri +++ /dev/null @@ -1,8 +0,0 @@ -DESTDIR = ../build -QT += network -QT += sql -CONFIG += staticlib -TEMPLATE = lib -UI_DIR = uics -MOC_DIR = mocs -OBJECTS_DIR = objs diff --git a/lib/opmapcontrol/src/core/accessmode.h b/lib/opmapcontrol/src/core/accessmode.h deleted file mode 100644 index d152936f2851ff7623170f8735716f4673bbf643..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/accessmode.h +++ /dev/null @@ -1,86 +0,0 @@ -/** -****************************************************************************** -* -* @file accessmode.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef ACCESSMODE_H -#define ACCESSMODE_H - -#include "debugheader.h" -#include -#include -#include -#include -namespace core { - class AccessMode:public QObject - { - Q_OBJECT - Q_ENUMS(Types) - public: - enum Types - { - /// - /// access only server - /// - ServerOnly, - - /// - /// access first server and caches localy - /// - ServerAndCache, - - /// - /// access only cache - /// - CacheOnly - }; - static QString StrByType(Types const& value) - { - QMetaObject metaObject = AccessMode().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - QString s=metaEnum.valueToKey(value); - return s; - } - static Types TypeByStr(QString const& value) - { - QMetaObject metaObject = AccessMode().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - Types s=(Types)metaEnum.keyToValue(value.toLatin1()); - return s; - } - static QStringList TypesList() - { - QStringList ret; - QMetaObject metaObject = AccessMode().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - for(int x=0;x AllLayersOfType::GetAllLayersOfType(const MapType::Types &type) - { - QVector types; - { - switch(type) - { - case MapType::GoogleHybrid: - { - - types.append(MapType::GoogleSatellite); - types.append(MapType::GoogleLabels); - } - break; - - case MapType::GoogleHybridChina: - { - types.append(MapType::GoogleSatelliteChina); - types.append(MapType::GoogleLabelsChina); - } - break; - - case MapType::GoogleHybridKorea: - { - types.append(MapType::GoogleSatelliteKorea); - types.append(MapType::GoogleLabelsKorea); - } - break; - - case MapType::YahooHybrid: - { - types.append(MapType::YahooSatellite); - types.append(MapType::YahooLabels); - } - break; - - case MapType::ArcGIS_MapsLT_Map_Hybrid: - { - types.append(MapType::ArcGIS_MapsLT_OrtoFoto); - types.append(MapType::ArcGIS_MapsLT_Map_Labels); - } - break; - - default: - { - types.append(type); - } - break; - } - } - - return types; - - } -} diff --git a/lib/opmapcontrol/src/core/alllayersoftype.h b/lib/opmapcontrol/src/core/alllayersoftype.h deleted file mode 100644 index 94f7442b5e30d606d07cc6391111f7d9fb5c4646..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/alllayersoftype.h +++ /dev/null @@ -1,43 +0,0 @@ -/** -****************************************************************************** -* -* @file alllayersoftype.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef ALLLAYERSOFTYPE_H -#define ALLLAYERSOFTYPE_H - -#include "maptype.h" -#include -#include - -namespace core { - class AllLayersOfType - { - public: - AllLayersOfType(); - QVector GetAllLayersOfType(const MapType::Types &type); - }; - -} -#endif // ALLLAYERSOFTYPE_H diff --git a/lib/opmapcontrol/src/core/cache.cpp b/lib/opmapcontrol/src/core/cache.cpp deleted file mode 100644 index 302ef802f64138a41794628404b4a4c1ced2b0ba..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/cache.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/** -****************************************************************************** -* -* @file cache.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "cache.h" - - -namespace core { - Cache* Cache::m_pInstance=0; - - Cache* Cache::Instance() - { - if(!m_pInstance) - m_pInstance=new Cache; - return m_pInstance; - } - - void Cache::setCacheLocation(const QString& value) - { - cache=value; - routeCache = cache + "RouteCache" + QDir::separator(); - geoCache = cache + "GeocoderCache"+ QDir::separator(); - placemarkCache = cache + "PlacemarkCache" + QDir::separator(); - ImageCache.setGtileCache(value); - } - QString Cache::CacheLocation() - { - return cache; - } - Cache::Cache() - { - if(cache.isNull()|cache.isEmpty()) - { - cache=QDir::currentPath()+QDir::separator()+"mapscache"+QDir::separator(); - setCacheLocation(cache); - } - } - QString Cache::GetGeocoderFromCache(const QString &urlEnd) - { -#ifdef DEBUG_GetGeocoderFromCache - qDebug()<<"Entered GetGeocoderFromCache"; -#endif - QString ret=QString::null; - QString filename=geoCache+QString(urlEnd)+".geo"; -#ifdef DEBUG_GetGeocoderFromCache - qDebug()<<"GetGeocoderFromCache: Does file exist?:"<>ret; - } - } -#ifdef DEBUG_GetGeocoderFromCache - qDebug()<<"GetGeocoderFromCache:Returning:"<>ret; - } - } -#ifdef DEBUG_CACHE - qDebug()<<"GetPlacemarkFromCache:Returning:"< - - - -namespace core { - class CacheItemQueue - { - public: - CacheItemQueue(const MapType::Types &Type,const core::Point &Pos,const QByteArray &Img,const int &Zoom); - CacheItemQueue(){}; - CacheItemQueue(const CacheItemQueue &cSource) - { - img=cSource.img; - pos=cSource.pos; - type=cSource.type; - zoom=cSource.zoom; - } - CacheItemQueue& operator= (const CacheItemQueue &cSource); - bool operator== (const CacheItemQueue &cSource); - void SetMapType(const MapType::Types &value); - void SetPosition(const core::Point &value); - void SetImg(const QByteArray &value); - MapType::Types GetMapType(); - core::Point GetPosition(); - QByteArray GetImg(); - int GetZoom(){return zoom;}; - void SetZoom(const int &value) {zoom=value;}; - private: - - - MapType::Types type; - core::Point pos; - QByteArray img; - int zoom; - }; - -} -#endif // CACHEITEMQUEUE_H diff --git a/lib/opmapcontrol/src/core/core.pro b/lib/opmapcontrol/src/core/core.pro deleted file mode 100644 index 9c355e3ca4985cad7ca6d85f25a5b03fb8e38083..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/core.pro +++ /dev/null @@ -1,40 +0,0 @@ -include (../common.pri) - -SOURCES += opmaps.cpp \ - pureimagecache.cpp \ - pureimage.cpp \ - rawtile.cpp \ - memorycache.cpp \ - cache.cpp \ - languagetype.cpp \ - providerstrings.cpp \ - cacheitemqueue.cpp \ - tilecachequeue.cpp \ - alllayersoftype.cpp \ - urlfactory.cpp \ - placemark.cpp \ - point.cpp \ - size.cpp \ - kibertilecache.cpp \ - diagnostics.cpp -HEADERS += opmaps.h \ - size.h \ - maptype.h \ - pureimagecache.h \ - pureimage.h \ - rawtile.h \ - memorycache.h \ - cache.h \ - accessmode.h \ - languagetype.h \ - providerstrings.h \ - cacheitemqueue.h \ - tilecachequeue.h \ - alllayersoftype.h \ - urlfactory.h \ - geodecoderstatus.h \ - placemark.h \ - point.h \ - kibertilecache.h \ - debugheader.h \ - diagnostics.h diff --git a/lib/opmapcontrol/src/core/debugheader.h b/lib/opmapcontrol/src/core/debugheader.h deleted file mode 100644 index 0e1f73195afeb7a4d949be837805c5c08704a74a..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/debugheader.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef DEBUGHEADER_H -#define DEBUGHEADER_H - -//#define DEBUG_MEMORY_CACHE -//#define DEBUG_CACHE -//#define DEBUG_GMAPS -//#define DEBUG_PUREIMAGECACHE -//#define DEBUG_TILECACHEQUEUE -//#define DEBUG_URLFACTORY -//#define DEBUG_MEMORY_CACHE -//#define DEBUG_GetGeocoderFromCache - -#endif // DEBUGHEADER_H diff --git a/lib/opmapcontrol/src/core/diagnostics.cpp b/lib/opmapcontrol/src/core/diagnostics.cpp deleted file mode 100644 index 33bbbcc586127f71e11571c52e95c8ece8424e54..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/diagnostics.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/** -****************************************************************************** -* -* @file diagnostics.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "diagnostics.h" - -diagnostics::diagnostics():networkerrors(0),emptytiles(0),timeouts(0),runningThreads(0),tilesFromMem(0),tilesFromNet(0),tilesFromDB(0) -{ -} diff --git a/lib/opmapcontrol/src/core/diagnostics.h b/lib/opmapcontrol/src/core/diagnostics.h deleted file mode 100644 index 113faef19d65fd534ca21c01dd3c598a73006ce0..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/diagnostics.h +++ /dev/null @@ -1,47 +0,0 @@ -/** -****************************************************************************** -* -* @file diagnostics.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef DIAGNOSTICS_H -#define DIAGNOSTICS_H -#include -struct diagnostics -{ - diagnostics(); - int networkerrors; - int emptytiles; - int timeouts; - int runningThreads; - int tilesFromMem; - int tilesFromNet; - int tilesFromDB; - QString toString() - { - return QString("Network errors:%1\nEmpty Tiles:%2\nTimeOuts:%3\nRunningThreads:%4\nTilesFromMem:%5\nTilesFromNet:%6\nTilesFromDB:%7").arg(networkerrors).arg(emptytiles).arg(timeouts).arg(runningThreads).arg(tilesFromMem).arg(tilesFromNet).arg(tilesFromDB); - ; - } -}; - -#endif // DIAGNOSTICS_H diff --git a/lib/opmapcontrol/src/core/geodecoderstatus.h b/lib/opmapcontrol/src/core/geodecoderstatus.h deleted file mode 100644 index 58b653dee433ff513f4a26e39b90bfe41a1f4902..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/geodecoderstatus.h +++ /dev/null @@ -1,131 +0,0 @@ -/** -****************************************************************************** -* -* @file geodecoderstatus.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef GEODECODERSTATUS_H -#define GEODECODERSTATUS_H - -#include -#include -#include -#include -namespace core { - class GeoCoderStatusCode:public QObject - { - Q_OBJECT - Q_ENUMS(Types) - public: - enum Types - { - /// - /// unknow response - /// - Unknow = -1, - - /// - /// No errors occurred; the address was successfully parsed and its geocode has been returned. - /// - G_GEO_SUCCESS=200, - - /// - /// A directions request could not be successfully parsed. - /// For example, the request may have been rejected if it contained more than the maximum number of waypoints allowed. - /// - G_GEO_BAD_REQUEST=400, - - /// - /// A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known. - /// - G_GEO_SERVER_ERROR=500, - - /// - /// The HTTP q parameter was either missing or had no value. - /// For geocoding requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input. - /// - G_GEO_MISSING_QUERY=601, - - /// - /// Synonym for G_GEO_MISSING_QUERY. - /// - G_GEO_MISSING_ADDRESS=601, - - /// - /// No corresponding geographic location could be found for the specified address. - /// This may be due to the fact that the address is relatively new, or it may be incorrect. - /// - G_GEO_UNKNOWN_ADDRESS=602, - - /// - /// The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons. - /// - G_GEO_UNAVAILABLE_ADDRESS=603, - - /// - /// The GDirections object could not compute directions between the points mentioned in the query. - /// This is usually because there is no route available between the two points, or because we do not have data for routing in that region. - /// - G_GEO_UNKNOWN_DIRECTIONS=604, - - /// - /// The given key is either invalid or does not match the domain for which it was given. - /// - G_GEO_BAD_KEY=610, - - /// - /// The given key has gone over the requests limit in the 24 hour period or has submitted too many requests in too short a period of time. - /// If you're sending multiple requests in parallel or in a tight loop, use a timer or pause in your code to make sure you don't send the requests too quickly. - /// - G_GEO_TOO_MANY_QUERIES=620 - - }; - static QString StrByType(Types const& value) - { - QMetaObject metaObject = GeoCoderStatusCode().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - QString s=metaEnum.valueToKey(value); - return s; - } - static Types TypeByStr(QString const& value) - { - QMetaObject metaObject = GeoCoderStatusCode().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - Types s=(Types)metaEnum.keyToValue(value.toLatin1()); - return s; - } - static QStringList TypesList() - { - QStringList ret; - QMetaObject metaObject = GeoCoderStatusCode().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - for(int x=0;xMemoryCacheCapacity()) - { - if(cachequeue.count()>0 && list.count()>0) - { -#ifdef DEBUG_MEMORY_CACHE - qDebug()<<"Cleaning Memory cache="<<" started with "< -#include -#include -#include -#include "debugheader.h" -namespace core { - class KiberTileCache - { - public: - KiberTileCache(); - - void setMemoryCacheCapacity(const int &value); - int MemoryCacheCapacity(); - double MemoryCacheSize(){return memoryCacheSize/1048576.0;} - void RemoveMemoryOverload(); - QReadWriteLock kiberCacheLock; - QHash cachequeue; - QQueue list; - long memoryCacheSize; - private: - int _MemoryCacheCapacity; - - }; - - - -} -#endif // KIBERTILECACHE_H diff --git a/lib/opmapcontrol/src/core/languagetype.cpp b/lib/opmapcontrol/src/core/languagetype.cpp deleted file mode 100644 index 2c4ee2a7c88ef62d1af0c0af7ac8e18ff825566e..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/languagetype.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/** -****************************************************************************** -* -* @file languagetype.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "languagetype.h" - - - -namespace core { - LanguageType::LanguageType() - { - list - <<"ar" - <<"bg" - <<"bn" - <<"ca" - <<"cs" - <<"da" - <<"de" - <<"el" - <<"en" - <<"en-AU" - <<"en-GB" - <<"es" - <<"eu" - <<"fi" - <<"fil" - <<"fr" - <<"gl" - <<"gu" - <<"hi" - <<"hr" - <<"hu" - <<"id" - <<"it" - <<"iw" - <<"ja" - <<"kn" - <<"ko" - <<"lt" - <<"lv" - <<"ml" - <<"mr" - <<"nl" - <<"nn" - <<"no" - <<"or" - <<"pl" - <<"pt" - <<"pt-BR" - <<"pt-PT" - <<"rm" - <<"ro" - <<"ru" - <<"sk" - <<"sl" - <<"sr" - <<"sv" - <<"ta" - <<"te" - <<"th" - <<"tr" - <<"uk" - <<"vi" - <<"zh-CN" - <<"zh-TW"; - - } - QString LanguageType::toShortString(Types type) - { - return list[type]; - } - LanguageType::~LanguageType() - { - list.clear(); - } - -} diff --git a/lib/opmapcontrol/src/core/languagetype.h b/lib/opmapcontrol/src/core/languagetype.h deleted file mode 100644 index 4b8411e452d11fec4d51a984d89f96360d4dbf7d..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/languagetype.h +++ /dev/null @@ -1,133 +0,0 @@ -/** -****************************************************************************** -* -* @file languagetype.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef LANGUAGETYPE_H -#define LANGUAGETYPE_H - -#include -#include -#include -#include - - -namespace core { - class LanguageType:public QObject - { - Q_OBJECT - Q_ENUMS(Types) - public: - enum Types - { - Arabic, - Bulgarian, - Bengali, - Catalan, - Czech, - Danish, - German, - Greek, - English, - EnglishAustralian, - EnglishGreatBritain, - Spanish, - Basque, - Finnish, - Filipino, - French, - Galician, - Gujarati, - Hindi, - Croatian, - Hungarian, - Indonesian, - Italian, - Hebrew, - Japanese, - Kannada, - Korean, - Lithuanian, - Latvian, - Malayalam, - Marathi, - Dutch, - NorwegianNynorsk, - Norwegian, - Oriya, - Polish, - Portuguese, - PortugueseBrazil, - PortuguesePortugal, - Romansch, - Romanian, - Russian, - Slovak, - Slovenian, - Serbian, - Swedish, - Tamil, - Telugu, - Thai, - Turkish, - Ukrainian, - Vietnamese, - ChineseSimplified, - ChineseTraditional - }; - - static QString StrByType(Types const& value) - { - QMetaObject metaObject = LanguageType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - QString s=metaEnum.valueToKey(value); - return s; - } - static Types TypeByStr(QString const& value) - { - QMetaObject metaObject = LanguageType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - Types s=(Types)metaEnum.keyToValue(value.toLatin1()); - return s; - } - static QStringList TypesList() - { - QStringList ret; - QMetaObject metaObject = LanguageType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - for(int x=0;x -#include -#include - -namespace core { - class MapType:public QObject - { - Q_OBJECT - Q_ENUMS(Types) - public: - enum Types - { - GoogleMap=1, - GoogleSatellite=4, - GoogleLabels=8, - GoogleTerrain=16, - GoogleHybrid=20, - - GoogleMapChina=22, - GoogleSatelliteChina=24, - GoogleLabelsChina=26, - GoogleTerrainChina=28, - GoogleHybridChina=29, - - OpenStreetMap=32, - OpenStreetOsm=33, - OpenStreetMapSurfer=34, - OpenStreetMapSurferTerrain=35, - - YahooMap=64, - YahooSatellite=128, - YahooLabels=256, - YahooHybrid=333, - - BingMap=444, - BingSatellite=555, - BingHybrid=666, - - ArcGIS_Map=777, - ArcGIS_Satellite=788, - ArcGIS_ShadedRelief=799, - ArcGIS_Terrain=811, - - // use these numbers to clean up old stuff - //ArcGIS_MapsLT_Map_Old= 877, - //ArcGIS_MapsLT_OrtoFoto_Old = 888, - //ArcGIS_MapsLT_Map_Labels_Old = 890, - //ArcGIS_MapsLT_Map_Hybrid_Old = 899, - //ArcGIS_MapsLT_Map=977, - //ArcGIS_MapsLT_OrtoFoto=988, - //ArcGIS_MapsLT_Map_Labels=990, - //ArcGIS_MapsLT_Map_Hybrid=999, - //ArcGIS_MapsLT_Map=978, - //ArcGIS_MapsLT_OrtoFoto=989, - //ArcGIS_MapsLT_Map_Labels=991, - //ArcGIS_MapsLT_Map_Hybrid=998, - - ArcGIS_MapsLT_Map=1000, - ArcGIS_MapsLT_OrtoFoto=1001, - ArcGIS_MapsLT_Map_Labels=1002, - ArcGIS_MapsLT_Map_Hybrid=1003, - - PergoTurkeyMap = 2001, - SigPacSpainMap = 3001, - - GoogleMapKorea=4001, - GoogleSatelliteKorea=4002, - GoogleLabelsKorea=4003, - GoogleHybridKorea=4005, - - YandexMapRu = 5000 - }; - static QString StrByType(Types const& value) - { - QMetaObject metaObject = MapType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - QString s=metaEnum.valueToKey(value); - return s; - } - static Types TypeByStr(QString const& value) - { - QMetaObject metaObject = MapType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - Types s=(Types)metaEnum.keyToValue(value.toLatin1()); - return s; - } - static QStringList TypesList() - { - QStringList ret; - QMetaObject metaObject = MapType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - for(int x=0;x -#include -#include -#include "kibertilecache.h" -#include -#include "debugheader.h" -namespace core { - class MemoryCache - { - public: - MemoryCache(); - - KiberTileCache TilesInMemory; - QByteArray GetTileFromMemoryCache(const RawTile &tile); - void AddTileToMemoryCache(const RawTile &tile, const QByteArray &pic); - QReadWriteLock kiberCacheLock; - }; - - -} -#endif // MEMORYCACHE_H diff --git a/lib/opmapcontrol/src/core/opmaps.cpp b/lib/opmapcontrol/src/core/opmaps.cpp deleted file mode 100644 index b2db6747d6298cd05bdb84ac1d45088e3d4f825f..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/opmaps.cpp +++ /dev/null @@ -1,286 +0,0 @@ -/** -****************************************************************************** -* -* @file OPMaps.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "opmaps.h" - - -namespace core { - OPMaps* OPMaps::m_pInstance=0; - - OPMaps* OPMaps::Instance() - { - if(!m_pInstance) - m_pInstance=new OPMaps; - return m_pInstance; - } - OPMaps::OPMaps():RetryLoadTile(2),useMemoryCache(true) - { - accessmode=AccessMode::ServerAndCache; - Language=LanguageType::PortuguesePortugal; - LanguageStr=LanguageType().toShortString(Language); - Cache::Instance(); - - } - - - OPMaps::~OPMaps() - { - TileDBcacheQueue.wait(); - } - - - - QByteArray OPMaps::GetImageFrom(const MapType::Types &type,const Point &pos,const int &zoom) - { -#ifdef DEBUG_TIMINGS - QTime time; - time.restart(); -#endif -#ifdef DEBUG_GMAPS - qDebug()<<"Entered GetImageFrom"; -#endif //DEBUG_GMAPS - QByteArray ret; - - if(useMemoryCache) - { -#ifdef DEBUG_GMAPS - qDebug()<<"Try Tile from memory:Size="<ImageCache.GetImageFromCache(type,pos,zoom); - if(!ret.isEmpty()) - { - errorvars.lock(); - ++diag.tilesFromDB; - errorvars.unlock(); -#ifdef DEBUG_GMAPS - qDebug()<<"Tile found in Database"; -#endif //DEBUG_GMAPS - if(useMemoryCache) - { -#ifdef DEBUG_GMAPS - qDebug()<<"Add Tile to memory"; -#endif //DEBUG_GMAPS - AddTileToMemoryCache(RawTile(type,pos,zoom),ret); - } - return ret; - } - } - if(accessmode!=AccessMode::CacheOnly) - { - QEventLoop q; - QNetworkReply *reply; - QNetworkRequest qheader; - QNetworkAccessManager network; - QTimer tT; - tT.setSingleShot(true); - connect(&network, SIGNAL(finished(QNetworkReply*)), - &q, SLOT(quit())); - connect(&tT, SIGNAL(timeout()), &q, SLOT(quit())); - network.setProxy(Proxy); -#ifdef DEBUG_GMAPS - qDebug()<<"Try Tile from the Internet"; -#endif //DEBUG_GMAPS -#ifdef DEBUG_TIMINGS - qDebug()<<"opmaps before make image url"<error()!=QNetworkReply::NoError)) - { - errorvars.lock(); - ++diag.networkerrors; - errorvars.unlock(); - reply->deleteLater(); - return ret; - } - ret=reply->readAll(); - reply->deleteLater();//TODO can't this be global?? - if(ret.isEmpty()) - { -#ifdef DEBUG_GMAPS - qDebug()<<"Invalid Tile"; -#endif //DEBUG_GMAPS - errorvars.lock(); - ++diag.emptytiles; - errorvars.unlock(); - return ret; - } -#ifdef DEBUG_GMAPS - qDebug()<<"Received Tile from the Internet"; -#endif //DEBUG_GMAPS - errorvars.lock(); - ++diag.tilesFromNet; - errorvars.unlock(); - if (useMemoryCache) - { -#ifdef DEBUG_GMAPS - qDebug()<<"Add Tile to memory cache"; -#endif //DEBUG_GMAPS - AddTileToMemoryCache(RawTile(type,pos,zoom),ret); - } - if(accessmode!=AccessMode::ServerOnly) - { -#ifdef DEBUG_GMAPS - qDebug()<<"Add tile to DataBase"; -#endif //DEBUG_GMAPS - CacheItemQueue * item=new CacheItemQueue(type,pos,ret,zoom); - TileDBcacheQueue.EnqueueCacheTask(item); - } - - - } - } -#ifdef DEBUG_GMAPS - qDebug()<<"Entered GetImageFrom"; -#endif //DEBUG_GMAPS - return ret; - } - - bool OPMaps::ExportToGMDB(const QString &file) - { - return Cache::Instance()->ImageCache.ExportMapDataToDB(Cache::Instance()->ImageCache.GtileCache()+QDir::separator()+"Data.qmdb",file); - } - bool OPMaps::ImportFromGMDB(const QString &file) - { - return Cache::Instance()->ImageCache.ExportMapDataToDB(file,Cache::Instance()->ImageCache.GtileCache()+QDir::separator()+"Data.qmdb"); - } - - diagnostics OPMaps::GetDiagnostics() - { - diagnostics i; - errorvars.lock(); - i=diag; - errorvars.unlock(); - return i; - } -} - diff --git a/lib/opmapcontrol/src/core/opmaps.h b/lib/opmapcontrol/src/core/opmaps.h deleted file mode 100644 index f94f3fa06fb707fde6e2ed6a9c68836db435d8bf..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/opmaps.h +++ /dev/null @@ -1,94 +0,0 @@ -/** -****************************************************************************** -* -* @file OPMaps.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef OPMaps_H -#define OPMaps_H - - -#include "debugheader.h" -#include "memorycache.h" -#include "rawtile.h" -#include "cache.h" -#include "accessmode.h" -#include "languagetype.h" -#include "cacheitemqueue.h" -#include "tilecachequeue.h" -#include "pureimagecache.h" -#include "alllayersoftype.h" -#include "urlfactory.h" -#include "diagnostics.h" - -//#include "point.h" - - -namespace core { - class OPMaps: public MemoryCache,public AllLayersOfType,public UrlFactory - { - - - public: - - ~OPMaps(); - - static OPMaps* Instance(); - bool ImportFromGMDB(const QString &file); - bool ExportToGMDB(const QString &file); - /// - /// timeout for map connections - /// - - - QByteArray GetImageFrom(const MapType::Types &type,const core::Point &pos,const int &zoom); - bool UseMemoryCache(){return useMemoryCache;}//TODO - void setUseMemoryCache(const bool& value){useMemoryCache=value;} - void setLanguage(const LanguageType::Types& language){Language=language;}//TODO - LanguageType::Types GetLanguage(){return Language;}//TODO - AccessMode::Types GetAccessMode()const{return accessmode;} - void setAccessMode(const AccessMode::Types& mode){accessmode=mode;} - int RetryLoadTile; - diagnostics GetDiagnostics(); - - private: - bool useMemoryCache; - LanguageType::Types Language; - AccessMode::Types accessmode; - // PureImageCache ImageCacheLocal;//TODO Criar acesso Get Set - TileCacheQueue TileDBcacheQueue; - OPMaps(); - OPMaps(OPMaps const&){} - OPMaps& operator=(OPMaps const&){ return *this; } - static OPMaps* m_pInstance; - diagnostics diag; - QMutex errorvars; - protected: - // MemoryCache TilesInMemory; - - - - }; - -} -#endif // OPMaps_H diff --git a/lib/opmapcontrol/src/core/placemark.cpp b/lib/opmapcontrol/src/core/placemark.cpp deleted file mode 100644 index 1f8971aae3c8655bb0ea38711614db925953ef54..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/placemark.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/** -****************************************************************************** -* -* @file placemark.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "placemark.h" - diff --git a/lib/opmapcontrol/src/core/placemark.h b/lib/opmapcontrol/src/core/placemark.h deleted file mode 100644 index 3f338b3f5673ed838b18d2495c85c2b2cae00b22..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/placemark.h +++ /dev/null @@ -1,54 +0,0 @@ -/** -****************************************************************************** -* -* @file placemark.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef PLACEMARK_H -#define PLACEMARK_H - -#include - - -namespace core { - class Placemark - { - public: - Placemark(const QString &address) - { - this->address = address; - } - QString Address(){return address;} - int Accuracy(){return accuracy;} - void SetAddress(const QString &adr){address=adr;} - void SetAccuracy(const int &value){accuracy=value;} - private: - - QString address; - int accuracy; - protected: - - - }; -} -#endif // PLACEMARK_H diff --git a/lib/opmapcontrol/src/core/point.cpp b/lib/opmapcontrol/src/core/point.cpp deleted file mode 100644 index a8f43ed0ea500dcac251f47e49fc5fcd9227de71..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/point.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/** -****************************************************************************** -* -* @file point.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "point.h" -#include "size.h" - -namespace core { - Point::Point(int dw) - { - this->x=(short)Point::LOWORD(dw); - this->y=(short)Point::HIWORD(dw); - empty=false; - } - Point::Point(Size sz) - { - this->x=sz.Width(); - this->y=sz.Height(); - empty=false; - } - Point::Point(int x, int y) - { - this->x=x; - this->y=y; - empty=false; - } - Point::Point():x(0),y(0),empty(true) - {} - uint qHash(Point const& point) - { - return point.x^point.y; - } - bool operator==(Point const &lhs,Point const &rhs) - { - return (lhs.x==rhs.x && lhs.y==rhs.y); - } - bool operator!=(Point const &lhs,Point const &rhs) - { - return !(lhs==rhs); - } - int Point::HIWORD(int n) - { - return (n >> 16) & 0xffff; - } - - int Point::LOWORD(int n) - { - return n & 0xffff; - } - Point Point::Empty=Point(); - -} diff --git a/lib/opmapcontrol/src/core/point.h b/lib/opmapcontrol/src/core/point.h deleted file mode 100644 index 83d1f079ebb78a6041dd28e1786433ca798431e7..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/point.h +++ /dev/null @@ -1,72 +0,0 @@ -/** -****************************************************************************** -* -* @file point.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef OPOINT_H -#define OPOINT_H - - -#include - -namespace core { - struct Size; - struct Point - { - friend uint qHash(Point const& point); - friend bool operator==(Point const& lhs,Point const& rhs); - friend bool operator!=(Point const& lhs,Point const& rhs); - public: - - Point(); - Point(int x,int y); - Point(Size sz); - Point(int dw); - bool IsEmpty(){return empty;} - int X()const{return this->x;} - int Y()const{return this->y;} - void SetX(const int &value){x=value;empty=false;} - void SetY(const int &value){y=value;empty=false;} - QString ToString()const{return "{"+QString::number(x)+","+QString::number(y)+"}";} - - static Point Empty; - void Offset(const int &dx,const int &dy) - { - x += dx; - y += dy; - } - void Offset(Point p) - { - Offset(p.x, p.y); - } - static int HIWORD(int n); - static int LOWORD(int n); - - private: - int x; - int y; - bool empty; - }; -} -#endif // POINT_H diff --git a/lib/opmapcontrol/src/core/providerstrings.cpp b/lib/opmapcontrol/src/core/providerstrings.cpp deleted file mode 100644 index 8d1f63e30a3b4a8ecfd6876b6f61149c47a0245b..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/providerstrings.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/** -****************************************************************************** -* -* @file providerstrings.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "providerstrings.h" - - -namespace core { - const QString ProviderStrings::levelsForSigPacSpainMap[] = {"0", "1", "2", "3", "4", - "MTNSIGPAC", - "MTN2000", "MTN2000", "MTN2000", "MTN2000", "MTN2000", - "MTN200", "MTN200", "MTN200", - "MTN25", "MTN25", - "ORTOFOTOS","ORTOFOTOS","ORTOFOTOS","ORTOFOTOS"}; - - ProviderStrings::ProviderStrings() - { -// VersionGoogleMap = "m@132"; -// VersionGoogleSatellite = "71"; -// VersionGoogleLabels = "h@132"; -// VersionGoogleTerrain = "t@125,r@132"; - // Google version strings - VersionGoogleMap = "m@132"; - VersionGoogleSatellite = "71"; - VersionGoogleLabels = "h@132"; - VersionGoogleTerrain = "t@125,r@132"; - SecGoogleWord = "Galileo"; - - // Google (China) version strings - VersionGoogleMapChina = "m@132"; - VersionGoogleSatelliteChina = "s@71"; - VersionGoogleLabelsChina = "h@132"; - VersionGoogleTerrainChina = "t@125,r@132"; - - // Google (Korea) version strings - VersionGoogleMapKorea = "kr1.12"; - VersionGoogleSatelliteKorea = "66"; - VersionGoogleLabelsKorea = "kr1t.12"; - - /// - /// Google Maps API generated using http://greatmaps.codeplex.com/ - /// from http://code.google.com/intl/en-us/apis/maps/signup.html - /// - GoogleMapsAPIKey = "ABQIAAAAWaQgWiEBF3lW97ifKnAczhRAzBk5Igf8Z5n2W3hNnMT0j2TikxTLtVIGU7hCLLHMAuAMt-BO5UrEWA"; - - // Yahoo version strings - VersionYahooMap = "4.3"; - VersionYahooSatellite = "1.9"; - VersionYahooLabels = "4.3"; - - // BingMaps - VersionBingMaps = "563"; - - // YandexMap - VersionYandexMap = "2.16.0"; - //VersionYandexSatellite = "1.19.0"; - //////////////////// - - /// - /// Bing Maps Customer Identification, more info here - /// http://msdn.microsoft.com/en-us/library/bb924353.aspx - /// - BingMapsClientToken = ""; - - } -} diff --git a/lib/opmapcontrol/src/core/providerstrings.h b/lib/opmapcontrol/src/core/providerstrings.h deleted file mode 100644 index 8759057b4124aac0f28cb8a4f31734331cd7cc6b..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/providerstrings.h +++ /dev/null @@ -1,85 +0,0 @@ -/** -****************************************************************************** -* -* @file providerstrings.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef PROVIDERSTRINGS_H -#define PROVIDERSTRINGS_H - -#include - - -namespace core { - class ProviderStrings - { - public: - ProviderStrings(); - static const QString levelsForSigPacSpainMap[]; - QString GoogleMapsAPIKey; - // Google version strings - QString VersionGoogleMap; - QString VersionGoogleSatellite; - QString VersionGoogleLabels; - QString VersionGoogleTerrain; - QString SecGoogleWord; - - // Google (China) version strings - QString VersionGoogleMapChina; - QString VersionGoogleSatelliteChina; - QString VersionGoogleLabelsChina; - QString VersionGoogleTerrainChina; - - // Google (Korea) version strings - QString VersionGoogleMapKorea; - QString VersionGoogleSatelliteKorea; - QString VersionGoogleLabelsKorea; - - /// - /// Google Maps API generated using http://greatmaps.codeplex.com/ - /// from http://code.google.com/intl/en-us/apis/maps/signup.html - /// - - - // Yahoo version strings - QString VersionYahooMap; - QString VersionYahooSatellite; - QString VersionYahooLabels; - - // BingMaps - QString VersionBingMaps; - - // YandexMap - QString VersionYandexMap; - - - - /// - /// Bing Maps Customer Identification, more info here - /// http://msdn.microsoft.com/en-us/library/bb924353.aspx - /// - QString BingMapsClientToken; - }; - -} -#endif // PROVIDERSTRINGS_H diff --git a/lib/opmapcontrol/src/core/pureimage.cpp b/lib/opmapcontrol/src/core/pureimage.cpp deleted file mode 100644 index e938db04d44d119f10a3c5a8dcf77b6ae0528482..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/pureimage.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/** -****************************************************************************** -* -* @file pureimage.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "pureimage.h" - - - -namespace core { -PureImageProxy::PureImageProxy() -{ - -} - -QPixmap PureImageProxy::FromStream(const QByteArray &array) -{ - return QPixmap::fromImage(QImage::fromData(array)); -} -bool PureImageProxy::Save(const QByteArray &array, QPixmap &pic) -{ - pic=QPixmap::fromImage(QImage::fromData(array)); - return true; -} -} diff --git a/lib/opmapcontrol/src/core/pureimage.h b/lib/opmapcontrol/src/core/pureimage.h deleted file mode 100644 index 76e1b552ffdac25d24af09fa8799d17f0737a784..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/pureimage.h +++ /dev/null @@ -1,44 +0,0 @@ -/** -****************************************************************************** -* -* @file pureimage.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef PUREIMAGE_H -#define PUREIMAGE_H - -#include -#include - - -namespace core { - class PureImageProxy - { - public: - PureImageProxy(); - static QPixmap FromStream(const QByteArray &array); - static bool Save(const QByteArray &array,QPixmap &pic); - }; - -} -#endif // PUREIMAGE_H diff --git a/lib/opmapcontrol/src/core/pureimagecache.cpp b/lib/opmapcontrol/src/core/pureimagecache.cpp deleted file mode 100644 index 99690a94dcd6d68e805308215b820fdae9afb603..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/pureimagecache.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/** -****************************************************************************** -* -* @file pureimagecache.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "pureimagecache.h" -#include - -//#define DEBUG_PUREIMAGECACHE -namespace core { - qlonglong PureImageCache::ConnCounter=0; - - PureImageCache::PureImageCache() - { - gtilecache=QDir::currentPath()+QDir::separator()+"mapscache"+QDir::separator(); - QDir d; - if(!d.exists(gtilecache)) - { - d.mkdir(gtilecache); -#ifdef DEBUG_PUREIMAGECACHE - qDebug()<<"Create Cache directory"; -#endif //DEBUG_PUREIMAGECACHE - } - { - QString db=gtilecache+"Data.qmdb"; - if(!QFileInfo(db).exists()) - { -#ifdef DEBUG_PUREIMAGECACHE - qDebug()<<"Try to create EmptyDB"; -#endif //DEBUG_PUREIMAGECACHE - CreateEmptyDB(db); - } - } - } - - void PureImageCache::setGtileCache(const QString &value) - { - gtilecache=value; - QDir d; - if(!d.exists(gtilecache)) - { - d.mkdir(gtilecache); -#ifdef DEBUG_PUREIMAGECACHE - qDebug()<<"Create Cache directory"; -#endif //DEBUG_PUREIMAGECACHE - } - { - QString db=gtilecache+"Data.qmdb"; - if(!QFileInfo(db).exists()) - { -#ifdef DEBUG_PUREIMAGECACHE - qDebug()<<"Try to create EmptyDB"; -#endif //DEBUG_PUREIMAGECACHE - CreateEmptyDB(db); - } - } - } - QString PureImageCache::GtileCache() - { - return gtilecache; - } - - - bool PureImageCache::CreateEmptyDB(const QString &file) - { -#ifdef DEBUG_PUREIMAGECACHE - qDebug()<<"Create database at!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!:"< add; - bool ret=true; - QString dir=gtilecache; - { - QString db=dir+"Data.qmdb"; - ret=QFileInfo(db).exists(); - if(ret) - { - QSqlDatabase cn; - Mcounter.lock(); - qlonglong id=++ConnCounter; - Mcounter.unlock(); - cn = QSqlDatabase::addDatabase("QSQLITE",QString::number(id)); - cn.setDatabaseName(db); - cn.setConnectOptions("QSQLITE_ENABLE_SHARED_CACHE"); - if(cn.open()) - { - { - QSqlQuery query(cn); - query.exec(QString("SELECT id, X, Y, Zoom, Type, Date FROM Tiles")); - while(query.next()) - { - if(QDateTime::fromString(query.value(5).toString()).daysTo(QDateTime::currentDateTime())>days) - add.append(query.value(0).toLongLong()); - } - foreach(long i,add) - { - query.exec(QString("DELETE FROM Tiles WHERE id = %1;").arg(i)); - } - } - - cn.close(); - } - QSqlDatabase::removeDatabase(QString::number(id)); - } - } - } - // PureImageCache::ExportMapDataToDB("C:/Users/Xapo/Documents/mapcontrol/debug/mapscache/data.qmdb","C:/Users/Xapo/Documents/mapcontrol/debug/mapscache/data2.qmdb"); - bool PureImageCache::ExportMapDataToDB(QString sourceFile, QString destFile) - { - bool ret=true; - QList add; - if(!QFileInfo(destFile).exists()) - { -#ifdef DEBUG_PUREIMAGECACHE - qDebug()<<"Try to create EmptyDB"; -#endif //DEBUG_PUREIMAGECACHE - ret=CreateEmptyDB(destFile); - } - if(!ret) return false; - QSqlDatabase ca = QSqlDatabase::addDatabase("QSQLITE","ca"); - ca.setDatabaseName(sourceFile); - - if(ca.open()) - { - QSqlDatabase cb = QSqlDatabase::addDatabase("QSQLITE","cb"); - cb.setDatabaseName(destFile); - if(cb.open()) - { - QSqlQuery queryb(cb); - queryb.exec(QString("ATTACH DATABASE \"%1\" AS Source").arg(sourceFile)); - QSqlQuery querya(ca); - querya.exec("SELECT id, X, Y, Zoom, Type, Date FROM Tiles"); - while(querya.next()) - { - long id=querya.value(0).toLongLong(); - queryb.exec(QString("SELECT id FROM Tiles WHERE X=%1 AND Y=%2 AND Zoom=%3 AND Type=%4;").arg(querya.value(1).toLongLong()).arg(querya.value(2).toLongLong()).arg(querya.value(3).toLongLong()).arg(querya.value(4).toLongLong())); - if(!queryb.next()) - { - add.append(id); - } - - } - long f; - foreach(f,add) - { - queryb.exec(QString("INSERT INTO Tiles(X, Y, Zoom, Type, Date) SELECT X, Y, Zoom, Type, Date FROM Source.Tiles WHERE id=%1").arg(f)); - queryb.exec(QString("INSERT INTO TilesData(id, Tile) Values((SELECT last_insert_rowid()), (SELECT Tile FROM Source.TilesData WHERE id=%1))").arg(f)); - } - add.clear(); - ca.close(); - cb.close(); - - } - else return false; - } - else return false; - QSqlDatabase::removeDatabase("ca"); - QSqlDatabase::removeDatabase("cb"); - return true; - - } - -} diff --git a/lib/opmapcontrol/src/core/pureimagecache.h b/lib/opmapcontrol/src/core/pureimagecache.h deleted file mode 100644 index fdc120e3d1e453ffd06e31673d7e663f467e4d62..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/pureimagecache.h +++ /dev/null @@ -1,66 +0,0 @@ -/** -****************************************************************************** -* -* @file pureimagecache.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef PUREIMAGECACHE_H -#define PUREIMAGECACHE_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include "maptype.h" -#include "point.h" -#include -#include "pureimage.h" -#include -#include - -namespace core { - class PureImageCache - { - - public: - PureImageCache(); - static bool CreateEmptyDB(const QString &file); - bool PutImageToCache(const QByteArray &tile,const MapType::Types &type,const core::Point &pos, const int &zoom); - QByteArray GetImageFromCache(MapType::Types type, core::Point pos, int zoom); - QString GtileCache(); - void setGtileCache(const QString &value); - static bool ExportMapDataToDB(QString sourceFile, QString destFile); - void deleteOlderTiles(int const& days); - private: - QString gtilecache; - QMutex Mcounter; - static qlonglong ConnCounter; - - }; - -} -#endif // PUREIMAGECACHE_H diff --git a/lib/opmapcontrol/src/core/rawtile.cpp b/lib/opmapcontrol/src/core/rawtile.cpp deleted file mode 100644 index f357ae50faf67622aefb4f11a4efc61e4b6175e7..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/rawtile.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/** -****************************************************************************** -* -* @file rawtile.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "rawtile.h" - - -namespace core { -RawTile::RawTile(const MapType::Types &Type, const Point &Pos, const int &Zoom) -{ - zoom=Zoom; - type=Type; - pos=Pos; -} -QString RawTile::ToString() -{ - return QString("%1 at zoom %2, pos:%3,%4").arg(type).arg(zoom).arg(pos.X()).arg(pos.Y()); -} -Point RawTile::Pos() -{ - return pos; -} -MapType::Types RawTile::Type() -{ - return type; -} -int RawTile::Zoom() -{ - return zoom; -} -void RawTile::setType(const MapType::Types &value) -{ - type=value; -} -void RawTile::setPos(const Point &value) -{ - pos=value; -} -void RawTile::setZoom(const int &value) -{ - zoom=value; -} -uint qHash(RawTile const& tile) -{ - // RawTile tile=tilee; - quint64 tmp=(((quint64)(tile.zoom))<<54)+(((quint64)(tile.type))<<36)+(((quint64)(tile.pos.X()))<<18)+(((quint64)(tile.pos.Y()))); - // quint64 tmp5=tmp+tmp2+tmp3+tmp4; - return ::qHash(tmp); -} -bool operator==(RawTile const &lhs,RawTile const &rhs) -{ - return (lhs.pos==rhs.pos && lhs.zoom==rhs.zoom && lhs.type==rhs.type); -} -} diff --git a/lib/opmapcontrol/src/core/rawtile.h b/lib/opmapcontrol/src/core/rawtile.h deleted file mode 100644 index 7b3901f6f699e580e58826daf6384bcb69096448..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/rawtile.h +++ /dev/null @@ -1,56 +0,0 @@ -/** -****************************************************************************** -* -* @file rawtile.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef RAWTILE_H -#define RAWTILE_H - -#include "maptype.h" -#include "point.h" -#include -#include - -namespace core { - class RawTile - { - friend uint qHash(RawTile const& tile); - friend bool operator==(RawTile const& lhs,RawTile const& rhs); - - public: - RawTile(const MapType::Types &Type,const core::Point &Pos,const int &Zoom); - QString ToString(void); - MapType::Types Type(); - core::Point Pos(); - int Zoom(); - void setType(const MapType::Types &value); - void setPos(const core::Point &value); - void setZoom(const int &value); - private: - MapType::Types type; - core::Point pos; - int zoom; - }; -} -#endif // RAWTILE_H diff --git a/lib/opmapcontrol/src/core/size.cpp b/lib/opmapcontrol/src/core/size.cpp deleted file mode 100644 index 65a26fac217334ed621ad619e8854632c166b125..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/size.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/** -****************************************************************************** -* -* @file size.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "size.h" - - -namespace core { -Size::Size():width(0),height(0) -{} -} diff --git a/lib/opmapcontrol/src/core/size.h b/lib/opmapcontrol/src/core/size.h deleted file mode 100644 index da340b9a63c0c3c0f0c02388fc7f3d5d1d172965..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/size.h +++ /dev/null @@ -1,58 +0,0 @@ -/** -****************************************************************************** -* -* @file size.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef SIZE_H -#define SIZE_H - -#include "point.h" -#include -#include - -namespace core { - struct Size - { - - Size(); - Size(Point pt){width=pt.X(); height=pt.Y();}; - Size(int Width,int Height){width=Width; height=Height;}; - friend uint qHash(Size const& size); - // friend bool operator==(Size const& lhs,Size const& rhs); - Size operator-(const Size &sz1){return Size(width-sz1.width,height-sz1.height);} - Size operator+(const Size &sz1){return Size(sz1.width+width,sz1.height+height);} - - int GetHashCode(){return width^height;} - uint qHash(Size const& /*rect*/){return width^height;} - QString ToString(){return "With="+QString::number(width)+" ,Height="+QString::number(height);} - int Width()const {return width;} - int Height()const {return height;} - void SetWidth(int const& value){width=value;} - void SetHeight(int const& value){height=value;} - private: - int width; - int height; - }; -} -#endif // SIZE_H diff --git a/lib/opmapcontrol/src/core/tilecachequeue.cpp b/lib/opmapcontrol/src/core/tilecachequeue.cpp deleted file mode 100644 index 166e66a2911963a0b2848b0639c9255dc8019baf..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/tilecachequeue.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/** -****************************************************************************** -* -* @file tilecachequeue.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "tilecachequeue.h" - - -//#define DEBUG_TILECACHEQUEUE - -namespace core { -TileCacheQueue::TileCacheQueue() -{ - -} -TileCacheQueue::~TileCacheQueue() -{ - // QThread::wait(10000); -} - -void TileCacheQueue::EnqueueCacheTask(CacheItemQueue *task) -{ -#ifdef DEBUG_TILECACHEQUEUE - qDebug()<<"DB Do I EnqueueCacheTask"<GetPosition().X()<<","<GetPosition().Y(); -#endif //DEBUG_TILECACHEQUEUE - if(!tileCacheQueue.contains(task)) - { -#ifdef DEBUG_TILECACHEQUEUE - qDebug()<<"EnqueueCacheTask"<GetPosition().X()<<","<GetPosition().Y(); -#endif //DEBUG_TILECACHEQUEUE - mutex.lock(); - tileCacheQueue.enqueue(task); - mutex.unlock(); - if(this->isRunning()) - { -#ifdef DEBUG_TILECACHEQUEUE - qDebug()<<"Wake Thread"; -#endif //DEBUG_TILECACHEQUEUE - //this->start(QThread::NormalPriority); - //waitmutex.lock(); - waitc.wakeAll(); - //waitmutex.unlock(); - } - else - { -#ifdef DEBUG_TILECACHEQUEUE - qDebug()<<"Start Thread"; -#endif //DEBUG_TILECACHEQUEUE - this->start(QThread::NormalPriority); - } - } - -} -void TileCacheQueue::run() -{ -#ifdef DEBUG_TILECACHEQUEUE - qDebug()<<"Cache Engine Start"; -#endif //DEBUG_TILECACHEQUEUE - while(true) - { - CacheItemQueue *task; -#ifdef DEBUG_TILECACHEQUEUE - qDebug()<<"Cache"; -#endif //DEBUG_TILECACHEQUEUE - if(tileCacheQueue.count()>0) - { - mutex.lock(); - task=tileCacheQueue.dequeue(); - mutex.unlock(); -#ifdef DEBUG_TILECACHEQUEUE - qDebug()<<"Cache engine Put:"<GetPosition().X()<<","<GetPosition().Y(); -#endif //DEBUG_TILECACHEQUEUE - Cache::Instance()->ImageCache.PutImageToCache(task->GetImg(),task->GetMapType(),task->GetPosition(),task->GetZoom()); - usleep(44); - delete task; - } - - else - { - qDebug()<<"Cache engine BEGIN WAIT"; - waitmutex.lock(); - int tout=4000; - if(!waitc.wait(&waitmutex,tout)) - { - waitmutex.unlock(); -#ifdef DEBUG_TILECACHEQUEUE - qDebug()<<"Cache Engine TimeOut"; -#endif //DEBUG_TILECACHEQUEUE - mutex.lock(); - if(tileCacheQueue.count()==0) - { - mutex.unlock(); - break; - } - mutex.unlock(); - } - qDebug()<<"Cache Engine DID NOT TimeOut"; - waitmutex.unlock(); - } - } -#ifdef DEBUG_TILECACHEQUEUE - qDebug()<<"Cache Engine Stopped"; -#endif //DEBUG_TILECACHEQUEUE -} - - -} diff --git a/lib/opmapcontrol/src/core/tilecachequeue.h b/lib/opmapcontrol/src/core/tilecachequeue.h deleted file mode 100644 index a0bf2b7e013f0ed93efc4e4c6c0822e55914b06c..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/tilecachequeue.h +++ /dev/null @@ -1,59 +0,0 @@ -/** -****************************************************************************** -* -* @file tilecachequeue.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef TILECACHEQUEUE_H -#define TILECACHEQUEUE_H - -#include -#include "cacheitemqueue.h" -#include -#include -#include -#include -#include -#include "pureimagecache.h" -#include "cache.h" - - -namespace core { - class TileCacheQueue:public QThread - { - Q_OBJECT - public: - TileCacheQueue(); - ~TileCacheQueue(); - void EnqueueCacheTask(CacheItemQueue *task); - - protected: - QQueue tileCacheQueue; - private: - void run(); - QMutex mutex; - QMutex waitmutex; - QWaitCondition waitc; - }; -} -#endif // TILECACHEQUEUE_H diff --git a/lib/opmapcontrol/src/core/urlfactory.cpp b/lib/opmapcontrol/src/core/urlfactory.cpp deleted file mode 100644 index 77a971e4f5db6d684c0db94aee18b2b558229c53..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/urlfactory.cpp +++ /dev/null @@ -1,694 +0,0 @@ -/** -****************************************************************************** -* -* @file urlfactory.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "urlfactory.h" -#include - -namespace core { - - const double UrlFactory::EarthRadiusKm = 6378.137; // WGS-84 - - UrlFactory::UrlFactory() - { - /// - /// timeout for map connections - /// - - Proxy.setType(QNetworkProxy::NoProxy); - - /// - /// Gets or sets the value of the User-agent HTTP header. - /// - UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7"; - - Timeout = 5 * 1000; - CorrectGoogleVersions=true; - isCorrectedGoogleVersions = false; - UseGeocoderCache=true; - UsePlacemarkCache=true; - } - UrlFactory::~UrlFactory() - { - } - QString UrlFactory::TileXYToQuadKey(const int &tileX,const int &tileY,const int &levelOfDetail) const - { - QString quadKey; - for(int i = levelOfDetail; i > 0; i--) - { - char digit = '0'; - int mask = 1 << (i - 1); - if((tileX & mask) != 0) - { - digit++; - } - if((tileY & mask) != 0) - { - digit++; - digit++; - } - quadKey.append(digit); - } - return quadKey; - } - int UrlFactory::GetServerNum(const Point &pos,const int &max) const - { - return (pos.X() + 2 * pos.Y()) % max; - } - void UrlFactory::setIsCorrectGoogleVersions(bool value) - { - isCorrectedGoogleVersions=value; - - } - - bool UrlFactory::IsCorrectGoogleVersions() - { - return isCorrectedGoogleVersions; - } - - void UrlFactory::TryCorrectGoogleVersions() - { - if(CorrectGoogleVersions && !IsCorrectGoogleVersions()) - { - QNetworkReply *reply; - QNetworkRequest qheader; - QNetworkAccessManager network; - QEventLoop q; - QTimer tT; - tT.setSingleShot(true); - connect(&network, SIGNAL(finished(QNetworkReply*)), - &q, SLOT(quit())); - connect(&tT, SIGNAL(timeout()), &q, SLOT(quit())); - network.setProxy(Proxy); -#ifdef DEBUG_URLFACTORY - qDebug()<<"Correct GoogleVersion"; -#endif //DEBUG_URLFACTORY - setIsCorrectGoogleVersions(true); - QString url = "http://maps.google.com"; - - qheader.setUrl(QUrl(url)); - qheader.setRawHeader("User-Agent",UserAgent); - reply=network.get(qheader); - tT.start(Timeout); - q.exec(); - if(!tT.isActive()) - return; - tT.stop(); - if( (reply->error()!=QNetworkReply::NoError)) - { -#ifdef DEBUG_URLFACTORY - qDebug()<<"Try corrected version withou abort or error:"<errorString(); -#endif //DEBUG_URLFACTORY - return; - } - QString html=QString(reply->readAll()); - QRegExp reg("\"*http://mt0.google.com/vt/lyrs=m@(\\d*)",Qt::CaseInsensitive); - if(reg.indexIn(html)!=-1) - { - QStringList gc=reg.capturedTexts(); - VersionGoogleMap = QString("m@%1").arg(gc[1]); - VersionGoogleMapChina = VersionGoogleMap; -#ifdef DEBUG_URLFACTORY - qDebug()<<"TryCorrectGoogleVersions, VersionGoogleMap: "<deleteLater(); - - } - - } - - QString UrlFactory::MakeImageUrl(const MapType::Types &type,const Point &pos,const int &zoom,const QString &language) - { -#ifdef DEBUG_URLFACTORY - qDebug()<<"Entered MakeImageUrl"; -#endif //DEBUG_URLFACTORY - switch(type) - { - case MapType::GoogleMap: - { - QString server = "mt"; - QString request = "vt"; - QString sec1 = ""; // after &x=... - QString sec2 = ""; // after &zoom=... - GetSecGoogleWords(pos, sec1, sec2); - TryCorrectGoogleVersions(); - - return QString("http://%1%2.google.com/%3/lyrs=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleMap).arg(language).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); - } - break; - case MapType::GoogleSatellite: - { - QString server = "khm"; - QString request = "kh"; - QString sec1 = ""; // after &x=... - QString sec2 = ""; // after &zoom=... - GetSecGoogleWords(pos, sec1, sec2); - TryCorrectGoogleVersions(); - return QString("http://%1%2.google.com/%3/v=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleSatellite).arg(language).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); - } - break; - case MapType::GoogleLabels: - { - QString server = "mt"; - QString request = "vt"; - QString sec1 = ""; // after &x=... - QString sec2 = ""; // after &zoom=... - GetSecGoogleWords(pos, sec1, sec2); - TryCorrectGoogleVersions(); - - return QString("http://%1%2.google.com/%3/lyrs=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleLabels).arg(language).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); - } - break; - case MapType::GoogleTerrain: - { - QString server = "mt"; - QString request = "vt"; - QString sec1 = ""; // after &x=... - QString sec2 = ""; // after &zoom=... - GetSecGoogleWords(pos, sec1, sec2); - TryCorrectGoogleVersions(); - return QString("http://%1%2.google.com/%3/v=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleTerrain).arg(language).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); - } - break; - case MapType::GoogleMapChina: - { - QString server = "mt"; - QString request = "vt"; - QString sec1 = ""; // after &x=... - QString sec2 = ""; // after &zoom=... - GetSecGoogleWords(pos, sec1, sec2); - TryCorrectGoogleVersions(); - // http://mt0.google.cn/vt/v=w2.101&hl=zh-CN&gl=cn&x=12&y=6&z=4&s=Ga - - return QString("http://%1%2.google.cn/%3/lyrs=%4&hl=%5&gl=cn&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleMapChina).arg("zh-CN").arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); - } - break; - case MapType::GoogleSatelliteChina: - { - QString server = "mt"; - QString request = "vt"; - QString sec1 = ""; // after &x=... - QString sec2 = ""; // after &zoom=... - GetSecGoogleWords(pos, sec1, sec2); - // TryCorrectGoogleVersions(); - // http://khm0.google.cn/kh/v=46&x=12&y=6&z=4&s=Ga - - return QString("http://%1%2.google.cn/%3/lyrs=%4&gl=cn&x=%5%6&y=%7&z=%8&s=%9").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleSatelliteChina).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); - } - break; - case MapType::GoogleLabelsChina: - { - QString server = "mt"; - QString request = "vt"; - QString sec1 = ""; // after &x=... - QString sec2 = ""; // after &zoom=... - GetSecGoogleWords(pos, sec1, sec2); - TryCorrectGoogleVersions(); - // http://mt0.google.cn/vt/v=w2t.110&hl=zh-CN&gl=cn&x=12&y=6&z=4&s=Ga - - return QString("http://%1%2.google.cn/%3/imgtp=png32&lyrs=%4&hl=%5&gl=cn&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleLabelsChina).arg("zh-CN").arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); - } - break; - case MapType::GoogleTerrainChina: - { - QString server = "mt"; - QString request = "vt"; - QString sec1 = ""; // after &x=... - QString sec2 = ""; // after &zoom=... - GetSecGoogleWords(pos, sec1, sec2); - TryCorrectGoogleVersions(); - // http://mt0.google.cn/vt/v=w2p.110&hl=zh-CN&gl=cn&x=12&y=6&z=4&s=Ga - - return QString("http://%1%2.google.com/%3/lyrs=%4&hl=%5&gl=cn&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleTerrainChina).arg("zh-CN").arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); - } - break; - case MapType::GoogleMapKorea: - { - QString server = "mt"; - QString request = "mt"; - QString sec1 = ""; // after &x=... - QString sec2 = ""; // after &zoom=... - GetSecGoogleWords(pos, sec1, sec2); - - //http://mt3.gmaptiles.co.kr/mt/v=kr1.11&hl=lt&x=109&y=49&z=7&s= - - QString ret = QString("http://%1%2.gmaptiles.co.kr/%3/v=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleMapKorea).arg(language).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); - return ret; - } - break; - case MapType::GoogleSatelliteKorea: - { - QString server = "khm"; - QString request = "kh"; - QString sec1 = ""; // after &x=... - QString sec2 = ""; // after &zoom=... - GetSecGoogleWords(pos, sec1, sec2); - - // http://khm1.google.co.kr/kh/v=54&x=109&y=49&z=7&s= - - return QString("http://%1%2.google.co.kr/%3/v=%4&x=%5%6&y=%7&z=%8&s=%9").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleSatelliteKorea).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); - } - break; - case MapType::GoogleLabelsKorea: - { - QString server = "mt"; - QString request = "mt"; - QString sec1 = ""; // after &x=... - QString sec2 = ""; // after &zoom=... - GetSecGoogleWords(pos, sec1, sec2); - - // http://mt1.gmaptiles.co.kr/mt/v=kr1t.11&hl=lt&x=109&y=50&z=7&s=G - - return QString("http://%1%2.gmaptiles.co.kr/%3/v=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleLabelsKorea).arg(language).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); - } - break; - case MapType::YahooMap: - { - return QString("http://maps%1.yimg.com/hx/tl?v=%2&.intl=%3&x=%4&y=%5&z=%6&r=1").arg(((GetServerNum(pos, 2)) + 1)).arg(VersionYahooMap).arg(language).arg(pos.X()).arg((((1 << zoom) >> 1) - 1 - pos.Y())).arg((zoom + 1)); - } - - case MapType::YahooSatellite: - { - return QString("http://maps%1.yimg.com/ae/ximg?v=%2&t=a&s=256&.intl=%3&x=%4&y=%5&z=%6&r=1").arg("3").arg(VersionYahooSatellite).arg(language).arg(pos.X()).arg(((1 << zoom) >> 1) - 1 - pos.Y()).arg(zoom + 1); - } - break; - case MapType::YahooLabels: - { - return QString("http://maps%1.yimg.com/hx/tl?v=%2&t=h&.intl=%3&x=%4&y=%5&z=%6&r=1").arg("1").arg(VersionYahooLabels).arg(language).arg(pos.X()).arg(((1 << zoom) >> 1) - 1 - pos.Y()).arg(zoom + 1); - } - break; - case MapType::OpenStreetMap: - { - char letter= "abc"[GetServerNum(pos, 3)]; - return QString("http://%1.tile.openstreetmap.org/%2/%3/%4.png").arg(letter).arg(zoom).arg(pos.X()).arg(pos.Y()); - } - break; - case MapType::OpenStreetOsm: - { - char letter = "abc"[GetServerNum(pos, 3)]; - return QString("http://%1.tah.openstreetmap.org/Tiles/tile/%2/%3/%4.png").arg(letter).arg(zoom).arg(pos.X()).arg(pos.Y()); - } - break; - case MapType::OpenStreetMapSurfer: - { - // http://tiles1.mapsurfer.net/tms_r.ashx?x=37378&y=20826&z=16 - - return QString("http://tiles1.mapsurfer.net/tms_r.ashx?x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); - } - break; - case MapType::OpenStreetMapSurferTerrain: - { - // http://tiles2.mapsurfer.net/tms_t.ashx?x=9346&y=5209&z=14 - - return QString("http://tiles2.mapsurfer.net/tms_t.ashx?x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); - } - break; - case MapType::BingMap: - { - QString key = TileXYToQuadKey(pos.X(), pos.Y(), zoom); - return QString("http://ecn.t%1.tiles.virtualearth.net/tiles/r%2.png?g=%3&mkt=%4%5").arg(GetServerNum(pos, 4)).arg(key).arg(VersionBingMaps).arg(language).arg(!(BingMapsClientToken.isNull()|BingMapsClientToken.isEmpty()) ? "&token=" + BingMapsClientToken : QString("")); - } - break; - case MapType::BingSatellite: - { - QString key = TileXYToQuadKey(pos.X(), pos.Y(), zoom); - return QString("http://ecn.t%1.tiles.virtualearth.net/tiles/a%2.jpeg?g=%3&mkt=%4%5").arg(GetServerNum(pos, 4)).arg(key).arg(VersionBingMaps).arg(language).arg(!(BingMapsClientToken.isNull()|BingMapsClientToken.isEmpty()) ? "&token=" + BingMapsClientToken : QString("")); - } - break; - case MapType::BingHybrid: - { - QString key = TileXYToQuadKey(pos.X(), pos.Y(), zoom); - return QString("http://ecn.t%1.tiles.virtualearth.net/tiles/h%2.jpeg?g=%3&mkt=%4%5").arg(GetServerNum(pos, 4)).arg(key).arg(VersionBingMaps).arg(language).arg(!(BingMapsClientToken.isNull()|BingMapsClientToken.isEmpty()) ? "&token=" + BingMapsClientToken : QString("")); - } - - case MapType::ArcGIS_Map: - { - // http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/tile/0/0/0.jpg - - return QString("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/tile/%1/%2/%3").arg(zoom).arg(pos.Y()).arg(pos.X()); - } - break; - case MapType::ArcGIS_Satellite: - { - // http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/tile/1/0/1.jpg - - return QString("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/tile/%1/%2/%3").arg(zoom).arg(pos.Y()).arg(pos.X()); - } - break; - case MapType::ArcGIS_ShadedRelief: - { - // http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_ShadedRelief_World_2D/MapServer/tile/1/0/1.jpg - - return QString("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_ShadedRelief_World_2D/MapServer/tile/%1/%2/%3").arg(zoom).arg(pos.Y()).arg(pos.X()); - } - break; - case MapType::ArcGIS_Terrain: - { - // http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer/tile/4/3/15 - - return QString("http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer/tile/%1/%2/%3").arg(zoom).arg(pos.Y()).arg(pos.X()); - } - break; - case MapType::ArcGIS_MapsLT_OrtoFoto: - { - // http://www.maps.lt/ortofoto/mapslt_ortofoto_vector_512/map/_alllayers/L02/R0000001b/C00000028.jpg - // http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto/MapServer/tile/0/9/13 - // return string.Format("http://www.maps.lt/ortofoto/mapslt_ortofoto_vector_512/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.jpg", zoom, pos.Y(), pos.X()); - // http://dc1.maps.lt/cache/mapslt_ortofoto_512/map/_alllayers/L03/R0000001c/C00000029.jpg - // return string.Format("http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto/MapServer/tile/{0}/{1}/{2}", zoom, pos.Y(), pos.X()); - // http://dc1.maps.lt/cache/mapslt_ortofoto_512/map/_alllayers/L03/R0000001d/C0000002a.jpg - //TODO verificar - return QString("http://dc1.maps.lt/cache/mapslt_ortofoto/map/_alllayers/L%1/R%2/C%3.jpg").arg(zoom,2,10,(QChar)'0').arg(pos.Y(),8,16,(QChar)'0').arg(pos.X(),8,16,(QChar)'0'); - } - break; - case MapType::ArcGIS_MapsLT_Map: - { - // http://www.maps.lt/ortofoto/mapslt_ortofoto_vector_512/map/_alllayers/L02/R0000001b/C00000028.jpg - // http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto/MapServer/tile/0/9/13 - // return string.Format("http://www.maps.lt/ortofoto/mapslt_ortofoto_vector_512/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.jpg", zoom, pos.Y(), pos.X()); - // http://arcgis.maps.lt/ArcGIS/rest/services/mapslt/MapServer/tile/7/1162/1684.png - // http://dc1.maps.lt/cache/mapslt_512/map/_alllayers/L03/R0000001b/C00000029.png - //TODO verificar - // http://dc1.maps.lt/cache/mapslt/map/_alllayers/L02/R0000001c/C00000029.png - return QString("http://dc1.maps.lt/cache/mapslt/map/_alllayers/L%1/R%2/C%3.png").arg(zoom,2,10,(QChar)'0').arg(pos.Y(),8,16,(QChar)'0').arg(pos.X(),8,16,(QChar)'0'); - } - break; - case MapType::ArcGIS_MapsLT_Map_Labels: - { - //http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto_overlay/MapServer/tile/0/9/13 - //return string.Format("http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto_overlay/MapServer/tile/{0}/{1}/{2}", zoom, pos.Y(), pos.X()); - //http://dc1.maps.lt/cache/mapslt_ortofoto_overlay_512/map/_alllayers/L03/R0000001d/C00000029.png - //TODO verificar - return QString("http://dc1.maps.lt/cache/mapslt_ortofoto_overlay/map/_alllayers/L%1/R%2/C%3.png").arg(zoom,2,10,(QChar)'0').arg(pos.Y(),8,16,(QChar)'0').arg(pos.X(),8,16,(QChar)'0'); - } - break; - case MapType::PergoTurkeyMap: - { - // http://{domain}/{layerName}/{zoomLevel}/{first3LetterOfTileX}/{second3LetterOfTileX}/{third3LetterOfTileX}/{first3LetterOfTileY}/{second3LetterOfTileY}/{third3LetterOfTileXY}.png - - // http://map3.pergo.com.tr/tile/00/000/000/001/000/000/000.png - // That means: Zoom Level: 0 TileX: 1 TileY: 0 - - // http://domain/tile/14/000/019/371/000/011/825.png - // That means: Zoom Level: 14 TileX: 19371 TileY:11825 - - // string x = pos.X().ToString("000000000").Insert(3, "/").Insert(7, "/"); // - 000/000/001 - // string y = pos.Y().ToString("000000000").Insert(3, "/").Insert(7, "/"); // - 000/000/000 - QString x=QString("%1").arg(QString::number(pos.X()),9,(QChar)'0'); - x.insert(3,"/").insert(7,"/"); - QString y=QString("%1").arg(QString::number(pos.Y()),9,(QChar)'0'); - y.insert(3,"/").insert(7,"/"); - //"http://map03.pergo.com.tr/tile/2/000/000/003/000/000/002.png" - return QString("http://map%1.pergo.com.tr/tile/%2/%3/%4.png").arg(GetServerNum(pos, 4)).arg(zoom,2,10,(QChar)'0').arg(x).arg(y); - } - break; - case MapType::SigPacSpainMap: - { - return QString("http://sigpac.mapa.es/kmlserver/raster/%1@3785/%2.%3.%4.img").arg(levelsForSigPacSpainMap[zoom]).arg(zoom).arg(pos.X()).arg((2 << (zoom - 1)) - pos.Y() - 1); - } - break; - - case MapType::YandexMapRu: - { - QString server = "vec"; - - //http://vec01.maps.yandex.ru/tiles?l=map&v=2.10.2&x=1494&y=650&z=11 - - return QString("http://%1").arg(server)+QString("0%2.maps.yandex.ru/tiles?l=map&v=%3&x=%4&y=%5&z=%6").arg(GetServerNum(pos, 4)+1).arg(VersionYandexMap).arg(pos.X()).arg(pos.Y()).arg(zoom); - } - break; - default: - break; - } - - return QString::null; - } - void UrlFactory::GetSecGoogleWords(const Point &pos, QString &sec1, QString &sec2) - { - sec1 = ""; // after &x=... - sec2 = ""; // after &zoom=... - int seclen = ((pos.X() * 3) + pos.Y()) % 8; - sec2 = SecGoogleWord.left(seclen); - if(pos.Y() >= 10000 && pos.Y() < 100000) - { - sec1 = "&s="; - } - } - QString UrlFactory::MakeGeocoderUrl(QString keywords) - { - QString key = keywords.replace(' ', '+'); - return QString("http://maps.google.com/maps/geo?q=%1&output=csv&key=%2").arg(key).arg(GoogleMapsAPIKey); - } - QString UrlFactory::MakeReverseGeocoderUrl(internals::PointLatLng &pt,const QString &language) - { - - return QString("http://maps.google.com/maps/geo?hl=%1&ll=%2,%3&output=csv&key=%4").arg(language).arg(QString::number(pt.Lat())).arg(QString::number(pt.Lng())).arg(GoogleMapsAPIKey); - - } - internals::PointLatLng UrlFactory::GetLatLngFromGeodecoder(const QString &keywords, GeoCoderStatusCode::Types &status) - { - return GetLatLngFromGeocoderUrl(MakeGeocoderUrl(keywords),UseGeocoderCache,status); - } - internals::PointLatLng UrlFactory::GetLatLngFromGeocoderUrl(const QString &url, const bool &useCache, GeoCoderStatusCode::Types &status) - { -#ifdef DEBUG_URLFACTORY - qDebug()<<"Entered GetLatLngFromGeocoderUrl:"; -#endif //DEBUG_URLFACTORY - status = GeoCoderStatusCode::Unknow; - internals::PointLatLng ret(0,0); - QString urlEnd = url.mid(url.indexOf("geo?q=")+6); - urlEnd.replace( QRegExp( - "[^" - "A-Z,a-z,0-9," - "\\^,\\&,\\',\\@," - "\\{,\\},\\[,\\]," - "\\,,\\$,\\=,\\!," - "\\-,\\#,\\(,\\)," - "\\%,\\.,\\+,\\~,\\_" - "]"), "_" ); - - QString geo = useCache ? Cache::Instance()->GetGeocoderFromCache(urlEnd) : ""; - - if(geo.isNull()|geo.isEmpty()) - { -#ifdef DEBUG_URLFACTORY - qDebug()<<"GetLatLngFromGeocoderUrl:Not in cache going internet"; -#endif //DEBUG_URLFACTORY - QNetworkReply *reply; - QNetworkRequest qheader; - QNetworkAccessManager network; - network.setProxy(Proxy); - qheader.setUrl(QUrl(url)); - qheader.setRawHeader("User-Agent",UserAgent); - reply=network.get(qheader); -#ifdef DEBUG_URLFACTORY - qDebug()<<"GetLatLngFromGeocoderUrl:URL="<isFinished()) || (time.elapsed()>(6*Timeout))) ){QCoreApplication::processEvents(QEventLoop::AllEvents);} -#ifdef DEBUG_URLFACTORY - qDebug()<<"Finished?"<error()<<" abort?"<<(time.elapsed()>Timeout*6); -#endif //DEBUG_URLFACTORY - if( (reply->error()!=QNetworkReply::NoError) | (time.elapsed()>Timeout*6)) - { -#ifdef DEBUG_URLFACTORY - qDebug()<<"GetLatLngFromGeocoderUrl::Network error"; -#endif //DEBUG_URLFACTORY - return internals::PointLatLng(0,0); - } - { -#ifdef DEBUG_URLFACTORY - qDebug()<<"GetLatLngFromGeocoderUrl:Reply ok"; -#endif //DEBUG_URLFACTORY - geo=reply->readAll(); - - - // cache geocoding - if(useCache && geo.startsWith("200")) - { - Cache::Instance()->CacheGeocoder(urlEnd, geo); - } - } - reply->deleteLater(); - } - - - // parse values - // true : 200,4,56.1451640,22.0681787 - // false: 602,0,0,0 - { - QStringList values = geo.split(','); - if(values.count() == 4) - { - status = (GeoCoderStatusCode::Types) QString(values[0]).toInt(); - if(status == GeoCoderStatusCode::G_GEO_SUCCESS) - { - double lat = QString(values[2]).toDouble(); - double lng = QString(values[3]).toDouble(); - - ret = internals::PointLatLng(lat, lng); -#ifdef DEBUG_URLFACTORY - qDebug()<<"Lat="<GetPlacemarkFromCache(urlEnd) : ""; - - if(reverse.isNull()|reverse.isEmpty()) - { -#ifdef DEBUG_URLFACTORY - qDebug()<<"GetLatLngFromGeocoderUrl:Not in cache going internet"; -#endif //DEBUG_URLFACTORY - QNetworkReply *reply; - QNetworkRequest qheader; - QNetworkAccessManager network; - network.setProxy(Proxy); - qheader.setUrl(QUrl(url)); - qheader.setRawHeader("User-Agent",UserAgent); - reply=network.get(qheader); -#ifdef DEBUG_URLFACTORY - qDebug()<<"GetLatLngFromGeocoderUrl:URL="<isFinished()) || (time.elapsed()>(6*Timeout))) ){QCoreApplication::processEvents(QEventLoop::AllEvents);} -#ifdef DEBUG_URLFACTORY - qDebug()<<"Finished?"<error()<<" abort?"<<(time.elapsed()>Timeout*6); -#endif //DEBUG_URLFACTORY - if( (reply->error()!=QNetworkReply::NoError) | (time.elapsed()>Timeout*6)) - { -#ifdef DEBUG_URLFACTORY - qDebug()<<"GetLatLngFromGeocoderUrl::Network error"; -#endif //DEBUG_URLFACTORY - return ret; - } - { -#ifdef DEBUG_URLFACTORY - qDebug()<<"GetLatLngFromGeocoderUrl:Reply ok"; -#endif //DEBUG_URLFACTORY - QByteArray a=(reply->readAll()); - QTextCodec *codec = QTextCodec::codecForName("UTF-8"); - reverse = codec->toUnicode(a); -#ifdef DEBUG_URLFACTORY - qDebug()<CachePlacemark(urlEnd, reverse); - } - } - reply->deleteLater(); - } - - - // parse values - // true : 200,4,56.1451640,22.0681787 - // false: 602,0,0,0 - if(reverse.startsWith("200")) - { - QString acc = reverse.left(reverse.indexOf('\"')); - ret = Placemark(reverse.remove(reverse.indexOf('\"'))); - ret.SetAccuracy ((int) (( (QString) acc.split(',')[1]).toInt()) ); - - } - return ret; - } - double UrlFactory::GetDistance(internals::PointLatLng p1, internals::PointLatLng p2) - { - double dLat1InRad = p1.Lat() * (M_PI / 180); - double dLong1InRad = p1.Lng() * (M_PI / 180); - double dLat2InRad = p2.Lat() * (M_PI / 180); - double dLong2InRad = p2.Lng() * (M_PI / 180); - double dLongitude = dLong2InRad - dLong1InRad; - double dLatitude = dLat2InRad - dLat1InRad; - double a = pow(sin(dLatitude / 2), 2) + cos(dLat1InRad) * cos(dLat2InRad) * pow(sin(dLongitude / 2), 2); - double c = 2 * atan2(sqrt(a), sqrt(1 - a)); - double dDistance = EarthRadiusKm * c; - return dDistance; - } -} diff --git a/lib/opmapcontrol/src/core/urlfactory.h b/lib/opmapcontrol/src/core/urlfactory.h deleted file mode 100644 index e886a5410e4e6f50dd370b8e369c0ca73f234173..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/core/urlfactory.h +++ /dev/null @@ -1,87 +0,0 @@ -/** -****************************************************************************** -* -* @file urlfactory.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef URLFACTORY_H -#define URLFACTORY_H - -#include -#include -#include -#include -#include -#include -#include -#include "providerstrings.h" -#include "pureimagecache.h" -#include "../internals/pointlatlng.h" -#include "geodecoderstatus.h" -#include -#include "cache.h" -#include "placemark.h" -#include -#include "cmath" - -namespace core { - class UrlFactory: public QObject,public ProviderStrings - { - Q_OBJECT - public: - /// - /// Gets or sets the value of the User-agent HTTP header. - /// - QByteArray UserAgent; - QNetworkProxy Proxy; - UrlFactory(); - ~UrlFactory(); - QString MakeImageUrl(const MapType::Types &type,const core::Point &pos,const int &zoom,const QString &language); - internals::PointLatLng GetLatLngFromGeodecoder(const QString &keywords,GeoCoderStatusCode::Types &status); - Placemark GetPlacemarkFromGeocoder(internals::PointLatLng location); - int Timeout; - private: - void GetSecGoogleWords(const core::Point &pos, QString &sec1, QString &sec2); - int GetServerNum(const core::Point &pos,const int &max) const; - void TryCorrectGoogleVersions(); - bool isCorrectedGoogleVersions; - QString TileXYToQuadKey(const int &tileX,const int &tileY,const int &levelOfDetail) const; - bool CorrectGoogleVersions; - bool UseGeocoderCache; //TODO GetSet - bool UsePlacemarkCache;//TODO GetSet - static const double EarthRadiusKm; - double GetDistance(internals::PointLatLng p1,internals::PointLatLng p2); - - protected: - static short timelapse; - QString LanguageStr; - bool IsCorrectGoogleVersions(); - void setIsCorrectGoogleVersions(bool value); - QString MakeGeocoderUrl(QString keywords); - QString MakeReverseGeocoderUrl(internals::PointLatLng &pt,const QString &language); - internals::PointLatLng GetLatLngFromGeocoderUrl(const QString &url,const bool &useCache, GeoCoderStatusCode::Types &status); - Placemark GetPlacemarkFromReverseGeocoderUrl(const QString &url,const bool &useCache); - }; - -} -#endif // URLFACTORY_H diff --git a/lib/opmapcontrol/src/internals/MouseWheelZoomType.cpp b/lib/opmapcontrol/src/internals/MouseWheelZoomType.cpp deleted file mode 100644 index d36691145036a897efd512477215a5c8170870f3..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/MouseWheelZoomType.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/** -****************************************************************************** -* -* @file MouseWheelZoomType.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "mousewheelzoomtype.h" - - -namespace internals { - -} diff --git a/lib/opmapcontrol/src/internals/copyrightstrings.h b/lib/opmapcontrol/src/internals/copyrightstrings.h deleted file mode 100644 index 6115297d6882cf5155e66a7df6c791f1611b06f6..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/copyrightstrings.h +++ /dev/null @@ -1,41 +0,0 @@ -/** -****************************************************************************** -* -* @file copyrightstrings.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef COPYRIGHTSTRINGS_H -#define COPYRIGHTSTRINGS_H - -#include -#include - -namespace internals { -static const QString googleCopyright = QString("©%1 Google - Map data ©%1 Tele Atlas, Imagery ©%1 TerraMetrics").arg(QDate::currentDate().year()); -static const QString openStreetMapCopyright = QString("© OpenStreetMap - Map data ©%1 OpenStreetMap").arg(QDate::currentDate().year()); -static const QString yahooMapCopyright = QString("© Yahoo! Inc. - Map data & Imagery ©%1 NAVTEQ").arg(QDate::currentDate().year()); -static const QString virtualEarthCopyright = QString("©%1 Microsoft Corporation, ©%1 NAVTEQ, ©%1 Image courtesy of NASA").arg(QDate::currentDate().year()); -static const QString arcGisCopyright = QString("©%1 ESRI - Map data ©%1 ArcGIS").arg(QDate::currentDate().year()); - -} -#endif // COPYRIGHTSTRINGS_H diff --git a/lib/opmapcontrol/src/internals/core.cpp b/lib/opmapcontrol/src/internals/core.cpp deleted file mode 100644 index 8a3fafc05942bde0565e7669e765c6b60c0c771d..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/core.cpp +++ /dev/null @@ -1,695 +0,0 @@ -/** -****************************************************************************** -* -* @file core.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "core.h" - -#ifdef DEBUG_CORE -qlonglong internals::Core::debugcounter=0; -#endif - -using namespace projections; - -namespace internals { - Core::Core():MouseWheelZooming(false),currentPosition(0,0),currentPositionPixel(0,0),LastLocationInBounds(-1,-1),sizeOfMapArea(0,0) - ,minOfTiles(0,0),maxOfTiles(0,0),zoom(0),isDragging(false),TooltipTextPadding(10,10),loaderLimit(5),maxzoom(21),started(false),runningThreads(0) - { - mousewheelzoomtype=MouseWheelZoomType::MousePositionAndCenter; - SetProjection(new MercatorProjection()); - this->setAutoDelete(false); - ProcessLoadTaskCallback.setMaxThreadCount(10); - renderOffset=Point(0,0); - dragPoint=Point(0,0); - CanDragMap=true; - tilesToload=0; - OPMaps::Instance(); - } - Core::~Core() - { - ProcessLoadTaskCallback.waitForDone(); - } - - void Core::run() - { - MrunningThreads.lock(); - ++runningThreads; - MrunningThreads.unlock(); -#ifdef DEBUG_CORE - qlonglong debug; - Mdebug.lock(); - debug=++debugcounter; - Mdebug.unlock(); - qDebug()<<"core:run"<<" ID="< 0) - { - task = tileLoadQueue.dequeue(); - { - - last = (tileLoadQueue.count() == 0); -#ifdef DEBUG_CORE - qDebug()<<"TileLoadQueue: " << tileLoadQueue.count()<<" Point:"<GetPos().ToString()<<" now has "<Overlays.count()<<" overlays"<<" ID="<RetryLoadTile > 0) - { -#ifdef DEBUG_CORE - qDebug()<<"ProcessLoadTask: " << task.ToString()<< " -> empty tile, retry " << retry<<" ID="<RetryLoadTile); - } - - if(t->Overlays.count() > 0) - { - Matrix.SetTileAt(task.Pos,t); - emit OnNeedInvalidation(); - -#ifdef DEBUG_CORE - qDebug()<<"Core::run add tile "<GetPos().ToString()<<" to matrix index "<Overlays.count()<<" ID="<kiberCacheLock.lockForWrite(); - OPMaps::Instance()->TilesInMemory.RemoveMemoryOverload(); - OPMaps::Instance()->kiberCacheLock.unlock(); - - MtileDrawingList.lock(); - { - Matrix.ClearPointsNotIn(tileDrawingList); - } - MtileDrawingList.unlock(); - - - emit OnTileLoadComplete(); - - - emit OnNeedInvalidation(); - - } - } - - - - } -#ifdef DEBUG_CORE - qDebug()<<"loaderLimit release:"+loaderLimit.available()<<" ID="<GetDiagnostics(); - diag.runningThreads=runningThreads; - MrunningThreads.unlock(); - return diag; - } - - void Core::SetZoom(const int &value) - { - if (!isDragging) - { - zoom=value; - minOfTiles=Projection()->GetTileMatrixMinXY(value); - maxOfTiles=Projection()->GetTileMatrixMaxXY(value); - currentPositionPixel=Projection()->FromLatLngToPixel(currentPosition,value); - if(started) - { - MtileLoadQueue.lock(); - tileLoadQueue.clear(); - MtileLoadQueue.unlock(); - MtileToload.lock(); - tilesToload=0; - MtileToload.unlock(); - Matrix.Clear(); - GoToCurrentPositionOnZoom(); - UpdateBounds(); - emit OnMapDrag(); - emit OnMapZoomChanged(); - emit OnNeedInvalidation(); - } - } - } - - void Core::SetCurrentPosition(const PointLatLng &value) - { - if(!IsDragging()) - { - currentPosition = value; - SetCurrentPositionGPixel(Projection()->FromLatLngToPixel(value, Zoom())); - - if(started) - { - GoToCurrentPosition(); - emit OnCurrentPositionChanged(currentPosition); - } - } - else - { - currentPosition = value; - SetCurrentPositionGPixel(Projection()->FromLatLngToPixel(value, Zoom())); - - if(started) - { - emit OnCurrentPositionChanged(currentPosition); - } - } - } - void Core::SetMapType(const MapType::Types &value) - { - - if(value != GetMapType()) - { - mapType = value; - - switch(value) - { - - - case MapType::ArcGIS_Map: - case MapType::ArcGIS_Satellite: - case MapType::ArcGIS_ShadedRelief: - case MapType::ArcGIS_Terrain: - { - if(Projection()->Type()!="PlateCarreeProjection") - { - SetProjection(new PlateCarreeProjection()); - maxzoom=13; - } - } - break; - - case MapType::ArcGIS_MapsLT_Map_Hybrid: - case MapType::ArcGIS_MapsLT_Map_Labels: - case MapType::ArcGIS_MapsLT_Map: - case MapType::ArcGIS_MapsLT_OrtoFoto: - { - if(Projection()->Type()!="LKS94Projection") - { - SetProjection(new LKS94Projection()); - maxzoom=11; - } - } - break; - - case MapType::PergoTurkeyMap: - { - if(Projection()->Type()!="PlateCarreeProjectionPergo") - { - SetProjection(new PlateCarreeProjectionPergo()); - maxzoom=17; - } - } - break; - - case MapType::YandexMapRu: - { - if(Projection()->Type()!="MercatorProjectionYandex") - { - SetProjection(new MercatorProjectionYandex()); - maxzoom=13; - } - } - break; - - default: - { - if(Projection()->Type()!="MercatorProjection") - { - SetProjection(new MercatorProjection()); - maxzoom=21; - } - } - break; - } - - minOfTiles = Projection()->GetTileMatrixMinXY(Zoom()); - maxOfTiles = Projection()->GetTileMatrixMaxXY(Zoom()); - SetCurrentPositionGPixel(Projection()->FromLatLngToPixel(CurrentPosition(), Zoom())); - - if(started) - { - CancelAsyncTasks(); - OnMapSizeChanged(Width, Height); - GoToCurrentPosition(); - ReloadMap(); - GoToCurrentPosition(); - emit OnMapTypeChanged(value); - - } - } - - } - void Core::StartSystem() - { - if(!started) - { - started = true; - - ReloadMap(); - GoToCurrentPosition(); - } - } - - void Core::UpdateCenterTileXYLocation() - { - PointLatLng center = FromLocalToLatLng(Width/2, Height/2); - Point centerPixel = Projection()->FromLatLngToPixel(center, Zoom()); - centerTileXYLocation = Projection()->FromPixelToTileXY(centerPixel); - } - - void Core::OnMapSizeChanged(int const& width, int const& height) - { - Width = width; - Height = height; - - sizeOfMapArea.SetWidth(1 + (Width/Projection()->TileSize().Width())/2); - sizeOfMapArea.SetHeight(1 + (Height/Projection()->TileSize().Height())/2); - - UpdateCenterTileXYLocation(); - - if(started) - { - UpdateBounds(); - - emit OnCurrentPositionChanged(currentPosition); - } - } - void Core::OnMapClose() - { - // if(waitOnEmptyTasks != null) - // { - // try - // { - // waitOnEmptyTasks.Set(); - // waitOnEmptyTasks.Close(); - // } - // catch - // { - // } - // } - - CancelAsyncTasks(); - } - GeoCoderStatusCode::Types Core::SetCurrentPositionByKeywords(QString const& keys) - { - GeoCoderStatusCode::Types status = GeoCoderStatusCode::Unknow; - PointLatLng pos = OPMaps::Instance()->GetLatLngFromGeodecoder(keys, status); - if(!pos.IsEmpty() && (status == GeoCoderStatusCode::G_GEO_SUCCESS)) - { - SetCurrentPosition(pos); - } - - return status; - } - RectLatLng Core::CurrentViewArea() - { - PointLatLng p = Projection()->FromPixelToLatLng(-renderOffset.X(), -renderOffset.Y(), Zoom()); - double rlng = Projection()->FromPixelToLatLng(-renderOffset.X() + Width, -renderOffset.Y(), Zoom()).Lng(); - double blat = Projection()->FromPixelToLatLng(-renderOffset.X(), -renderOffset.Y() + Height, Zoom()).Lat(); - return RectLatLng::FromLTRB(p.Lng(), p.Lat(), rlng, blat); - - } - PointLatLng Core::FromLocalToLatLng(int const& x, int const& y) - { - return Projection()->FromPixelToLatLng(Point(x - renderOffset.X(), y - renderOffset.Y()), Zoom()); - } - - - Point Core::FromLatLngToLocal(PointLatLng const& latlng) - { - Point pLocal = Projection()->FromLatLngToPixel(latlng, Zoom()); - pLocal.Offset(renderOffset); - return pLocal; - } - int Core::GetMaxZoomToFitRect(RectLatLng const& rect) - { - int zoom = 0; - - for(int i = 1; i <= MaxZoom(); i++) - { - Point p1 = Projection()->FromLatLngToPixel(rect.LocationTopLeft(), i); - Point p2 = Projection()->FromLatLngToPixel(rect.Bottom(), rect.Right(), i); - - if(((p2.X() - p1.X()) <= Width+10) && (p2.Y() - p1.Y()) <= Height+10) - { - zoom = i; - } - else - { - break; - } - } - - return zoom; - } - void Core::BeginDrag(Point const& pt) - { - dragPoint.SetX(pt.X() - renderOffset.X()); - dragPoint.SetY(pt.Y() - renderOffset.Y()); - isDragging = true; - } - void Core::EndDrag() - { - isDragging = false; - emit OnNeedInvalidation(); - - } - void Core::ReloadMap() - { - if(started) - { -#ifdef DEBUG_CORE - qDebug()<<"------------------"; -#endif //DEBUG_CORE - - MtileLoadQueue.lock(); - { - tileLoadQueue.clear(); - } - MtileLoadQueue.unlock(); - MtileToload.lock(); - tilesToload=0; - MtileToload.unlock(); - Matrix.Clear(); - - emit OnNeedInvalidation(); - - } - } - void Core::GoToCurrentPosition() - { - // reset stuff - renderOffset = Point::Empty; - centerTileXYLocationLast = Point::Empty; - dragPoint = Point::Empty; - - // goto location - Drag(Point(-(GetcurrentPositionGPixel().X() - Width/2), -(GetcurrentPositionGPixel().Y() - Height/2))); - } - void Core::GoToCurrentPositionOnZoom() - { - // reset stuff - renderOffset = Point::Empty; - centerTileXYLocationLast = Point::Empty; - dragPoint = Point::Empty; - - // goto location and centering - if(MouseWheelZooming) - { - if(mousewheelzoomtype != MouseWheelZoomType::MousePositionWithoutCenter) - { - Point pt = Point(-(GetcurrentPositionGPixel().X() - Width/2), -(GetcurrentPositionGPixel().Y() - Height/2)); - renderOffset.SetX(pt.X() - dragPoint.X()); - renderOffset.SetY(pt.Y() - dragPoint.Y()); - } - else // without centering - { - renderOffset.SetX(-GetcurrentPositionGPixel().X() - dragPoint.X()); - renderOffset.SetY(-GetcurrentPositionGPixel().Y() - dragPoint.Y()); - renderOffset.Offset(mouseLastZoom); - } - } - else // use current map center - { - mouseLastZoom = Point::Empty; - - Point pt = Point(-(GetcurrentPositionGPixel().X() - Width/2), -(GetcurrentPositionGPixel().Y() - Height/2)); - renderOffset.SetX(pt.X() - dragPoint.X()); - renderOffset.SetY(pt.Y() - dragPoint.Y()); - } - - UpdateCenterTileXYLocation(); - } - void Core::DragOffset(Point const& offset) - { - renderOffset.Offset(offset); - - UpdateCenterTileXYLocation(); - - if(centerTileXYLocation != centerTileXYLocationLast) - { - centerTileXYLocationLast = centerTileXYLocation; - UpdateBounds(); - } - - { - LastLocationInBounds = CurrentPosition(); - SetCurrentPosition (FromLocalToLatLng((int) Width/2, (int) Height/2)); - } - - emit OnNeedInvalidation(); - emit OnMapDrag(); - } - void Core::Drag(Point const& pt) - { - renderOffset.SetX(pt.X() - dragPoint.X()); - renderOffset.SetY(pt.Y() - dragPoint.Y()); - - UpdateCenterTileXYLocation(); - - if(centerTileXYLocation != centerTileXYLocationLast) - { - centerTileXYLocationLast = centerTileXYLocation; - UpdateBounds(); - } - - if(IsDragging()) - { - LastLocationInBounds = CurrentPosition(); - SetCurrentPosition(FromLocalToLatLng((int) Width/2, (int) Height/2)); - } - - emit OnNeedInvalidation(); - - - emit OnMapDrag(); - - } - void Core::CancelAsyncTasks() - { - if(started) - { - ProcessLoadTaskCallback.waitForDone(); - MtileLoadQueue.lock(); - { - tileLoadQueue.clear(); - //tilesToload=0; - } - MtileLoadQueue.unlock(); - MtileToload.lock(); - tilesToload=0; - MtileToload.unlock(); - // ProcessLoadTaskCallback.waitForDone(); - } - } - void Core::UpdateBounds() - { - MtileDrawingList.lock(); - { - FindTilesAround(tileDrawingList); - -#ifdef DEBUG_CORE - qDebug()<<"OnTileLoadStart: " << tileDrawingList.count() << " tiles to load at zoom " << Zoom() << ", time: " << QDateTime::currentDateTime().date(); -#endif //DEBUG_CORE - - emit OnTileLoadStart(); - - - foreach(Point p,tileDrawingList) - { - LoadTask task = LoadTask(p, Zoom()); - { - MtileLoadQueue.lock(); - { - if(!tileLoadQueue.contains(task)) - { - MtileToload.lock(); - ++tilesToload; - MtileToload.unlock(); - tileLoadQueue.enqueue(task); -#ifdef DEBUG_CORE - qDebug()<<"Core::UpdateBounds new Task"< &list) - { - list.clear();; - for(int i = -sizeOfMapArea.Width(); i <= sizeOfMapArea.Width(); i++) - { - for(int j = -sizeOfMapArea.Height(); j <= sizeOfMapArea.Height(); j++) - { - Point p = centerTileXYLocation; - p.SetX(p.X() + i); - p.SetY(p.Y() + j); - - //if(p.X < minOfTiles.Width) - //{ - // p.X += (maxOfTiles.Width + 1); - //} - - //if(p.X > maxOfTiles.Width) - //{ - // p.X -= (maxOfTiles.Width + 1); - //} - - if(p.X() >= minOfTiles.Width() && p.Y() >= minOfTiles.Height() && p.X() <= maxOfTiles.Width() && p.Y() <= maxOfTiles.Height()) - { - if(!list.contains(p)) - { - list.append(p); - } - } - } - } - - - } - void Core::UpdateGroundResolution() - { - double rez = Projection()->GetGroundResolution(Zoom(), CurrentPosition().Lat()); - pxRes100m = (int) (100.0 / rez); // 100 meters - pxRes1000m = (int) (1000.0 / rez); // 1km - pxRes10km = (int) (10000.0 / rez); // 10km - pxRes100km = (int) (100000.0 / rez); // 100km - pxRes1000km = (int) (1000000.0 / rez); // 1000km - pxRes5000km = (int) (5000000.0 / rez); // 5000km - } -} diff --git a/lib/opmapcontrol/src/internals/core.h b/lib/opmapcontrol/src/internals/core.h deleted file mode 100644 index 73c652de57d9435975772eb59a018a1bbb7c4b85..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/core.h +++ /dev/null @@ -1,283 +0,0 @@ -/** -****************************************************************************** -* -* @file core.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef CORE_H -#define CORE_H - -#include "debugheader.h" - -#include "../internals/pointlatlng.h" -#include "mousewheelzoomtype.h" -#include "../core/size.h" -#include "../core/point.h" - -#include "../core/maptype.h" -#include "rectangle.h" -#include "QThreadPool" -#include "tilematrix.h" -#include -#include "loadtask.h" -#include "copyrightstrings.h" -#include "rectlatlng.h" -#include "../internals/projections/lks94projection.h" -#include "../internals/projections/mercatorprojection.h" -#include "../internals/projections/mercatorprojectionyandex.h" -#include "../internals/projections/platecarreeprojection.h" -#include "../internals/projections/platecarreeprojectionpergo.h" -#include "../core/geodecoderstatus.h" -#include "../core/opmaps.h" -#include "../core/diagnostics.h" - -#include -#include -#include - -#include - -namespace mapcontrol -{ - class OPMapControl; - class MapGraphicItem; -} - -namespace internals { - - class Core:public QObject,public QRunnable - { - Q_OBJECT - - friend class mapcontrol::OPMapControl; - friend class mapcontrol::MapGraphicItem; - public: - Core(); - ~Core(); - void run(); - PointLatLng CurrentPosition()const{return currentPosition;} - - void SetCurrentPosition(const PointLatLng &value); - - core::Point GetcurrentPositionGPixel(){return currentPositionPixel;} - void SetcurrentPositionGPixel(const core::Point &value){currentPositionPixel=value;} - - core::Point GetrenderOffset(){return renderOffset;} - void SetrenderOffset(const core::Point &value){renderOffset=value;} - - core::Point GetcenterTileXYLocation(){return centerTileXYLocation;} - void SetcenterTileXYLocation(const core::Point &value){centerTileXYLocation=value;} - - core::Point GetcenterTileXYLocationLast(){return centerTileXYLocationLast;} - void SetcenterTileXYLocationLast(const core::Point &value){centerTileXYLocationLast=value;} - - core::Point GetdragPoint(){return dragPoint;} - void SetdragPoint(const core::Point &value){dragPoint=value;} - - core::Point GetmouseDown(){return mouseDown;} - void SetmouseDown(const core::Point &value){mouseDown=value;} - - core::Point GetmouseCurrent(){return mouseCurrent;} - void SetmouseCurrent(const core::Point &value){mouseCurrent=value;} - - core::Point GetmouseLastZoom(){return mouseLastZoom;} - void SetmouseLastZoom(const core::Point &value){mouseLastZoom=value;} - - MouseWheelZoomType::Types GetMouseWheelZoomType(){return mousewheelzoomtype;} - void SetMouseWheelZoomType(const MouseWheelZoomType::Types &value){mousewheelzoomtype=value;} - - PointLatLng GetLastLocationInBounds(){return LastLocationInBounds;} - void SetLastLocationInBounds(const PointLatLng &value){LastLocationInBounds=value;} - - Size GetsizeOfMapArea(){return sizeOfMapArea;} - void SetsizeOfMapArea(const Size &value){sizeOfMapArea=value;} - - Size GetminOfTiles(){return minOfTiles;} - void SetminOfTiles(const Size &value){minOfTiles=value;} - - Size GetmaxOfTiles(){return maxOfTiles;} - void SetmaxOfTiles(const Size &value){maxOfTiles=value;} - - Rectangle GettileRect(){return tileRect;} - void SettileRect(const Rectangle &value){tileRect=value;} - - core::Point GettilePoint(){return tilePoint;} - void SettilePoint(const core::Point &value){tilePoint=value;} - - Rectangle GetCurrentRegion(){return CurrentRegion;} - void SetCurrentRegion(const Rectangle &value){CurrentRegion=value;} - - QList tileDrawingList; - - PureProjection* Projection() - { - return projection; - } - void SetProjection(PureProjection* value) - { - projection=value; - tileRect=Rectangle(core::Point(0,0),value->TileSize()); - } - bool IsDragging()const{return isDragging;} - - int Zoom()const{return zoom;} - void SetZoom(int const& value); - - int MaxZoom()const{return maxzoom;} - - void UpdateBounds(); - - MapType::Types GetMapType(){return mapType;} - void SetMapType(MapType::Types const& value); - - void StartSystem(); - - void UpdateCenterTileXYLocation(); - - void OnMapSizeChanged(int const& width, int const& height);//TODO had as slot - - void OnMapClose();//TODO had as slot - - GeoCoderStatusCode::Types SetCurrentPositionByKeywords(QString const& keys); - - RectLatLng CurrentViewArea(); - - PointLatLng FromLocalToLatLng(int const& x, int const& y); - - Point FromLatLngToLocal(PointLatLng const& latlng); - - int GetMaxZoomToFitRect(RectLatLng const& rect); - - void BeginDrag(core::Point const& pt); - - void EndDrag(); - - void ReloadMap(); - - void GoToCurrentPosition(); - - bool MouseWheelZooming; - - void DragOffset(core::Point const& offset); - - void Drag(core::Point const& pt); - - void CancelAsyncTasks(); - - void FindTilesAround(QList &list); - - void UpdateGroundResolution(); - - TileMatrix Matrix; - - bool isStarted(){return started;} - - diagnostics GetDiagnostics(); - signals: - void OnCurrentPositionChanged(internals::PointLatLng point); - void OnTileLoadComplete(); - void OnTilesStillToLoad(int number); - void OnTileLoadStart(); - void OnMapDrag(); - void OnMapZoomChanged(); - void OnMapTypeChanged(MapType::Types type); - void OnEmptyTileError(int zoom, core::Point pos); - void OnNeedInvalidation(); - - private: - - - PointLatLng currentPosition; - core::Point currentPositionPixel; - core::Point renderOffset; - core::Point centerTileXYLocation; - core::Point centerTileXYLocationLast; - core::Point dragPoint; - Rectangle tileRect; - core::Point mouseDown; - bool CanDragMap; - core::Point mouseCurrent; - PointLatLng LastLocationInBounds; - core::Point mouseLastZoom; - - MouseWheelZoomType::Types mousewheelzoomtype; - - - Size sizeOfMapArea; - Size minOfTiles; - Size maxOfTiles; - - core::Point tilePoint; - - Rectangle CurrentRegion; - - QQueue tileLoadQueue; - - int zoom; - - PureProjection* projection; - - bool isDragging; - - QMutex MtileLoadQueue; - - QMutex Moverlays; - - QMutex MtileDrawingList; -#ifdef DEBUG_CORE - QMutex Mdebug; - static qlonglong debugcounter; -#endif - Size TooltipTextPadding; - - MapType::Types mapType; - - QSemaphore loaderLimit; - - QThreadPool ProcessLoadTaskCallback; - QMutex MtileToload; - int tilesToload; - - int maxzoom; - QMutex MrunningThreads; - int runningThreads; - diagnostics diag; - - protected: - bool started; - - int Width; - int Height; - int pxRes100m; // 100 meters - int pxRes1000m; // 1km - int pxRes10km; // 10km - int pxRes100km; // 100km - int pxRes1000km; // 1000km - int pxRes5000km; // 5000km - void SetCurrentPositionGPixel(core::Point const& value){currentPositionPixel = value;} - void GoToCurrentPositionOnZoom(); - - }; - -} -#endif // CORE_H diff --git a/lib/opmapcontrol/src/internals/debugheader.h b/lib/opmapcontrol/src/internals/debugheader.h deleted file mode 100644 index 8e5bdba43fcf9b7268f83955973d6f6b3dc80d16..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/debugheader.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef DEBUGHEADER_H -#define DEBUGHEADER_H - -//#define DEBUG_CORE -//#define DEBUG_TILE -//#define DEBUG_TILEMATRIX - -#endif // DEBUGHEADER_H diff --git a/lib/opmapcontrol/src/internals/internals.pro b/lib/opmapcontrol/src/internals/internals.pro deleted file mode 100644 index 21ce6b4b6927d2fc385628ed03acb4e2e45bdb54..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/internals.pro +++ /dev/null @@ -1,35 +0,0 @@ -include (../common.pri) -HEADERS += core.h \ - mousewheelzoomtype.h \ - rectangle.h \ - tile.h \ - tilematrix.h \ - loadtask.h \ - copyrightstrings.h \ - pureprojection.h \ - pointlatlng.h \ - rectlatlng.h \ - sizelatlng.h \ - debugheader.h -SOURCES += core.cpp \ - rectangle.cpp \ - tile.cpp \ - tilematrix.cpp \ - pureprojection.cpp \ - rectlatlng.cpp \ - sizelatlng.cpp \ - pointlatlng.cpp \ - loadtask.cpp \ - mousewheelzoomtype.cpp -HEADERS += ./projections/lks94projection.h \ - ./projections/mercatorprojection.h \ - ./projections/mercatorprojectionyandex.h \ - ./projections/platecarreeprojection.h \ - ./projections/platecarreeprojectionpergo.h -SOURCES += ./projections/lks94projection.cpp \ - ./projections/mercatorprojection.cpp \ - ./projections/mercatorprojectionyandex.cpp \ - ./projections/platecarreeprojection.cpp \ - ./projections/platecarreeprojectionpergo.cpp -LIBS += -L../build \ - -lcore diff --git a/lib/opmapcontrol/src/internals/loadtask.cpp b/lib/opmapcontrol/src/internals/loadtask.cpp deleted file mode 100644 index 0deb23025b24f39f854193a2860decfeac165ac2..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/loadtask.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** -****************************************************************************** -* -* @file loadtask.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "loadtask.h" - - -namespace internals { -bool operator==(LoadTask const& lhs,LoadTask const& rhs) -{ - return ((lhs.Pos==rhs.Pos)&&(lhs.Zoom==rhs.Zoom)); -} -} diff --git a/lib/opmapcontrol/src/internals/loadtask.h b/lib/opmapcontrol/src/internals/loadtask.h deleted file mode 100644 index df38337b0a4349d2435cf5e70f6d5cc65c8d9359..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/loadtask.h +++ /dev/null @@ -1,65 +0,0 @@ -/** -****************************************************************************** -* -* @file loadtask.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef LOADTASK_H -#define LOADTASK_H - -#include -#include "../core/point.h" - -using namespace core; -namespace internals -{ -struct LoadTask - { - friend bool operator==(LoadTask const& lhs,LoadTask const& rhs); - public: - core::Point Pos; - int Zoom; - - - LoadTask(Point pos, int zoom) - { - Pos = pos; - Zoom = zoom; - } - LoadTask() - { - Pos=core::Point(-1,-1); - Zoom=-1; - } - bool HasValue() - { - return !(Zoom==-1); - } - - QString ToString()const - { - return QString::number(Zoom) + " - " + Pos.ToString(); - } - }; -} -#endif // LOADTASK_H diff --git a/lib/opmapcontrol/src/internals/mousewheelzoomtype.h b/lib/opmapcontrol/src/internals/mousewheelzoomtype.h deleted file mode 100644 index 218815c3697eaa9b1f9bb5c0154231703466c800..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/mousewheelzoomtype.h +++ /dev/null @@ -1,89 +0,0 @@ -/** -****************************************************************************** -* -* @file mousewheelzoomtype.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef MOUSEWHEELZOOMTYPE_H -#define MOUSEWHEELZOOMTYPE_H -#include -#include -#include -#include -#include -namespace internals { - class MouseWheelZoomType:public QObject - { - Q_OBJECT - Q_ENUMS(Types) - public: - enum Types - { - /// - /// zooms map to current mouse position and makes it map center - /// - MousePositionAndCenter, - - /// - /// zooms to current mouse position, but doesn't make it map center, - /// google/bing style ;} - /// - MousePositionWithoutCenter, - - /// - /// zooms map to current view center - /// - ViewCenter - }; - static QString StrByType(Types const& value) - { - QMetaObject metaObject = MouseWheelZoomType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - QString s=metaEnum.valueToKey(value); - return s; - } - static Types TypeByStr(QString const& value) - { - QMetaObject metaObject = MouseWheelZoomType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - Types s=(Types)metaEnum.keyToValue(value.toLatin1()); - return s; - } - static QStringList TypesList() - { - QStringList ret; - QMetaObject metaObject = MouseWheelZoomType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - for(int x=0;x -#include -#include "sizelatlng.h" - -namespace internals { -struct PointLatLng -{ - //friend uint qHash(PointLatLng const& point); - friend bool operator==(PointLatLng const& lhs,PointLatLng const& rhs); - friend bool operator!=(PointLatLng const& left, PointLatLng const& right); - friend PointLatLng operator+(PointLatLng pt, SizeLatLng sz); - friend PointLatLng operator-(PointLatLng pt, SizeLatLng sz); - - //TODO Sizelatlng friend PointLatLng operator+(PointLatLng pt, SizeLatLng sz); - - private: - double lat; - double lng; - bool empty; - public: - PointLatLng(); - - - static PointLatLng Empty; - - PointLatLng(const double &lat,const double &lng) - { - this->lat = lat; - this->lng = lng; - empty=false; - } - - bool IsEmpty() - { - return empty; - } - - double Lat()const - { - return this->lat; - } - - void SetLat(const double &value) - { - this->lat = value; - empty=false; - } - - - double Lng()const - { - return this->lng; - } - void SetLng(const double &value) - { - this->lng = value; - empty=false; - } - - - - - - static PointLatLng Add(PointLatLng const& pt, SizeLatLng const& sz) - { - return PointLatLng(pt.Lat() - sz.HeightLat(), pt.Lng() + sz.WidthLng()); - } - - static PointLatLng Subtract(PointLatLng const& pt, SizeLatLng const& sz) - { - return PointLatLng(pt.Lat() + sz.HeightLat(), pt.Lng() - sz.WidthLng()); - } - - - void Offset(PointLatLng const& pos) - { - this->Offset(pos.Lat(), pos.Lng()); - } - - void Offset(double const& lat, double const& lng) - { - this->lng += lng; - this->lat -= lat; - } - - - QString ToString()const - { - return QString("{Lat=%1, Lng=%2}").arg(this->lat).arg(this->lng); - } - -//// static PointLatLng() -//// { -//// Empty = new PointLatLng(); -//// } - }; - - -// -} -#endif // POINTLATLNG_H diff --git a/lib/opmapcontrol/src/internals/projections/lks94projection.cpp b/lib/opmapcontrol/src/internals/projections/lks94projection.cpp deleted file mode 100644 index f476ba2f17d1d0ecd089efaa7e26236b0983a614..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/projections/lks94projection.cpp +++ /dev/null @@ -1,788 +0,0 @@ -/** -****************************************************************************** -* -* @file lks94projection.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "lks94projection.h" - - - -namespace projections { -LKS94Projection::LKS94Projection():MinLatitude (53.33 ), MaxLatitude (56.55 ), MinLongitude (20.22 ), -MaxLongitude (27.11 ), orignX (5122000 ), orignY (10000100 ),tileSize(256, 256) -{ -} - -Size LKS94Projection::TileSize() const -{ - return tileSize; -} -double LKS94Projection::Axis() const -{ - return 6378137; -} -double LKS94Projection::Flattening() const -{ - - return (1.0 / 298.257222101); - -} - -Point LKS94Projection::FromLatLngToPixel(double lat, double lng, int const& zoom) -{ - Point ret; - - lat = Clip(lat, MinLatitude, MaxLatitude); - lng = Clip(lng, MinLongitude, MaxLongitude); - QVector lks(3); - lks[0]=lng; - lks[1]=lat; - lks = DTM10(lks); - lks = MTD10(lks); - lks = DTM00(lks); - - double res = GetTileMatrixResolution(zoom); - - ret.SetX((int) floor((lks[0] + orignX) / res)); - ret.SetY((int) floor((orignY - lks[1]) / res)); - - return ret; -} - -internals::PointLatLng LKS94Projection::FromPixelToLatLng(int const& x, int const& y, int const& zoom) -{ - internals::PointLatLng ret;// = internals::PointLatLng::Empty; - - double res = GetTileMatrixResolution(zoom); - - QVector lks(2); - lks[0]=(x * res) - orignX; - lks[1]=-(y * res) + orignY; - lks = MTD11(lks); - lks = DTM10(lks); - lks = MTD10(lks); - ret.SetLat(Clip(lks[1], MinLatitude, MaxLatitude)); - ret.SetLng(Clip(lks[0], MinLongitude, MaxLongitude)); - return ret; -} - -QVector LKS94Projection::DTM10(const QVector & lonlat) -{ - double es; // Eccentricity squared : (a^2 - b^2)/a^2 - double semiMajor = 6378137.0; // major axis - double semiMinor = 6356752.3142451793; // minor axis - double ab; // Semi_major / semi_minor - double ba; // Semi_minor / semi_major - double ses; // Second eccentricity squared : (a^2 - b^2)/b^2 - - es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor); //e^2 - ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2); - ba = semiMinor / semiMajor; - ab = semiMajor / semiMinor; - - // ... - - double lon = DegreesToRadians(lonlat[0]); - double lat = DegreesToRadians(lonlat[1]); - double h = lonlat.count() < 3 ? 0 : std::isnan(lonlat[2]) ? 0 : lonlat[2];//TODO NAN - double v = semiMajor / sqrt(1 - es * pow(sin(lat), 2)); - double x = (v + h) * cos(lat) * cos(lon); - double y = (v + h) * cos(lat) * sin(lon); - double z = ((1 - es) * v + h) * sin(lat); - QVector ret(3); - ret[0]=x; - ret[1]=y; - ret[2]=z; - return ret; -} -QVector LKS94Projection::MTD10(QVector & pnt) -{ - QVector ret(3); - const double COS_67P5 = 0.38268343236508977; // cosine of 67.5 degrees - const double AD_C = 1.0026000; // Toms region 1 constant - - double es; // Eccentricity squared : (a^2 - b^2)/a^2 - double semiMajor = 6378137.0; // major axis - double semiMinor = 6356752.3141403561; // minor axis - double ab; // Semi_major / semi_minor - double ba; // Semi_minor / semi_major - double ses; // Second eccentricity squared : (a^2 - b^2)/b^2 - - es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor); //e^2 - ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2); - ba = semiMinor / semiMajor; - ab = semiMajor / semiMinor; - - // ... - - bool AtPole = false; // is location in polar region - double Z = pnt.count() < 3 ? 0 : std::isnan(pnt[2]) ? 0 : pnt[2];//TODO NaN - - double lon = 0; - double lat = 0; - double Height = 0; - if(pnt[0] != 0.0) - { - lon = atan2(pnt[1], pnt[0]); - } - else - { - if(pnt[1] > 0) - { - lon = M_PI / 2; - } - else - if(pnt[1] < 0) - { - lon = -M_PI * 0.5; - } - else - { - AtPole = true; - lon = 0.0; - if(Z > 0.0) // north pole - { - lat = M_PI * 0.5; - } - else - if(Z < 0.0) // south pole - { - lat = -M_PI * 0.5; - } - else // center of earth - { - ret[0]=RadiansToDegrees(lon); - ret[1]=RadiansToDegrees(M_PI * 0.5); - ret[2]=-semiMinor; - return ret; - } - } - } - double W2 = pnt[0] * pnt[0] + pnt[1] * pnt[1]; // Square of distance from Z axis - double W = sqrt(W2); // distance from Z axis - double T0 = Z * AD_C; // initial estimate of vertical component - double S0 = sqrt(T0 * T0 + W2); // initial estimate of horizontal component - double Sin_B0 = T0 / S0; // sin(B0), B0 is estimate of Bowring aux variable - double Cos_B0 = W / S0; // cos(B0) - double Sin3_B0 = pow(Sin_B0, 3); - double T1 = Z + semiMinor * ses * Sin3_B0; // corrected estimate of vertical component - double Sum = W - semiMajor * es * Cos_B0 * Cos_B0 * Cos_B0; // numerator of cos(phi1) - double S1 = sqrt(T1 * T1 + Sum * Sum); // corrected estimate of horizontal component - double Sin_p1 = T1 / S1; // sin(phi1), phi1 is estimated latitude - double Cos_p1 = Sum / S1; // cos(phi1) - double Rn = semiMajor / sqrt(1.0 - es * Sin_p1 * Sin_p1); // Earth radius at location - if(Cos_p1 >= COS_67P5) - { - Height = W / Cos_p1 - Rn; - } - else - if(Cos_p1 <= -COS_67P5) - { - Height = W / -Cos_p1 - Rn; - } - else - { - Height = Z / Sin_p1 + Rn * (es - 1.0); - } - - if(!AtPole) - { - lat = atan(Sin_p1 / Cos_p1); - } - ret[0]=RadiansToDegrees(lon); - ret[1]=RadiansToDegrees(lat); - ret[2]=Height; - return ret; -} -QVector LKS94Projection::DTM00(QVector & lonlat) -{ - double scaleFactor = 0.9998; // scale factor - double centralMeridian = 0.41887902047863912; // Center qlonglongitude (projection center) */ - double latOrigin = 0.0; // center latitude - double falseNorthing = 0.0; // y offset in meters - double falseEasting = 500000.0; // x offset in meters - double semiMajor = 6378137.0; // major axis - double semiMinor = 6356752.3141403561; // minor axis - double metersPerUnit = 1.0; - - double e0, e1, e2, e3; // eccentricity constants - double e, es, esp; // eccentricity constants - double ml0; // small value m - - es = 1.0 - pow(semiMinor / semiMajor, 2); - e = sqrt(es); - e0 = e0fn(es); - e1 = e1fn(es); - e2 = e2fn(es); - e3 = e3fn(es); - ml0 = semiMajor * mlfn(e0, e1, e2, e3, latOrigin); - esp = es / (1.0 - es); - - // ... - - double lon = DegreesToRadians(lonlat[0]); - double lat = DegreesToRadians(lonlat[1]); - - double delta_lon = 0.0; // Delta qlonglongitude (Given qlonglongitude - center) - double sin_phi, cos_phi; // sin and cos value - double al, als; // temporary values - double c, t, tq; // temporary values - double con, n, ml; // cone constant, small m - - delta_lon = LKS94Projection::AdjustLongitude(lon - centralMeridian); - LKS94Projection::SinCos(lat, sin_phi, cos_phi); - - al = cos_phi * delta_lon; - als = pow(al, 2); - c = pow(cos_phi, 2); - tq = tan(lat); - t = pow(tq, 2); - con = 1.0 - es * pow(sin_phi, 2); - n = semiMajor / sqrt(con); - ml = semiMajor * mlfn(e0, e1, e2, e3, lat); - - double x = scaleFactor * n * al * (1.0 + als / 6.0 * (1.0 - t + c + als / 20.0 * - (5.0 - 18.0 * t + pow(t, 2) + 72.0 * c - 58.0 * esp))) + falseEasting; - - double y = scaleFactor * (ml - ml0 + n * tq * (als * (0.5 + als / 24.0 * - (5.0 - t + 9.0 * c + 4.0 * pow(c, 2) + als / 30.0 * (61.0 - 58.0 * t - + pow(t, 2) + 600.0 * c - 330.0 * esp))))) + falseNorthing; - - if(lonlat.count() < 3) - { - QVector ret(2); - ret[0]= x / metersPerUnit; - ret[1]= y / metersPerUnit; - return ret; - } - else - { - QVector ret(3); - ret[0]= x / metersPerUnit; - ret[1]= y / metersPerUnit; - ret[2]=lonlat[2]; - return ret; - } -} - -QVector LKS94Projection::DTM01(QVector & lonlat) -{ - double es; // Eccentricity squared : (a^2 - b^2)/a^2 - double semiMajor = 6378137.0; // major axis - double semiMinor = 6356752.3141403561; // minor axis - double ab; // Semi_major / semi_minor - double ba; // Semi_minor / semi_major - double ses; // Second eccentricity squared : (a^2 - b^2)/b^2 - - es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor); - ses = (pow(semiMajor, 2) -pow(semiMinor, 2)) / pow(semiMinor, 2); - ba = semiMinor / semiMajor; - ab = semiMajor / semiMinor; - - // ... - - double lon = DegreesToRadians(lonlat[0]); - double lat = DegreesToRadians(lonlat[1]); - double h = lonlat.count() < 3 ? 0 : std::isnan(lonlat[2]) ? 0 : lonlat[2];//TODO NaN - double v = semiMajor / sqrt(1 - es * pow(sin(lat), 2)); - double x = (v + h) * cos(lat) * cos(lon); - double y = (v + h) * cos(lat) * sin(lon); - double z = ((1 - es) * v + h) * sin(lat); - QVector ret(3); - ret[0]=x; - ret[1]=y; - ret[2]=z; - return ret; -} -QVector LKS94Projection::MTD01(QVector & pnt) -{ - const double COS_67P5 = 0.38268343236508977; // cosine of 67.5 degrees - const double AD_C = 1.0026000; // Toms region 1 constant - - double es; // Eccentricity squared : (a^2 - b^2)/a^2 - double semiMajor = 6378137.0; // major axis - double semiMinor = 6356752.3142451793; // minor axis - double ab; // Semi_major / semi_minor - double ba; // Semi_minor / semi_major - double ses; // Second eccentricity squared : (a^2 - b^2)/b^2 - - es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor); - ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2); - ba = semiMinor / semiMajor; - ab = semiMajor / semiMinor; - - // ... - - bool At_Pole = false; // is location in polar region - double Z = pnt.count() < 3 ? 0 : std::isnan(pnt[2]) ? 0 : pnt[2];//TODO NaN - - double lon = 0; - double lat = 0; - double Height = 0; - if(pnt[0] != 0.0) - { - lon = atan2(pnt[1], pnt[0]); - } - else - { - if(pnt[1] > 0) - { - lon = M_PI / 2; - } - else - if(pnt[1] < 0) - { - lon = -M_PI * 0.5; - } - else - { - At_Pole = true; - lon = 0.0; - if(Z > 0.0) // north pole - { - lat = M_PI * 0.5; - } - else - if(Z < 0.0) // south pole - { - lat = -M_PI * 0.5; - } - else // center of earth - { - QVector ret(3); - ret[0]=RadiansToDegrees(lon); - ret[1]=RadiansToDegrees(M_PI * 0.5); - ret[2]=-semiMinor; - return ret; - } - } - } - - double W2 = pnt[0] * pnt[0] + pnt[1] * pnt[1]; // Square of distance from Z axis - double W = sqrt(W2); // distance from Z axis - double T0 = Z * AD_C; // initial estimate of vertical component - double S0 = sqrt(T0 * T0 + W2); //initial estimate of horizontal component - double Sin_B0 = T0 / S0; // sin(B0), B0 is estimate of Bowring aux variable - double Cos_B0 = W / S0; // cos(B0) - double Sin3_B0 = pow(Sin_B0, 3); - double T1 = Z + semiMinor * ses * Sin3_B0; //corrected estimate of vertical component - double Sum = W - semiMajor * es * Cos_B0 * Cos_B0 * Cos_B0; // numerator of cos(phi1) - double S1 = sqrt(T1 * T1 + Sum * Sum); // corrected estimate of horizontal component - double Sin_p1 = T1 / S1; // sin(phi1), phi1 is estimated latitude - double Cos_p1 = Sum / S1; // cos(phi1) - double Rn = semiMajor / sqrt(1.0 - es * Sin_p1 * Sin_p1); // Earth radius at location - - if(Cos_p1 >= COS_67P5) - { - Height = W / Cos_p1 - Rn; - } - else - if(Cos_p1 <= -COS_67P5) - { - Height = W / -Cos_p1 - Rn; - } - else - { - Height = Z / Sin_p1 + Rn * (es - 1.0); - } - - if(!At_Pole) - { - lat = atan(Sin_p1 / Cos_p1); - } - QVector ret(3); - ret[0]=RadiansToDegrees(lon); - ret[1]=RadiansToDegrees(lat); - ret[2]=Height; - return ret; -} -QVector LKS94Projection::MTD11(QVector & p) -{ - double scaleFactor = 0.9998; // scale factor - double centralMeridian = 0.41887902047863912; // Center qlonglongitude (projection center) - double latOrigin = 0.0; // center latitude - double falseNorthing = 0.0; // y offset in meters - double falseEasting = 500000.0; // x offset in meters - double semiMajor = 6378137.0; // major axis - double semiMinor = 6356752.3141403561; // minor axis - double metersPerUnit = 1.0; - - double e0, e1, e2, e3; // eccentricity constants - double e, es, esp; // eccentricity constants - double ml0; // small value m - - es =(semiMinor * semiMinor) / (semiMajor * semiMajor); - es=1.0-es; - e = sqrt(es); - e0 = e0fn(es); - e1 = e1fn(es); - e2 = e2fn(es); - e3 = e3fn(es); - ml0 = semiMajor * mlfn(e0, e1, e2, e3, latOrigin); - esp = es / (1.0 - es); - - // ... - - double con, phi; - double delta_phi; - qlonglong i; - double sin_phi, cos_phi, tan_phi; - double c, cs, t, ts, n, r, d, ds; - qlonglong max_iter = 6; - - double x = p[0] * metersPerUnit - falseEasting; - double y = p[1] * metersPerUnit - falseNorthing; - - con = (ml0 + y / scaleFactor) / semiMajor; - phi = con; - for(i = 0; ; i++) - { - delta_phi = ((con + e1 * sin(2.0 * phi) - e2 * sin(4.0 * phi) + e3 * sin(6.0 * phi)) / e0) - phi; - phi += delta_phi; - if(fabs(delta_phi) <= EPSLoN) - break; - - if(i >= max_iter) - throw "Latitude failed to converge"; - } - - if(fabs(phi) < HALF_PI) - { - SinCos(phi, sin_phi, cos_phi); - tan_phi = tan(phi); - c = esp * pow(cos_phi, 2); - cs = pow(c, 2); - t = pow(tan_phi, 2); - ts = pow(t, 2); - con = 1.0 - es * pow(sin_phi, 2); - n = semiMajor / sqrt(con); - r = n * (1.0 - es) / con; - d = x / (n * scaleFactor); - ds = pow(d, 2); - - double lat = phi - (n * tan_phi * ds / r) * (0.5 - ds / 24.0 * (5.0 + 3.0 * t + - 10.0 * c - 4.0 * cs - 9.0 * esp - ds / 30.0 * (61.0 + 90.0 * t + - 298.0 * c + 45.0 * ts - 252.0 * esp - 3.0 * cs))); - - double lon = AdjustLongitude(centralMeridian + (d * (1.0 - ds / 6.0 * (1.0 + 2.0 * t + - c - ds / 20.0 * (5.0 - 2.0 * c + 28.0 * t - 3.0 * cs + 8.0 * esp + - 24.0 * ts))) / cos_phi)); - - if(p.count() < 3) - { - QVector ret(2); - ret[0]= RadiansToDegrees(lon); - ret[1]= RadiansToDegrees(lat); - return ret; - } - else - { - QVector ret(3); - ret[0]= RadiansToDegrees(lon); - ret[1]= RadiansToDegrees(lat); - ret[2]=p[2]; - return ret; - //return new double[] { RadiansToDegrees(lon), RadiansToDegrees(lat), p[2] }; - } - } - else - { - if(p.count() < 3) - { - QVector ret(2); - ret[0]= RadiansToDegrees(HALF_PI * Sign(y)); - ret[1]= RadiansToDegrees(centralMeridian); - return ret; - } - - else - { - QVector ret(3); - ret[0]= RadiansToDegrees(HALF_PI * Sign(y)); - ret[1]= RadiansToDegrees(centralMeridian); - ret[2]=p[2]; - return ret; - } - - } -} - -double LKS94Projection::Clip(double const& n, double const& minValue, double const& maxValue) -{ - return qMin(qMax(n, minValue), maxValue); -} -double LKS94Projection::GetTileMatrixResolution(int const& zoom) -{ - double ret = 0; - - switch(zoom) - { - case 0: - { - ret = 1587.50317500635; - } - break; - - case 1: - { - ret = 793.751587503175; - } - break; - - case 2: - { - ret = 529.167725002117; - } - break; - - case 3: - { - ret = 264.583862501058; - } - break; - - case 4: - { - ret = 132.291931250529; - } - break; - - case 5: - { - ret = 52.9167725002117; - } - break; - - case 6: - { - ret = 26.4583862501058; - } - break; - - case 7: - { - ret = 13.2291931250529; - } - break; - - case 8: - { - ret = 6.61459656252646; - } - break; - - case 9: - { - ret = 2.64583862501058; - } - break; - - case 10: - { - ret = 1.32291931250529; - } - break; - - case 11: - { - ret = 0.529167725002117; - } - break; - - } - - return ret; -} -double LKS94Projection::GetGroundResolution(int const& zoom, double const& latitude) -{ - Q_UNUSED(zoom); - Q_UNUSED(latitude); - return GetTileMatrixResolution(zoom); -} -Size LKS94Projection::GetTileMatrixMinXY(int const& zoom) -{ - Size ret; - - switch(zoom) - { - - case 0: - { - ret = Size(12, 8); - } - break; - - case 1: - { - ret = Size(24, 17); - } - break; - - case 2: - { - ret = Size(37, 25); - } - break; - - case 3: - { - ret = Size(74, 51); - } - break; - - case 4: - { - ret = Size(149, 103); - } - break; - - case 5: - { - ret = Size(374, 259); - } - break; - - case 6: - { - ret = Size(749, 519); - } - break; - - case 7: - { - ret = Size(1594, 1100); - } - break; - - case 8: - { - ret = Size(3188, 2201); - } - break; - - case 9: - { - ret = Size(7971, 5502); - } - break; - - case 10: - { - ret = Size(15943, 11005); - } - break; - - case 11: - { - ret = Size(39858, 27514); - } - break; - } - - return ret; -} - -Size LKS94Projection::GetTileMatrixMaxXY(int const& zoom) -{ - Size ret; - - switch(zoom) - { - case 0: - { - ret = Size(14, 10); - } - break; - - case 1: - { - ret = Size(30, 20); - } - break; - - case 2: - { - ret = Size(45, 31); - } - break; - - case 3: - { - ret = Size(90, 62); - } - break; - - case 4: - { - ret = Size(181, 125); - } - break; - - case 5: - { - ret = Size(454, 311); - } - break; - - case 6: - { - ret = Size(903, 623); - } - break; - - case 7: - { - ret = Size(1718, 1193); - } - break; - - case 8: - { - ret = Size(3437, 2386); - } - break; - - case 9: - { - ret = Size(8594, 5966); - } - break; - - case 10: - { - ret = Size(17189, 11932); - } - break; - - case 11: - { - ret = Size(42972, 29831); - } - break; - } - - return ret; -} - -} diff --git a/lib/opmapcontrol/src/internals/projections/lks94projection.h b/lib/opmapcontrol/src/internals/projections/lks94projection.h deleted file mode 100644 index 4eee20aaa84f6b897042bd15267325a59f580d60..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/projections/lks94projection.h +++ /dev/null @@ -1,72 +0,0 @@ -/** -****************************************************************************** -* -* @file lks94projection.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef LKS94PROJECTION_H -#define LKS94PROJECTION_H -#include -#include "cmath" -#include "../pureprojection.h" - - -namespace projections { -class LKS94Projection:public internals::PureProjection -{ -public: - LKS94Projection(); - double GetTileMatrixResolution(int const& zoom); - virtual QString Type(){return "LKS94Projection";} - virtual Size TileSize() const; - virtual double Axis() const; - virtual double Flattening() const; - virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom); - virtual internals::PointLatLng FromPixelToLatLng(int const& x, int const& y, int const& zoom); - virtual double GetGroundResolution(int const& zoom, double const& latitude); - virtual Size GetTileMatrixMinXY(int const& zoom); - virtual Size GetTileMatrixMaxXY(int const& zoom); - -private: - const double MinLatitude; - const double MaxLatitude; - const double MinLongitude; - const double MaxLongitude; - const double orignX; - const double orignY; - Size tileSize; - QVector DTM10(const QVector & lonlat); - QVector MTD10(QVector & pnt); - QVector DTM00(QVector & lonlat); - QVector DTM01(QVector & lonlat); - QVector MTD01(QVector & pnt); - QVector MTD11(QVector & p); - double Clip(double const& n, double const& minValue, double const& maxValue); -}; - -} -#endif // LKS94PROJECTION_H - - - - diff --git a/lib/opmapcontrol/src/internals/projections/mercatorprojection.cpp b/lib/opmapcontrol/src/internals/projections/mercatorprojection.cpp deleted file mode 100644 index 30b94d2e4d69e402536e14473d18187ef355697b..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/projections/mercatorprojection.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/** -****************************************************************************** -* -* @file mercatorprojection.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "mercatorprojection.h" - - -namespace projections { -MercatorProjection::MercatorProjection():MinLatitude(-85.05112878), MaxLatitude(85.05112878),MinLongitude(-177), -MaxLongitude(177), tileSize(256, 256) -{ -} -Point MercatorProjection::FromLatLngToPixel(double lat, double lng, const int &zoom) -{ - Point ret;// = Point.Empty; - - lat = Clip(lat, MinLatitude, MaxLatitude); - lng = Clip(lng, MinLongitude, MaxLongitude); - - double x = (lng + 180) / 360; - double sinLatitude = sin(lat * M_PI / 180); - double y = 0.5 - log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * M_PI); - - Size s = GetTileMatrixSizePixel(zoom); - int mapSizeX = s.Width(); - int mapSizeY = s.Height(); - - ret.SetX((int) Clip(x * mapSizeX + 0.5, 0, mapSizeX - 1)); - ret.SetY((int) Clip(y * mapSizeY + 0.5, 0, mapSizeY - 1)); - - return ret; -} -internals::PointLatLng MercatorProjection::FromPixelToLatLng(const int &x, const int &y, const int &zoom) -{ - internals::PointLatLng ret;// = internals::PointLatLng.Empty; - - Size s = GetTileMatrixSizePixel(zoom); - double mapSizeX = s.Width(); - double mapSizeY = s.Height(); - - double xx = (Clip(x, 0, mapSizeX - 1) / mapSizeX) - 0.5; - double yy = 0.5 - (Clip(y, 0, mapSizeY - 1) / mapSizeY); - - ret.SetLat(90 - 360 * atan(exp(-yy * 2 * M_PI)) / M_PI); - ret.SetLng(360 * xx); - - return ret; -} -double MercatorProjection::Clip(const double &n, const double &minValue, const double &maxValue) const -{ - return qMin(qMax(n, minValue), maxValue); -} -Size MercatorProjection::TileSize() const -{ - return tileSize; -} -double MercatorProjection::Axis() const -{ - return 6378137; -} -double MercatorProjection::Flattening() const -{ - return (1.0 / 298.257223563); -} -Size MercatorProjection::GetTileMatrixMaxXY(const int &zoom) -{ - Q_UNUSED(zoom); - int xy = (1 << zoom); - return Size(xy - 1, xy - 1); -} -Size MercatorProjection::GetTileMatrixMinXY(const int &zoom) -{ - Q_UNUSED(zoom); - return Size(0, 0); -} -} diff --git a/lib/opmapcontrol/src/internals/projections/mercatorprojection.h b/lib/opmapcontrol/src/internals/projections/mercatorprojection.h deleted file mode 100644 index 1c55f5638072e6c69e53b6b35520c9e34668ca90..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/projections/mercatorprojection.h +++ /dev/null @@ -1,55 +0,0 @@ -/** -****************************************************************************** -* -* @file mercatorprojection.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef MERCATORPROJECTION_H -#define MERCATORPROJECTION_H -#include "../pureprojection.h" - - -namespace projections { - class MercatorProjection:public internals::PureProjection -{ -public: - MercatorProjection(); - virtual QString Type(){return "MercatorProjection";} - virtual Size TileSize() const; - virtual double Axis() const; - virtual double Flattening()const; - virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom); - virtual internals::PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom); - virtual Size GetTileMatrixMinXY(const int &zoom); - virtual Size GetTileMatrixMaxXY(const int &zoom); -private: - const double MinLatitude; - const double MaxLatitude; - const double MinLongitude; - const double MaxLongitude; - double Clip(double const& n, double const& minValue, double const& maxValue)const; - Size tileSize; -}; - -} -#endif // MERCATORPROJECTION_H diff --git a/lib/opmapcontrol/src/internals/projections/mercatorprojectionyandex.cpp b/lib/opmapcontrol/src/internals/projections/mercatorprojectionyandex.cpp deleted file mode 100644 index 0a695308dfdd6decd40af08429b13ab7c9d83edf..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/projections/mercatorprojectionyandex.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/** -****************************************************************************** -* -* @file mercatorprojectionyandex.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "mercatorprojectionyandex.h" - - - -namespace projections { -MercatorProjectionYandex::MercatorProjectionYandex():MinLatitude(-85.05112878), MaxLatitude(85.05112878),MinLongitude(-177), -MaxLongitude(177), RAD_DEG(180 / M_PI),DEG_RAD(M_PI / 180),MathPiDiv4(M_PI / 4),tileSize(256, 256) -{ -} -Point MercatorProjectionYandex::FromLatLngToPixel(double lat, double lng, const int &zoom) -{ - lat = Clip(lat, MinLatitude, MaxLatitude); - lng = Clip(lng, MinLongitude, MaxLongitude); - - double rLon = lng * DEG_RAD; // Math.PI / 180; - double rLat = lat * DEG_RAD; // Math.PI / 180; - - double a = 6378137; - double k = 0.0818191908426; - - double z = tan(MathPiDiv4 + rLat / 2) / pow((tan(MathPiDiv4 + asin(k * sin(rLat)) / 2)), k); - double z1 = pow(2, 23 - zoom); - - double DX = ((20037508.342789 + a * rLon) * 53.5865938 / z1); - double DY = ((20037508.342789 - a * log(z)) * 53.5865938 / z1); - - Point ret;// = Point.Empty; - ret.SetX((int) DX); - ret.SetY((int) DY); - - return ret; - -} -internals::PointLatLng MercatorProjectionYandex::FromPixelToLatLng(const int &x, const int &y, const int &zoom) -{ - Size s = GetTileMatrixSizePixel(zoom); - - //double mapSizeX = s.Width(); - //double mapSizeY = s.Height(); - - double a = 6378137; - double c1 = 0.00335655146887969; - double c2 = 0.00000657187271079536; - double c3 = 0.00000001764564338702; - double c4 = 0.00000000005328478445; - double z1 = (23 - zoom); - double mercX = (x * pow(2, z1)) / 53.5865938 - 20037508.342789; - double mercY = 20037508.342789 - (y *pow(2, z1)) / 53.5865938; - - double g = M_PI /2 - 2 *atan(1 / exp(mercY /a)); - double z = g + c1 * sin(2 * g) + c2 * sin(4 * g) + c3 * sin(6 * g) + c4 * sin(8 * g); - - internals::PointLatLng ret;// = internals::PointLatLng.Empty; - ret.SetLat(z * RAD_DEG); - ret.SetLng (mercX / a * RAD_DEG); - - return ret; -} -double MercatorProjectionYandex::Clip(const double &n, const double &minValue, const double &maxValue) const -{ - return qMin(qMax(n, minValue), maxValue); -} -Size MercatorProjectionYandex::TileSize() const -{ - return tileSize; -} -double MercatorProjectionYandex::Axis() const -{ - return 6356752.3142; -} -double MercatorProjectionYandex::Flattening() const -{ - return (1.0 / 298.257223563); -} -Size MercatorProjectionYandex::GetTileMatrixMaxXY(const int &zoom) -{ - int xy = (1 << zoom); - return Size(xy - 1, xy - 1); -} - -Size MercatorProjectionYandex::GetTileMatrixMinXY(const int &zoom) -{ - Q_UNUSED(zoom); - return Size(0, 0); -} -} diff --git a/lib/opmapcontrol/src/internals/projections/mercatorprojectionyandex.h b/lib/opmapcontrol/src/internals/projections/mercatorprojectionyandex.h deleted file mode 100644 index 949f83f1f113c5aa051b3237680a8a6aaa4db445..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/projections/mercatorprojectionyandex.h +++ /dev/null @@ -1,59 +0,0 @@ -/** -****************************************************************************** -* -* @file mercatorprojectionyandex.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef MERCATORPROJECTIONYANDEX_H -#define MERCATORPROJECTIONYANDEX_H - -#include "../pureprojection.h" - - -namespace projections { - class MercatorProjectionYandex:public internals::PureProjection -{ -public: - MercatorProjectionYandex(); - virtual QString Type(){return "MercatorProjectionYandex";} - virtual Size TileSize() const; - virtual double Axis() const; - virtual double Flattening()const; - virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom); - virtual internals::PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom); - virtual Size GetTileMatrixMinXY(const int &zoom); - virtual Size GetTileMatrixMaxXY(const int &zoom); -private: - const double MinLatitude; - const double MaxLatitude; - const double MinLongitude; - const double MaxLongitude; - const double RAD_DEG; - const double DEG_RAD; - const double MathPiDiv4; - double Clip(double const& n, double const& minValue, double const& maxValue)const; - Size tileSize; -}; - -} -#endif // MERCATORPROJECTIONYANDEX_H diff --git a/lib/opmapcontrol/src/internals/projections/platecarreeprojection.cpp b/lib/opmapcontrol/src/internals/projections/platecarreeprojection.cpp deleted file mode 100644 index be3989d920e83f73d507c6c806b586a7d962eded..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/projections/platecarreeprojection.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/** -****************************************************************************** -* -* @file platecarreeprojection.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "platecarreeprojection.h" - - - -namespace projections { -PlateCarreeProjection::PlateCarreeProjection():MinLatitude(-85.05112878), MaxLatitude(85.05112878),MinLongitude(-180), -MaxLongitude(180), tileSize(512, 512) -{ -} -Point PlateCarreeProjection::FromLatLngToPixel(double lat, double lng, const int &zoom) -{ - Point ret;// = Point.Empty; - - lat = Clip(lat, MinLatitude, MaxLatitude); - lng = Clip(lng, MinLongitude, MaxLongitude); - - Size s = GetTileMatrixSizePixel(zoom); - double mapSizeX = s.Width(); - //double mapSizeY = s.Height(); - - double scale = 360.0 / mapSizeX; - - ret.SetY((int) ((90.0 - lat) / scale)); - ret.SetX((int) ((lng + 180.0) / scale)); - - return ret; - -} -internals::PointLatLng PlateCarreeProjection::FromPixelToLatLng(const int &x, const int &y, const int &zoom) -{ - internals::PointLatLng ret;// = internals::PointLatLng.Empty; - - Size s = GetTileMatrixSizePixel(zoom); - double mapSizeX = s.Width(); - //double mapSizeY = s.Height(); - - double scale = 360.0 / mapSizeX; - - ret.SetLat(90 - (y * scale)); - ret.SetLng((x * scale) - 180); - - return ret; -} -double PlateCarreeProjection::Clip(const double &n, const double &minValue, const double &maxValue) const -{ - return qMin(qMax(n, minValue), maxValue); -} -Size PlateCarreeProjection::TileSize() const -{ - return tileSize; -} -double PlateCarreeProjection::Axis() const -{ - return 6378137; -} -double PlateCarreeProjection::Flattening() const -{ - return (1.0 / 298.257223563); -} -Size PlateCarreeProjection::GetTileMatrixMaxXY(const int &zoom) -{ - int y = (int) pow(2, zoom); - return Size((2*y) - 1, y - 1); -} - -Size PlateCarreeProjection::GetTileMatrixMinXY(const int &zoom) -{ - return Size(0, 0); -} -} diff --git a/lib/opmapcontrol/src/internals/projections/platecarreeprojection.h b/lib/opmapcontrol/src/internals/projections/platecarreeprojection.h deleted file mode 100644 index c57285a2fcf1e29c3e15b40dc2f409f4f9f9d487..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/projections/platecarreeprojection.h +++ /dev/null @@ -1,56 +0,0 @@ -/** -****************************************************************************** -* -* @file platecarreeprojection.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef PLATECARREEPROJECTION_H -#define PLATECARREEPROJECTION_H - -#include "../pureprojection.h" - - -namespace projections { -class PlateCarreeProjection:public internals::PureProjection -{ -public: - PlateCarreeProjection(); - virtual QString Type(){return "PlateCarreeProjection";} - virtual Size TileSize() const; - virtual double Axis() const; - virtual double Flattening()const; - virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom); - virtual internals::PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom); - virtual Size GetTileMatrixMinXY(const int &zoom); - virtual Size GetTileMatrixMaxXY(const int &zoom); -private: - const double MinLatitude; - const double MaxLatitude; - const double MinLongitude; - const double MaxLongitude; - - double Clip(double const& n, double const& minValue, double const& maxValue)const; - Size tileSize; -}; -} -#endif // PLATECARREEPROJECTION_H diff --git a/lib/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.cpp b/lib/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.cpp deleted file mode 100644 index c9ad01d1f379d131ec5d9521141199b4f06ff399..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/** -****************************************************************************** -* -* @file platecarreeprojectionpergo.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "platecarreeprojectionpergo.h" - - -namespace projections { -PlateCarreeProjectionPergo::PlateCarreeProjectionPergo():MinLatitude(-85.05112878), MaxLatitude(85.05112878),MinLongitude(-180), -MaxLongitude(180), tileSize(256, 256) -{ -} -Point PlateCarreeProjectionPergo::FromLatLngToPixel(double lat, double lng, const int &zoom) -{ - Point ret;// = Point.Empty; - - lat = Clip(lat, MinLatitude, MaxLatitude); - lng = Clip(lng, MinLongitude, MaxLongitude); - - Size s = GetTileMatrixSizePixel(zoom); - double mapSizeX = s.Width(); - //double mapSizeY = s.Height(); - - double scale = 360.0 / mapSizeX; - - ret.SetY((int) ((90.0 - lat) / scale)); - ret.SetX((int) ((lng + 180.0) / scale)); - - return ret; -} -internals::PointLatLng PlateCarreeProjectionPergo::FromPixelToLatLng(const int &x, const int &y, const int &zoom) -{ - internals::PointLatLng ret;// = internals::PointLatLng.Empty; - - Size s = GetTileMatrixSizePixel(zoom); - double mapSizeX = s.Width(); - //double mapSizeY = s.Height(); - - double scale = 360.0 / mapSizeX; - - ret.SetLat(90 - (y * scale)); - ret.SetLng((x * scale) - 180); - - return ret; -} - -double PlateCarreeProjectionPergo::Clip(const double &n, const double &minValue, const double &maxValue) const -{ - return qMin(qMax(n, minValue), maxValue); -} -Size PlateCarreeProjectionPergo::TileSize() const -{ - return tileSize; -} -double PlateCarreeProjectionPergo::Axis() const -{ - return 6378137; -} -double PlateCarreeProjectionPergo::Flattening() const -{ - return (1.0 / 298.257223563); -} -Size PlateCarreeProjectionPergo::GetTileMatrixMaxXY(const int &zoom) -{ - int y = (int) pow(2, zoom); - return Size((2*y) - 1, y - 1); -} - -Size PlateCarreeProjectionPergo::GetTileMatrixMinXY(const int &zoom) -{ - return Size(0, 0); -} -} diff --git a/lib/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.h b/lib/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.h deleted file mode 100644 index f0ca29fdff788b99d743a7bd26476990bffd9194..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.h +++ /dev/null @@ -1,56 +0,0 @@ -/** -****************************************************************************** -* -* @file platecarreeprojectionpergo.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef PLATECARREEPROJECTIONPERGO_H -#define PLATECARREEPROJECTIONPERGO_H - -#include "../pureprojection.h" - - -namespace projections { -class PlateCarreeProjectionPergo:public internals::PureProjection -{ -public: - PlateCarreeProjectionPergo(); - virtual QString Type(){return "PlateCarreeProjectionPergo";} - virtual Size TileSize() const; - virtual double Axis() const; - virtual double Flattening()const; - virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom); - virtual internals::PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom); - virtual Size GetTileMatrixMinXY(const int &zoom); - virtual Size GetTileMatrixMaxXY(const int &zoom); -private: - const double MinLatitude; - const double MaxLatitude; - const double MinLongitude; - const double MaxLongitude; - - double Clip(double const& n, double const& minValue, double const& maxValue)const; - Size tileSize; -}; -} -#endif // PLATECARREEPROJECTIONPERGO_H diff --git a/lib/opmapcontrol/src/internals/pureprojection.cpp b/lib/opmapcontrol/src/internals/pureprojection.cpp deleted file mode 100644 index 432defd06577bd6f7ca6cadadee5df12af8af7e8..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/pureprojection.cpp +++ /dev/null @@ -1,232 +0,0 @@ -/** -****************************************************************************** -* -* @file pureprojection.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "pureprojection.h" - - - - - - -namespace internals { - -const double PureProjection::PI = M_PI; -const double PureProjection::HALF_PI = (M_PI * 0.5); -const double PureProjection::TWO_PI= (M_PI * 2.0); -const double PureProjection::EPSLoN= 1.0e-10; -const double PureProjection::MAX_VAL= 4; -const double PureProjection::MAXLONG= 2147483647; -const double PureProjection::DBLLONG= 4.61168601e18; -const double PureProjection::R2D=180/M_PI; -const double PureProjection::D2R=M_PI/180; - -Point PureProjection::FromLatLngToPixel(const PointLatLng &p,const int &zoom) - { - return FromLatLngToPixel(p.Lat(), p.Lng(), zoom); - } - - - PointLatLng PureProjection::FromPixelToLatLng(const Point &p,const int &zoom) - { - return FromPixelToLatLng(p.X(), p.Y(), zoom); - } - - Point PureProjection::FromPixelToTileXY(const Point &p) - { - return Point((int) (p.X() / TileSize().Width()), (int) (p.Y() / TileSize().Height())); - } - - Point PureProjection::FromTileXYToPixel(const Point &p) - { - return Point((p.X() * TileSize().Width()), (p.Y() * TileSize().Height())); - } - - Size PureProjection::GetTileMatrixSizeXY(const int &zoom) - { - Size sMin = GetTileMatrixMinXY(zoom); - Size sMax = GetTileMatrixMaxXY(zoom); - - return Size(sMax.Width() - sMin.Width() + 1, sMax.Height() - sMin.Height() + 1); - } - int PureProjection::GetTileMatrixItemCount(const int &zoom) - { - Size s = GetTileMatrixSizeXY(zoom); - return (s.Width() * s.Height()); - } - Size PureProjection::GetTileMatrixSizePixel(const int &zoom) - { - Size s = GetTileMatrixSizeXY(zoom); - return Size(s.Width() * TileSize().Width(), s.Height() * TileSize().Height()); - } - QList PureProjection::GetAreaTileList(const RectLatLng &rect,const int &zoom,const int &padding) - { - QList ret; - - Point topLeft = FromPixelToTileXY(FromLatLngToPixel(rect.LocationTopLeft(), zoom)); - Point rightBottom = FromPixelToTileXY(FromLatLngToPixel(rect.Bottom(), rect.Right(), zoom)); - - for(int x = (topLeft.X() - padding); x <= (rightBottom.X() + padding); x++) - { - for(int y = (topLeft.Y() - padding); y <= (rightBottom.Y() + padding); y++) - { - Point p = Point(x, y); - if(!ret.contains(p) && p.X() >= 0 && p.Y() >= 0) - { - ret.append(p); - } - } - } - //ret.TrimExcess(); - - return ret; - } - double PureProjection::GetGroundResolution(const int &zoom,const double &latitude) - { - return (cos(latitude * (PI / 180)) * 2 * PI * Axis()) / GetTileMatrixSizePixel(zoom).Width(); - } - - double PureProjection::Sign(const double &x) - { - if(x < 0.0) - return (-1); - else - return (1); - } - - double PureProjection::AdjustLongitude(double x) - { - qlonglong count = 0; - while(true) - { - if(qAbs(x) <= PI) - break; - else - if(((qlonglong) qAbs(x / PI)) < 2) - x = x - (Sign(x) * TWO_PI); - - else - if(((qlonglong) qAbs(x / TWO_PI)) < MAXLONG) - { - x = x - (((qlonglong) (x / TWO_PI)) * TWO_PI); - } - else - if(((qlonglong) qAbs(x / (MAXLONG * TWO_PI))) < MAXLONG) - { - x = x - (((qlonglong) (x / (MAXLONG * TWO_PI))) * (TWO_PI * MAXLONG)); - } - else - if(((qlonglong) qAbs(x / (DBLLONG * TWO_PI))) < MAXLONG) - { - x = x - (((qlonglong) (x / (DBLLONG * TWO_PI))) * (TWO_PI * DBLLONG)); - } - else - x = x - (Sign(x) * TWO_PI); - count++; - if(count > MAX_VAL) - break; - } - return (x); - } - - void PureProjection::SinCos(const double &val, double &si, double &co) - { - si = sin(val); - co = cos(val); - } - - double PureProjection::e0fn(const double &x) - { - return (1.0 - 0.25 * x * (1.0 + x / 16.0 * (3.0 + 1.25 * x))); - } - - double PureProjection::e1fn(const double &x) - { - return (0.375 * x * (1.0 + 0.25 * x * (1.0 + 0.46875 * x))); - } - - double PureProjection::e2fn(const double &x) - { - return (0.05859375 * x * x * (1.0 + 0.75 * x)); - } - - double PureProjection::e3fn(const double &x) - { - return (x * x * x * (35.0 / 3072.0)); - } - - double PureProjection::mlfn(const double &e0,const double &e1,const double &e2,const double &e3,const double &phi) - { - return (e0 * phi - e1 * sin(2.0 * phi) + e2 * sin(4.0 * phi) - e3 * sin(6.0 * phi)); - } - - qlonglong PureProjection::GetUTMzone(const double &lon) - { - return ((qlonglong) (((lon + 180.0) / 6.0) + 1.0)); - } - - - void PureProjection::FromGeodeticToCartesian(double Lat,double Lng,double Height, double &X, double &Y, double &Z) - { - Lat = (PI / 180) * Lat; - Lng = (PI / 180) * Lng; - - double B = Axis() * (1.0 - Flattening()); - double ee = 1.0 - (B / Axis()) * (B / Axis()); - double N = (Axis() / sqrt(1.0 - ee * sin(Lat) * sin(Lat))); - - X = (N + Height) * cos(Lat) * cos(Lng); - Y = (N + Height) * cos(Lat) * sin(Lng); - Z = (N * (B / Axis()) * (B / Axis()) + Height) * sin(Lat); - } - void PureProjection::FromCartesianTGeodetic(const double &X,const double &Y,const double &Z, double &Lat, double &Lng) - { - double E = Flattening() * (2.0 - Flattening()); - Lng = atan2(Y, X); - - double P = sqrt(X * X + Y * Y); - double Theta = atan2(Z, (P * (1.0 - Flattening()))); - double st = sin(Theta); - double ct = cos(Theta); - Lat = atan2(Z + E / (1.0 - Flattening()) * Axis() * st * st * st, P - E * Axis() * ct * ct * ct); - - Lat /= (PI / 180); - Lng /= (PI / 180); - } - double PureProjection::DistanceBetweenLatLng(PointLatLng const& p1,PointLatLng const& p2) - { - double R = 6371; // km - double lat1=p1.Lat(); - double lat2=p2.Lat(); - double lon1=p1.Lng(); - double lon2=p2.Lng(); - double dLat = (lat2-lat1)* (PI / 180); - double dLon = (lon2-lon1)* (PI / 180); - double a = sin(dLat/2) * sin(dLat/2) + cos(lat1* (PI / 180)) * cos(lat2* (PI / 180)) * sin(dLon/2) * sin(dLon/2); - double c = 2 * atan2(sqrt(a), sqrt(1-a)); - double d = R * c; - return d; - } -} diff --git a/lib/opmapcontrol/src/internals/pureprojection.h b/lib/opmapcontrol/src/internals/pureprojection.h deleted file mode 100644 index 4ab806a62e7bba2dd92a3473784724d87a9027d2..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/pureprojection.h +++ /dev/null @@ -1,111 +0,0 @@ -/** -****************************************************************************** -* -* @file pureprojection.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef PUREPROJECTION_H -#define PUREPROJECTION_H - -#include "../core/size.h" -#include "../core/point.h" -#include "../internals/pointlatlng.h" -#include "pointlatlng.h" -#include "cmath" -#include "rectlatlng.h" - -using namespace core; - -namespace internals -{ - -class PureProjection -{ - - -public: - virtual Size TileSize()const=0; - - virtual double Axis()const=0; - - virtual double Flattening()const=0; - - virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom)=0; - - virtual PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom)=0; - - virtual QString Type(){return "PureProjection";} - core::Point FromLatLngToPixel(const PointLatLng &p,const int &zoom); - - PointLatLng FromPixelToLatLng(const Point &p,const int &zoom); - virtual core::Point FromPixelToTileXY(const core::Point &p); - virtual core::Point FromTileXYToPixel(const core::Point &p); - virtual Size GetTileMatrixMinXY(const int &zoom)=0; - virtual Size GetTileMatrixMaxXY(const int &zoom)=0; - virtual Size GetTileMatrixSizeXY(const int &zoom); - int GetTileMatrixItemCount(const int &zoom); - virtual Size GetTileMatrixSizePixel(const int &zoom); - QList GetAreaTileList(const RectLatLng &rect,const int &zoom,const int &padding); - virtual double GetGroundResolution(const int &zoom,const double &latitude); - - double DegreesToRadians(const double °)const - { - return (D2R * deg); - } - - double RadiansToDegrees(const double &rad)const - { - return (R2D * rad); - } - void FromGeodeticToCartesian(double Lat,double Lng,double Height, double &X, double &Y, double &Z); - void FromCartesianTGeodetic(const double &X,const double &Y,const double &Z, double &Lat, double &Lng); - static double DistanceBetweenLatLng(PointLatLng const& p1,PointLatLng const& p2); - -protected: - - static const double PI; - static const double HALF_PI; - static const double TWO_PI; - static const double EPSLoN; - static const double MAX_VAL; - static const double MAXLONG; - static const double DBLLONG; - static const double R2D; - static const double D2R; - - static double Sign(const double &x); - - static double AdjustLongitude(double x); - static void SinCos(const double &val, double &sin, double &cos); - static double e0fn(const double &x); - static double e1fn(const double &x); - static double e2fn(const double &x); - static double e3fn(const double &x); - static double mlfn(const double &e0,const double &e1,const double &e2,const double &e3,const double &phi); - static qlonglong GetUTMzone(const double &lon); - -}; -} - - -#endif // PUREPROJECTION_H diff --git a/lib/opmapcontrol/src/internals/rectangle.cpp b/lib/opmapcontrol/src/internals/rectangle.cpp deleted file mode 100644 index f513b22717de2218634d06a7b76f749bd559e7bc..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/rectangle.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/** -****************************************************************************** -* -* @file rectangle.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "rectangle.h" - -namespace internals { -Rectangle Rectangle::Empty=Rectangle(); -Rectangle Rectangle::FromLTRB(int left, int top, int right, int bottom) - { - return Rectangle(left, - top, - right - left, - bottom - top); - } -Rectangle Rectangle::Inflate(Rectangle rect, int x, int y) - { - Rectangle r = rect; - r.Inflate(x, y); - return r; - } -Rectangle Rectangle::Intersect(Rectangle a, Rectangle b) - { - int x1 = std::max(a.X(), b.X()); - int x2 = std::min(a.X() + a.Width(), b.X() + b.Width()); - int y1 = std::max(a.Y(), b.Y()); - int y2 = std::min(a.Y() + a.Height(), b.Y() + b.Height()); - - if(x2 >= x1 - && y2 >= y1) - { - - return Rectangle(x1, y1, x2 - x1, y2 - y1); - } - return Rectangle::Empty; - } -Rectangle Rectangle::Union(const Rectangle &a,const Rectangle &b) - { - int x1 = std::min(a.x, b.x); - int x2 = std::max(a.x + a.width, b.x + b.width); - int y1 = std::min(a.y, b.y); - int y2 = std::max(a.y + a.height, b.y + b.height); - - return Rectangle(x1, y1, x2 - x1, y2 - y1); - } -bool operator==(Rectangle const& lhs,Rectangle const& rhs) -{ - return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.width == rhs.width && lhs.height == rhs.height); -} -uint qHash(Rectangle const& rect) - { - return (int) ((quint32) rect.x ^ - (((quint32) rect.y << 13) | ((quint32) rect.y >> 19)) ^ - (((quint32) rect.width << 26) | ((quint32) rect.width >> 6)) ^ - (((quint32) rect.height << 7) | ((quint32) rect.height >> 25))); - } -} diff --git a/lib/opmapcontrol/src/internals/rectangle.h b/lib/opmapcontrol/src/internals/rectangle.h deleted file mode 100644 index 78919c1af0fc441fd98e5dde36c8d46cdcf5849a..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/rectangle.h +++ /dev/null @@ -1,158 +0,0 @@ -/** -****************************************************************************** -* -* @file rectangle.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef RECTANGLE_H -#define RECTANGLE_H -//#include -#include "../core/size.h" -#include "math.h" -using namespace core; -namespace internals -{ -struct Rectangle -{ - - friend uint qHash(Rectangle const& rect); - friend bool operator==(Rectangle const& lhs,Rectangle const& rhs); -public: - static Rectangle Empty; - static Rectangle FromLTRB(int left, int top, int right, int bottom); - Rectangle(){x=0; y=0; width=0; height=0; }; - Rectangle(int x, int y, int width, int height) - { - this->x = x; - this->y = y; - this->width = width; - this->height = height; - } - Rectangle(core::Point location, core::Size size) - { - this->x = location.X(); - this->y = location.Y(); - this->width = size.Width(); - this->height = size.Height(); - } - core::Point GetLocation() { - return core::Point(x, y); - } - void SetLocation(const core::Point &value) - { - x = value.X(); - y = value.Y(); - } - int X(){return x;} - int Y(){return y;} - void SetX(const int &value){x=value;} - void SetY(const int &value){y=value;} - int Width(){return width;} - void SetWidth(const int &value){width=value;} - int Height(){return height;} - void SetHeight(const int &value){height=value;} - int Left(){return x;} - int Top(){return y;} - int Right(){return x+width;} - int Bottom(){return y+height;} - bool IsEmpty(){return (height==0 && width==0 && x==0 && y==0);} - bool operator==(const Rectangle &cSource) - { - return (cSource.x == x && cSource.y == y && cSource.width == width && cSource.height == height); - } - - - bool operator!=(const Rectangle &cSource){return !(*this==cSource);} - bool Contains(const int &x,const int &y) - { - return this->x<=x && xx+this->width && this->y<=y && yy+this->height; - } - bool Contains(const core::Point &pt) - { - return Contains(pt.X(),pt.Y()); - } - bool Contains(const Rectangle &rect) - { - return (this->x <= rect.x) && - ((rect.x + rect.width) <= (this->x + this->width)) && - (this->y <= rect.y) && - ((rect.y + rect.height) <= (this->y + this->height)); - } - - - void Inflate(const int &width,const int &height) - { - this->x -= width; - this->y -= height; - this->width += 2*width; - this->height += 2*height; - } - void Inflate(Size &size) - { - - Inflate(size.Width(), size.Height()); - } - static Rectangle Inflate(Rectangle rect, int x, int y); - - void Intersect(const Rectangle &rect) - { - Rectangle result = Rectangle::Intersect(rect, *this); - - this->x = result.X(); - this->y = result.Y(); - this->width = result.Width(); - this->height = result.Height(); - } - static Rectangle Intersect(Rectangle a, Rectangle b); - bool IntersectsWith(const Rectangle &rect) - { - return (rect.x < this->x + this->width) && - (this->x < (rect.x + rect.width)) && - (rect.y < this->y + this->height) && - (this->y < rect.y + rect.height); - } - static Rectangle Union(const Rectangle &a,const Rectangle &b); - void Offset(const core::Point &pos) - { - Offset(pos.X(), pos.Y()); - } - - void Offset(const int &x,const int &y) - { - this->x += x; - this->y += y; - } - QString ToString() - { - return "{X=" + QString::number(x) + ",Y=" + QString::number(y) + - ",Width=" + QString::number(width) + - ",Height=" +QString::number(height) +"}"; - } -private: - int x; - int y; - int width; - int height; -}; -} -#endif // RECTANGLE_H diff --git a/lib/opmapcontrol/src/internals/rectlatlng.cpp b/lib/opmapcontrol/src/internals/rectlatlng.cpp deleted file mode 100644 index 2d98772622282e1ab46756b1722434cc29de701a..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/rectlatlng.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** -****************************************************************************** -* -* @file rectlatlng.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "rectlatlng.h" - - - -namespace internals { -RectLatLng RectLatLng::Empty=RectLatLng(); -uint qHash(RectLatLng const& rect) -{ - return (int) (((((uint) rect.Lng()) ^ ((((uint) rect.Lat()) << 13) | (((uint) rect.Lat()) >> 0x13))) ^ ((((uint) rect.WidthLng()) << 0x1a) | (((uint) rect.WidthLng()) >> 6))) ^ ((((uint) rect.HeightLat()) << 7) | (((uint) rect.HeightLat()) >> 0x19))); -} - -bool operator==(RectLatLng const& left,RectLatLng const& right) -{ - return ((((left.Lng() == right.Lng()) && (left.Lat() == right.Lat())) && (left.WidthLng() == right.WidthLng())) && (left.HeightLat() == right.HeightLat())); -} - -bool operator!=(RectLatLng const& left,RectLatLng const& right) -{ - return !(left == right); -} - -} diff --git a/lib/opmapcontrol/src/internals/rectlatlng.h b/lib/opmapcontrol/src/internals/rectlatlng.h deleted file mode 100644 index bbc86bac1df14f8860943cfd8b9b8aa9e0a2ccce..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/rectlatlng.h +++ /dev/null @@ -1,264 +0,0 @@ -/** -****************************************************************************** -* -* @file rectlatlng.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef RECTLATLNG_H -#define RECTLATLNG_H - -//#include "pointlatlng.h" -#include "../internals/pointlatlng.h" -#include "math.h" -#include -#include "sizelatlng.h" - -namespace internals { -struct RectLatLng -{ -public: - static RectLatLng Empty; - friend uint qHash(RectLatLng const& rect); - friend bool operator==(RectLatLng const& left,RectLatLng const& right); - friend bool operator!=(RectLatLng const& left,RectLatLng const& right); - RectLatLng(double const& lat, double const& lng, double const& widthLng, double const& heightLat) - { - this->lng = lng; - this->lat = lat; - this->widthLng = widthLng; - this->heightLat = heightLat; - isempty=false; - } - RectLatLng(PointLatLng const& location, SizeLatLng const& size) - { - this->lng = location.Lng(); - this->lat = location.Lat(); - this->widthLng = size.WidthLng(); - this->heightLat = size.HeightLat(); - isempty=false; - } - RectLatLng() - { - this->lng = 0; - this->lat = 0; - this->widthLng = 0; - this->heightLat = 0; - isempty=true; - } - - static RectLatLng FromLTRB(double const& lng, double const& lat, double const& rightLng, double const& bottomLat) - { - return RectLatLng(lat, lng, rightLng - lng, lat - bottomLat); - } - PointLatLng LocationTopLeft()const - { - return PointLatLng(this->lat, this->lng); - } - void SetLocationTopLeft(PointLatLng const& value) - { - this->lng = value.Lng(); - this->lat = value.Lat(); - isempty=false; - } - PointLatLng LocationRightBottom() - { - - PointLatLng ret = PointLatLng(this->lat, this->lng); - ret.Offset(HeightLat(), WidthLng()); - return ret; - } - SizeLatLng Size() - { - return SizeLatLng(this->HeightLat(), this->WidthLng()); - } - void SetSize(SizeLatLng const& value) - { - this->widthLng = value.WidthLng(); - this->heightLat = value.HeightLat(); - isempty=false; - } - double Lng()const - { - return this->lng; - } - void SetLng(double const& value) - { - this->lng = value; - isempty=false; - } - - - double Lat()const - { - return this->lat; - } - void SetLat(double const& value) - { - this->lat = value; - isempty=false; - } - - double WidthLng()const - { - return this->widthLng; - } - void SetWidthLng(double const& value) - { - this->widthLng = value; - isempty=false; - } - double HeightLat()const - { - return this->heightLat; - } - void SetHeightLat(double const& value) - { - this->heightLat = value; - isempty=false; - } - double Left()const - { - return this->Lng(); - } - - double Top()const - { - return this->Lat(); - } - - double Right()const - { - return (this->Lng() + this->WidthLng()); - } - - double Bottom()const - { - return (this->Lat() - this->HeightLat()); - } - bool IsEmpty()const - { - return isempty; - } - bool Contains(double const& lat, double const& lng) - { - return ((((this->Lng() <= lng) && (lng < (this->Lng() + this->WidthLng()))) && (this->Lat() >= lat)) && (lat > (this->Lat() - this->HeightLat()))); - } - - bool Contains(PointLatLng const& pt) - { - return this->Contains(pt.Lat(), pt.Lng()); - } - - bool Contains(RectLatLng const& rect) - { - return ((((this->Lng() <= rect.Lng()) && ((rect.Lng() + rect.WidthLng()) <= (this->Lng() + this->WidthLng()))) && (this->Lat() >= rect.Lat())) && ((rect.Lat() - rect.HeightLat()) >= (this->Lat() - this->HeightLat()))); - } - void Inflate(double const& lat, double const& lng) - { - this->lng -= lng; - this->lat += lat; - this->widthLng += (double)2 * lng; - this->heightLat +=(double)2 * lat; - } - - void Inflate(SizeLatLng const& size) - { - this->Inflate(size.HeightLat(), size.WidthLng()); - } - - static RectLatLng Inflate(RectLatLng const& rect, double const& lat, double const& lng) - { - RectLatLng ef = rect; - ef.Inflate(lat, lng); - return ef; - } - - void Intersect(RectLatLng const& rect) - { - RectLatLng ef = Intersect(rect, *this); - this->lng = ef.Lng(); - this->lat = ef.Lat(); - this->widthLng = ef.WidthLng(); - this->heightLat = ef.HeightLat(); - } - static RectLatLng Intersect(RectLatLng const& a, RectLatLng const& b) - { - double lng = std::max(a.Lng(), b.Lng()); - double num2 = std::min((double) (a.Lng() + a.WidthLng()), (double) (b.Lng() + b.WidthLng())); - - double lat = std::max(a.Lat(), b.Lat()); - double num4 = std::min((double) (a.Lat() + a.HeightLat()), (double) (b.Lat() + b.HeightLat())); - - if((num2 >= lng) && (num4 >= lat)) - { - return RectLatLng(lng, lat, num2 - lng, num4 - lat); - } - return Empty; - } - bool IntersectsWith(RectLatLng const& rect) - { - return ((((rect.Lng() < (this->Lng() + this->WidthLng())) && (this->Lng() < (rect.Lng() + rect.WidthLng()))) && (rect.Lat() < (this->Lat() + this->HeightLat()))) && (this->Lat() < (rect.Lat() + rect.HeightLat()))); - } - - static RectLatLng Union(RectLatLng const& a, RectLatLng const& b) - { - double lng = std::min(a.Lng(), b.Lng()); - double num2 = std::max((double) (a.Lng() + a.WidthLng()), (double) (b.Lng() + b.WidthLng())); - double lat = std::min(a.Lat(), b.Lat()); - double num4 = std::max((double) (a.Lat() + a.HeightLat()), (double) (b.Lat() + b.HeightLat())); - return RectLatLng(lng, lat, num2 - lng, num4 - lat); - } - void Offset(PointLatLng const& pos) - { - this->Offset(pos.Lat(), pos.Lng()); - } - - void Offset(double const& lat, double const& lng) - { - this->lng += lng; - this->lat -= lat; - } - - QString ToString() const - { - return ("{Lat=" + QString::number(this->Lat()) + ",Lng=" + QString::number(this->Lng()) + ",WidthLng=" + QString::number(this->WidthLng()) + ",HeightLat=" + QString::number(this->HeightLat()) + "}"); - } - -private: - double lng; - double lat; - double widthLng; - double heightLat; - bool isempty; -}; - -} -#endif // RECTLATLNG_H - - - -// static RectLatLng() -// { -// Empty = new RectLatLng(); -// } -// } diff --git a/lib/opmapcontrol/src/internals/sizelatlng.cpp b/lib/opmapcontrol/src/internals/sizelatlng.cpp deleted file mode 100644 index 9222c37045bf59518fac22002e2f97d8e7384dd9..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/sizelatlng.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/** -****************************************************************************** -* -* @file sizelatlng.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "sizelatlng.h" -#include "pointlatlng.h" - -namespace internals { -SizeLatLng::SizeLatLng():heightLat(0),widthLng(0) -{ - -} -SizeLatLng::SizeLatLng(PointLatLng const& pt) -{ - this->heightLat = pt.Lat(); - this->widthLng = pt.Lng(); -} -SizeLatLng operator+(SizeLatLng const& sz1, SizeLatLng const& sz2) -{ - return SizeLatLng::Add(sz1, sz2); -} - -SizeLatLng operator-(SizeLatLng const& sz1, SizeLatLng const& sz2) -{ - return SizeLatLng::Subtract(sz1, sz2); -} - -bool operator==(SizeLatLng const& sz1, SizeLatLng const& sz2) -{ - return ((sz1.WidthLng() == sz2.WidthLng()) && (sz1.HeightLat() == sz2.HeightLat())); -} - -bool operator!=(SizeLatLng const& sz1, SizeLatLng const& sz2) -{ - return !(sz1 == sz2); -} -SizeLatLng SizeLatLng::Empty=SizeLatLng(); -} diff --git a/lib/opmapcontrol/src/internals/sizelatlng.h b/lib/opmapcontrol/src/internals/sizelatlng.h deleted file mode 100644 index 4ee5388cc99152dadd68a4d873ce79c6ecd5cf35..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/sizelatlng.h +++ /dev/null @@ -1,136 +0,0 @@ -/** -****************************************************************************** -* -* @file sizelatlng.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef SIZELATLNG_H -#define SIZELATLNG_H - - -#include - - -namespace internals { -struct PointLatLng; -struct SizeLatLng -{ -public: - SizeLatLng(); - static SizeLatLng Empty; - - SizeLatLng(SizeLatLng const& size) - { - this->widthLng = size.widthLng; - this->heightLat = size.heightLat; - } - - SizeLatLng(PointLatLng const& pt); - - - SizeLatLng(double const& heightLat, double const& widthLng) - { - this->heightLat = heightLat; - this->widthLng = widthLng; - } - - friend SizeLatLng operator+(SizeLatLng const& sz1, SizeLatLng const& sz2); - friend SizeLatLng operator-(SizeLatLng const& sz1, SizeLatLng const& sz2); - friend bool operator==(SizeLatLng const& sz1, SizeLatLng const& sz2); - friend bool operator!=(SizeLatLng const& sz1, SizeLatLng const& sz2); - - -// static explicit operator PointLatLng(SizeLatLng size) -// { -// return new PointLatLng(size.HeightLat(), size.WidthLng()); -// } - - - bool IsEmpty()const - { - return ((this->widthLng == 0) && (this->heightLat == 0)); - } - - double WidthLng()const - { - return this->widthLng; - } - void SetWidthLng(double const& value) - { - this->widthLng = value; - } - - - double HeightLat()const - { - return this->heightLat; - } - void SetHeightLat(double const& value) - { - this->heightLat = value; - } - - static SizeLatLng Add(SizeLatLng const& sz1, SizeLatLng const& sz2) - { - return SizeLatLng(sz1.HeightLat() + sz2.HeightLat(), sz1.WidthLng() + sz2.WidthLng()); - } - - static SizeLatLng Subtract(SizeLatLng const& sz1, SizeLatLng const& sz2) - { - return SizeLatLng(sz1.HeightLat() - sz2.HeightLat(), sz1.WidthLng() - sz2.WidthLng()); - } - -// override bool Equals(object obj) -// { -// if(!(obj is SizeLatLng)) -// { -// return false; -// } -// SizeLatLng ef = (SizeLatLng) obj; -// return (((ef.WidthLng == this->WidthLng) && (ef.HeightLat == this->HeightLat)) && ef.GetType().Equals(base.GetType())); -// } - -// override int GetHashCode() -// { -// return base.GetHashCode(); -// } - -// PointLatLng ToPointLatLng() -// { -// return (PointLatLng) this; -// } - - QString ToString() - { - return ("{WidthLng=" + QString::number(this->widthLng) + ", HeightLng=" + QString::number(this->heightLat) + "}"); - } - - -private: - double heightLat; - double widthLng; -}; - -} -#endif // SIZELATLNG_H - diff --git a/lib/opmapcontrol/src/internals/tile.cpp b/lib/opmapcontrol/src/internals/tile.cpp deleted file mode 100644 index 5d8289e71601ad572afa5e86ebad1f366db6a82c..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/tile.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/** -****************************************************************************** -* -* @file tile.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "tile.h" - - -namespace internals { -Tile::Tile(int zoom, Point pos) -{ - this->zoom=zoom; - this->pos=pos; -} -void Tile::Clear() -{ -#ifdef DEBUG_TILE - qDebug()<<"Tile:Clear Overlays"; -#endif //DEBUG_TILE - mutex.lock(); - foreach(QByteArray img, Overlays) - { - img.~QByteArray(); - } - Overlays.clear(); - mutex.unlock(); -} -Tile::Tile():zoom(0),pos(0,0) -{ - -} -Tile& Tile::operator =(const Tile &cSource) -{ - this->zoom=cSource.zoom; - this->pos=cSource.pos; - return *this; -} - -} diff --git a/lib/opmapcontrol/src/internals/tile.h b/lib/opmapcontrol/src/internals/tile.h deleted file mode 100644 index 6b1ae2023e77efb34b37c0cf1774e813fce49db3..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/tile.h +++ /dev/null @@ -1,67 +0,0 @@ -/** -****************************************************************************** -* -* @file tile.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef TILE_H -#define TILE_H - -#include "QList" -#include -#include "../core/point.h" -#include -#include -#include "debugheader.h" -using namespace core; -namespace internals -{ -class Tile -{ -public: - Tile(int zoom,core::Point pos); - Tile(); - void Clear(); - int GetZoom(){return zoom;} - core::Point GetPos(){return pos;} - void SetZoom(const int &value){zoom=value;} - void SetPos(const core::Point &value){pos=value;} - Tile& operator= (const Tile &cSource); - Tile(const Tile &cSource) - { - this->zoom=cSource.zoom; - this->pos=cSource.pos; - } - bool HasValue(){return !(zoom==0);} - QList Overlays; -protected: - - QMutex mutex; -private: - int zoom; - core::Point pos; - - -}; -} -#endif // TILE_H diff --git a/lib/opmapcontrol/src/internals/tilematrix.cpp b/lib/opmapcontrol/src/internals/tilematrix.cpp deleted file mode 100644 index 658d3be95b18779893c74183454cc1babadd9f65..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/internals/tilematrix.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/** -****************************************************************************** -* -* @file tilematrix.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "tilematrix.h" - - -namespace internals { -TileMatrix::TileMatrix() -{ -} -void TileMatrix::Clear() -{ - mutex.lock(); - foreach(Tile* t,matrix.values()) - { - delete t; - t=0; - } - matrix.clear(); - mutex.unlock(); -} -//void TileMatrix::RebuildToUpperZoom() -//{ -// mutex.lock(); -// QList newtiles; -// foreach(Tile* t,matrix.values()) -// { -// Point point=Point(t->GetPos().X()*2,t->GetPos().Y()*2); -// Tile* tile1=new Tile(t->GetZoom()+1,point); -// Tile* tile2=new Tile(t->GetZoom()+1,Point(point.X()+1,point.Y()+0)); -// Tile* tile3=new Tile(t->GetZoom()+1,Point(point.X()+0,point.Y()+1)); -// Tile* tile4=new Tile(t->GetZoom()+1,Point(point.X()+1,point.Y()+1)); -// -// foreach(QByteArray arr, t->Overlays) -// { -// QImage ima=QImage::fromData(arr); -// QImage ima1=ima.copy(0,0,ima.width()/2,ima.height()/2); -// QImage ima2=ima.copy(ima.width()/2,0,ima.width()/2,ima.height()/2); -// QImage ima3=ima.copy(0,ima.height()/2,ima.width()/2,ima.height()/2); -// QImage ima4=ima.copy(ima.width()/2,ima.height()/2,ima.width()/2,ima.height()/2); -// QByteArray ba; -// QBuffer buf(&ba); -// ima1.scaled(QSize(ima.width(),ima.height())).save(&buf,"PNG"); -// tile1->Overlays.append(ba); -// QByteArray ba1; -// QBuffer buf1(&ba1); -// ima2.scaled(QSize(ima.width(),ima.height())).save(&buf1,"PNG"); -// tile2->Overlays.append(ba1); -// QByteArray ba2; -// QBuffer buf2(&ba2); -// ima3.scaled(QSize(ima.width(),ima.height())).save(&buf2,"PNG"); -// tile3->Overlays.append(ba2); -// QByteArray ba3; -// QBuffer buf3(&ba3); -// ima4.scaled(QSize(ima.width(),ima.height())).save(&buf3,"PNG"); -// tile4->Overlays.append(ba3); -// newtiles.append(tile1); -// newtiles.append(tile2); -// newtiles.append(tile3); -// newtiles.append(tile4); -// } -// } -// foreach(Tile* t,matrix.values()) -// { -// delete t; -// t=0; -// } -// matrix.clear(); -// foreach(Tile* t,newtiles) -// { -// matrix.insert(t->GetPos(),t); -// } -// -// mutex.unlock(); -//} - -void TileMatrix::ClearPointsNotIn(QListlist) -{ - removals.clear(); - mutex.lock(); - foreach(Point p, matrix.keys()) - { - if(!list.contains(p)) - { - removals.append(p); - } - } - mutex.unlock(); - foreach(Point p,removals) - { - Tile* t=TileAt(p); - if(t!=0) - { - mutex.lock(); - delete t; - t=0; - matrix.remove(p); - mutex.unlock(); - } - - } - removals.clear(); -} -Tile* TileMatrix::TileAt(const Point &p) -{ - -#ifdef DEBUG_TILEMATRIX - qDebug()<<"TileMatrix:TileAt:"< -#include "tile.h" -#include -#include "../core/point.h" -#include "debugheader.h" -#include -namespace internals { -class TileMatrix -{ -public: - TileMatrix(); - void Clear(); - void ClearPointsNotIn(QList list); - Tile* TileAt(const core::Point &p); - void SetTileAt(const core::Point &p,Tile* tile); - int count()const{return matrix.count();} - // void RebuildToUpperZoom(); -protected: - QHash matrix; - QList removals; - QMutex mutex; -}; - -} -#endif // TILEMATRIX_H diff --git a/lib/opmapcontrol/src/mapwidget/configuration.cpp b/lib/opmapcontrol/src/mapwidget/configuration.cpp deleted file mode 100644 index 2dd1b95b4add0433aaefd05918ebcb80bdf565a5..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/configuration.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/** -****************************************************************************** -* -* @file configuration.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief A class that centralizes most of the mapcontrol configurations -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "configuration.h" -namespace mapcontrol -{ -Configuration::Configuration() -{ - EmptytileBrush = Qt::cyan; - MissingDataFont =QFont ("Times",10,QFont::Bold); - EmptyTileText = "We are sorry, but we don't\nhave imagery at this zoom\nlevel for this region."; - EmptyTileBorders = QPen(Qt::white); - ScalePen = QPen(Qt::blue); - SelectionPen = QPen(Qt::blue); - DragButton = Qt::LeftButton; -} -void Configuration::SetAccessMode(core::AccessMode::Types const& type) -{ - core::OPMaps::Instance()->setAccessMode(type); -} -core::AccessMode::Types Configuration::AccessMode() -{ - return core::OPMaps::Instance()->GetAccessMode(); -} -void Configuration::SetLanguage(core::LanguageType::Types const& type) -{ - core::OPMaps::Instance()->setLanguage(type); -} -core::LanguageType::Types Configuration::Language() -{ - return core::OPMaps::Instance()->GetLanguage(); -} -void Configuration::SetUseMemoryCache(bool const& value) -{ - core::OPMaps::Instance()->setUseMemoryCache(value); -} -} diff --git a/lib/opmapcontrol/src/mapwidget/configuration.h b/lib/opmapcontrol/src/mapwidget/configuration.h deleted file mode 100644 index 46dd0d03c3f4aafc7216ece18eb047675a560ef0..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/configuration.h +++ /dev/null @@ -1,186 +0,0 @@ -/** -****************************************************************************** -* -* @file configuration.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief A class that centralizes most of the mapcontrol configurations -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef CONFIGURATION_H -#define CONFIGURATION_H - -#include -#include -#include -#include -#include "../core/opmaps.h" -#include "../core/accessmode.h" -#include "../core/cache.h" -namespace mapcontrol -{ - -/** -* @brief A class that centralizes most of the mapcontrol configurations -* -* @class Configuration configuration.h "configuration.h" -*/ -class Configuration -{ -public: - Configuration(); - /** - * @brief Used to draw empty map tiles - * - * @var EmptytileBrush - */ - QBrush EmptytileBrush; - /** - * @brief Used for empty tiles text - * - * @var EmptyTileText - */ - QString EmptyTileText; - /** - * @brief Used to draw empty tile borders - * - * @var EmptyTileBorders - */ - QPen EmptyTileBorders; - /** - * @brief Used to Draw the maps scale - * - * @var ScalePen - */ - QPen ScalePen; - /** - * @brief Used to draw selection box - * - * @var SelectionPen - */ - QPen SelectionPen; - /** - * @brief - * - * @var MissingDataFont - */ - QFont MissingDataFont; - - /** - * @brief Button used for dragging - * - * @var DragButton - */ - Qt::MouseButton DragButton; - - /** - * @brief Sets the access mode for the map (cache only, server and cache...) - * - * @param type access mode - */ - void SetAccessMode(core::AccessMode::Types const& type); - /** - * @brief Returns the access mode for the map (cache only, server and cache...) - * - * @return core::AccessMode::Types access mode for the map - */ - core::AccessMode::Types AccessMode(); - - /** - * @brief Sets the language used for geocaching - * - * @param type The language to be used - */ - void SetLanguage(core::LanguageType::Types const& type); - /** - * @brief Returns the language used for geocaching - * - * @return core::LanguageType::Types - */ - core::LanguageType::Types Language(); - - /** - * @brief Used to allow disallow use of memory caching - * - * @param value - * @return - */ - void SetUseMemoryCache(bool const& value); - /** - * @brief Return if memory caching is in use - * - * @return - */ - bool UseMemoryCache(){return core::OPMaps::Instance()->UseMemoryCache();} - - /** - * @brief Returns the currently used memory for tiles - * - * @return - */ - double TileMemoryUsed()const{return core::OPMaps::Instance()->TilesInMemory.MemoryCacheSize();} - - /** - * @brief Sets the size of the memory for tiles - * - * @param value size in Mb to use for tiles - * @return - */ - void SetTileMemorySize(int const& value){core::OPMaps::Instance()->TilesInMemory.setMemoryCacheCapacity(value);} - - /** - * @brief Sets the location for the SQLite Database used for caching and the geocoding cache files - * - * @param dir The path location for the cache file-IMPORTANT Must end with closing slash "/" - */ - void SetCacheLocation(QString const& dir) - { - core::Cache::Instance()->setCacheLocation(dir); - - } - - /** - * @brief Deletes tiles in DataBase older than "days" days - * - * @param days - * @return - */ - void DeleteTilesOlderThan(int const& days){core::Cache::Instance()->ImageCache.deleteOlderTiles(days);} - - /** - * @brief Exports tiles from one DB to another. Only new tiles are added. - * - * @param sourceDB the source DB - * @param destDB the destination DB. If it doesnt exhist it will be created. - * @return - */ - void ExportMapDataToDB(QString const& sourceDB, QString const& destDB)const{core::PureImageCache::ExportMapDataToDB(sourceDB,destDB);} - /** - * @brief Returns the location for the SQLite Database used for caching and the geocoding cache files - * - * @return - */ - QString CacheLocation(){return core::Cache::Instance()->CacheLocation();} - - -}; -} -#endif // CONFIGURATION_H diff --git a/lib/opmapcontrol/src/mapwidget/gpsitem.cpp b/lib/opmapcontrol/src/mapwidget/gpsitem.cpp deleted file mode 100644 index 9e247c08a8acdd6fe33c065f0e0777a9c1472eab..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/gpsitem.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/** -****************************************************************************** -* -* @file gpsitem.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief A graphicsItem representing a UAV -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "../internals/pureprojection.h" -#include "gpsitem.h" -namespace mapcontrol -{ - GPSItem::GPSItem(MapGraphicItem* map,OPMapWidget* parent):map(map),mapwidget(parent),showtrail(true),trailtime(5),traildistance(50),autosetreached(true) - ,autosetdistance(100) - { - pic.load(QString::fromUtf8(":/markers/images/mapquad.png")); - // Don't scale but trust the image we are given - // pic=pic.scaled(50,33,Qt::IgnoreAspectRatio); - localposition=map->FromLatLngToLocal(mapwidget->CurrentPosition()); - this->setPos(localposition.X(),localposition.Y()); - this->setZValue(4); - trail=new QGraphicsItemGroup(); - trail->setParentItem(map); - - - this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true); - mapfollowtype=UAVMapFollowType::None; - trailtype=UAVTrailType::ByDistance; - timer.start(); - - // rect=QRectF(0,0,renderer.defaultSize().width()*0.05,renderer.defaultSize().height()*0.05); - - } - GPSItem::~GPSItem() - { - delete trail; - } - - void GPSItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) - { - Q_UNUSED(option); - Q_UNUSED(widget); - // painter->rotate(-90); - painter->drawPixmap(-pic.width()/2,-pic.height()/2,pic); - // painter->drawRect(QRectF(-pic.width()/2,-pic.height()/2,pic.width()-1,pic.height()-1)); - } - QRectF GPSItem::boundingRect()const - { - return QRectF(-pic.width()/2,-pic.height()/2,pic.width(),pic.height()); - } - void GPSItem::SetUAVPos(const internals::PointLatLng &position, const int &altitude) - { - if(coord.IsEmpty()) - lastcoord=coord; - if(coord!=position) - { - - if(trailtype==UAVTrailType::ByTimeElapsed) - { - if(timer.elapsed()>trailtime*1000) - { - trail->addToGroup(new TrailItem(position,altitude,Qt::green,this)); - timer.restart(); - } - - } - else if(trailtype==UAVTrailType::ByDistance) - { - if(qAbs(internals::PureProjection::DistanceBetweenLatLng(lastcoord,position)*1000)>traildistance) - { - trail->addToGroup(new TrailItem(position,altitude,Qt::green,this)); - lastcoord=position; - } - } - coord=position; - this->altitude=altitude; - RefreshPos(); - /*if(mapfollowtype==UAVMapFollowType::CenterAndRotateMap||mapfollowtype==UAVMapFollowType::CenterMap) - { - mapwidget->SetCurrentPosition(coord); - }*/ - this->update(); - /*if(autosetreached) - { - foreach(QGraphicsItem* i,map->childItems()) - { - WayPointItem* wp=qgraphicsitem_cast(i); - if(wp) - { - if(Distance3D(wp->Coord(),wp->Altitude())SetReached(true); - emit UAVReachedWayPoint(wp->Number(),wp); - } - } - } - } - if(mapwidget->Home!=0) - { - //verify if the UAV is inside the safety bouble - if(Distance3D(mapwidget->Home->Coord(),mapwidget->Home->Altitude())>mapwidget->Home->SafeArea()) - { - if(mapwidget->Home->safe!=false) - { - mapwidget->Home->safe=false; - mapwidget->Home->update(); - emit UAVLeftSafetyBouble(this->coord); - } - } - else - { - if(mapwidget->Home->safe!=true) - { - mapwidget->Home->safe=true; - mapwidget->Home->update(); - } - } - - }*/ - } - } - - /** - * Rotate the UAV Icon on the map, or rotate the map - * depending on the display mode - */ - void GPSItem::SetUAVHeading(const qreal &value) - { - if(mapfollowtype==UAVMapFollowType::CenterAndRotateMap) - { - mapwidget->SetRotate(-value); - } - else { - if (this->rotation() != value) - this->setRotation(value); - } - } - - - int GPSItem::type()const - { - return Type; - } - - - void GPSItem::RefreshPos() - { - localposition=map->FromLatLngToLocal(coord); - this->setPos(localposition.X(),localposition.Y()); - foreach(QGraphicsItem* i,trail->childItems()) - { - TrailItem* w=qgraphicsitem_cast(i); - if(w) - w->setPos(map->FromLatLngToLocal(w->coord).X(),map->FromLatLngToLocal(w->coord).Y()); - //this->update(); - } - - } - void GPSItem::SetTrailType(const UAVTrailType::Types &value) - { - trailtype=value; - if(trailtype==UAVTrailType::ByTimeElapsed) - timer.restart(); - } - void GPSItem::SetShowTrail(const bool &value) - { - showtrail=value; - trail->setVisible(value); - } - void GPSItem::DeleteTrail()const - { - foreach(QGraphicsItem* i,trail->childItems()) - delete i; - } - double GPSItem::Distance3D(const internals::PointLatLng &coord, const int &altitude) - { - return sqrt(pow(internals::PureProjection::DistanceBetweenLatLng(this->coord,coord)*1000,2)+ - pow(this->altitude-altitude,2)); - - } -} diff --git a/lib/opmapcontrol/src/mapwidget/gpsitem.h b/lib/opmapcontrol/src/mapwidget/gpsitem.h deleted file mode 100644 index 2c3439fc5281a66d86277e50090bac4904b1ce82..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/gpsitem.h +++ /dev/null @@ -1,209 +0,0 @@ -/** -****************************************************************************** -* -* @file gpsitem.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief A graphicsItem representing a WayPoint -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef GPSITEM_H -#define GPSITEM_H - -#include -#include -#include -#include "../internals/pointlatlng.h" -#include "mapgraphicitem.h" -#include "waypointitem.h" -#include -#include "uavmapfollowtype.h" -#include "uavtrailtype.h" -#include -#include "opmapwidget.h" -#include "trailitem.h" -namespace mapcontrol -{ - class WayPointItem; - class OPMapWidget; - /** -* @brief A QGraphicsItem representing the UAV -* -* @class UAVItem gpsitem.h "mapwidget/gpsitem.h" -*/ - class GPSItem:public QObject,public QGraphicsItem - { - Q_OBJECT - Q_INTERFACES(QGraphicsItem) - public: - enum { Type = UserType + 2 }; - GPSItem(MapGraphicItem* map,OPMapWidget* parent); - ~GPSItem(); - /** - * @brief Sets the UAV position - * - * @param position LatLng point - * @param altitude altitude in meters - */ - void SetUAVPos(internals::PointLatLng const& position,int const& altitude); - /** - * @brief Sets the UAV heading - * - * @param value heading angle (north=0deg) - */ - void SetUAVHeading(qreal const& value); - /** - * @brief Returns the UAV position - * - * @return internals::PointLatLng - */ - internals::PointLatLng UAVPos()const{return coord;} - /** - * @brief Sets the Map follow type - * - * @param value can be "none"(map doesnt follow UAV), "CenterMap"(map moves to keep UAV centered) or "CenterAndRotateMap"(map moves and rotates to keep UAV centered and straight) - */ - void SetMapFollowType(UAVMapFollowType::Types const& value){mapfollowtype=value;} - /** - * @brief Sets the trail type - * - * @param value can be "NoTrail"(no trail is plotted), "ByTimeElapsed"(a trail point is plotted each TrailTime()) or ByDistance(a trail point is plotted if the distance between the UAV and the last trail point is bigger than TrailDistance()) - */ - void SetTrailType(UAVTrailType::Types const& value); - /** - * @brief Returns the map follow method used - * - * @return UAVMapFollowType::Types - */ - UAVMapFollowType::Types GetMapFollowType()const{return mapfollowtype;} - /** - * @brief Returns the UAV trail type. It can be plotted by time elapsed or distance - * - * @return UAVTrailType::Types - */ - UAVTrailType::Types GetTrailType()const{return trailtype;} - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); - void RefreshPos(); - QRectF boundingRect() const; - /** - * @brief Sets the trail time to be used if TrailType is ByTimeElapsed - * - * @param seconds the UAV trail time elapsed value. If the trail type is time elapsed - * a trail point will be plotted each "value returned" seconds. - */ - void SetTrailTime(int const& seconds){trailtime=seconds;} - /** - * @brief Returns the UAV trail time elapsed value. If the trail type is time elapsed - * a trail point will be plotted each "value returned" seconds. - * - * @return int - */ - int TrailTime()const{return trailtime;} - /** - * @brief Sets the trail distance to be used if TrailType is ByDistance - * - * @param distance the UAV trail plot distance. - * If the trail type is ByDistance a trail dot is plotted if - * the distance between the current UAV position and the last trail point - * is bigger than the returned value - */ - void SetTrailDistance(int const& distance){traildistance=distance;} - /** - * @brief Returns the UAV trail plot distance. - * If the trail type is distance diference a trail dot is plotted if - * the distance between the current UAV position and the last trail point - * is bigger than the returned value - * - * @return int - */ - int TrailDistance()const{return traildistance;} - /** - * @brief Returns true if UAV trail is shown - * - * @return bool - */ - bool ShowTrail()const{return showtrail;} - /** - * @brief Used to define if the UAV displays a trail - * - * @param value - */ - void SetShowTrail(bool const& value); - /** - * @brief Deletes all the trail points - */ - void DeleteTrail()const; - /** - * @brief Returns true if the UAV automaticaly sets WP reached value (changing its color) - * - * @return bool - */ - bool AutoSetReached()const{return autosetreached;} - /** - * @brief Defines if the UAV can set the WP's "reached" value automaticaly. - * - * @param value - */ - void SetAutoSetReached(bool const& value){autosetreached=value;} - /** - * @brief Returns the 3D distance in meters necessary for the UAV to set WP's to "reached" - * - * @return double - */ - double AutoSetDistance()const{return autosetdistance;} - /** - * @brief Sets the the 3D distance in meters necessary for the UAV to set WP's to "reached" - * - * @param value - */ - void SetAutoSetDistance(double const& value){autosetdistance=value;} - - int type() const; - private: - MapGraphicItem* map; - - int altitude; - UAVMapFollowType::Types mapfollowtype; - UAVTrailType::Types trailtype; - internals::PointLatLng coord; - internals::PointLatLng lastcoord; - QPixmap pic; - core::Point localposition; - OPMapWidget* mapwidget; - QGraphicsItemGroup* trail; - QTime timer; - bool showtrail; - int trailtime; - int traildistance; - bool autosetreached; - double Distance3D(internals::PointLatLng const& coord, int const& altitude); - double autosetdistance; - // QRectF rect; - - public slots: - - signals: - void UAVReachedWayPoint(int const& waypointnumber,WayPointItem* waypoint); - void UAVLeftSafetyBouble(internals::PointLatLng const& position); - }; -} -#endif // GPSITEM_H diff --git a/lib/opmapcontrol/src/mapwidget/homeitem.cpp b/lib/opmapcontrol/src/mapwidget/homeitem.cpp deleted file mode 100644 index 815aa86f3dca7cb53e12a6595ed4d0790c08b2f8..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/homeitem.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/** -****************************************************************************** -* -* @file homeitem.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief A graphicsItem representing a trail point -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "homeitem.h" -namespace mapcontrol -{ - HomeItem::HomeItem(MapGraphicItem* map,OPMapWidget* parent):safe(true),map(map),mapwidget(parent),showsafearea(true),safearea(1000),altitude(0) - { - pic.load(QString::fromUtf8(":/markers/images/home2.svg")); - pic=pic.scaled(30,30,Qt::IgnoreAspectRatio); - this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true); - localposition=map->FromLatLngToLocal(mapwidget->CurrentPosition()); - this->setPos(localposition.X(),localposition.Y()); - this->setZValue(4); - coord=internals::PointLatLng(50,50); - } - - void HomeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) - { - Q_UNUSED(option); - Q_UNUSED(widget); - painter->drawPixmap(-pic.width()/2,-pic.height()/2,pic); - if(showsafearea) - { - if(safe) - painter->setPen(Qt::green); - else - painter->setPen(Qt::red); - painter->drawEllipse(QPointF(0,0),localsafearea,localsafearea); - // painter->drawRect(QRectF(-localsafearea,-localsafearea,localsafearea*2,localsafearea*2)); - } - - } - QRectF HomeItem::boundingRect()const - { - if(!showsafearea) - return QRectF(-pic.width()/2,-pic.height()/2,pic.width(),pic.height()); - else - return QRectF(-localsafearea,-localsafearea,localsafearea*2,localsafearea*2); - } - - - int HomeItem::type()const - { - return Type; - } - void HomeItem::RefreshPos() - { - prepareGeometryChange(); - localposition=map->FromLatLngToLocal(coord); - this->setPos(localposition.X(),localposition.Y()); - if(showsafearea) - localsafearea=safearea/map->Projection()->GetGroundResolution(map->ZoomTotal(),coord.Lat()); - - } - -} diff --git a/lib/opmapcontrol/src/mapwidget/homeitem.h b/lib/opmapcontrol/src/mapwidget/homeitem.h deleted file mode 100644 index 3c03396ee526510cc4ba2d6e63e1be0f88c15880..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/homeitem.h +++ /dev/null @@ -1,77 +0,0 @@ -/** -****************************************************************************** -* -* @file homeitem.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief A graphicsItem representing a WayPoint -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef HOMEITEM_H -#define HOMEITEM_H - -#include -#include -#include -#include "../internals/pointlatlng.h" -#include -#include "opmapwidget.h" -namespace mapcontrol -{ - - class HomeItem:public QObject,public QGraphicsItem - { - Q_OBJECT - Q_INTERFACES(QGraphicsItem) - public: - enum { Type = UserType + 4 }; - HomeItem(MapGraphicItem* map,OPMapWidget* parent); - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); - QRectF boundingRect() const; - int type() const; - void RefreshPos(); - bool ShowSafeArea()const{return showsafearea;} - void SetShowSafeArea(bool const& value){showsafearea=value;} - int SafeArea()const{return safearea;} - void SetSafeArea(int const& value){safearea=value;} - bool safe; - void SetCoord(internals::PointLatLng const& value){coord=value;} - internals::PointLatLng Coord()const{return coord;} - void SetAltitude(int const& value){altitude=value;} - int Altitude()const{return altitude;} - private: - MapGraphicItem* map; - OPMapWidget* mapwidget; - QPixmap pic; - core::Point localposition; - internals::PointLatLng coord; - bool showsafearea; - int safearea; - int localsafearea; - int altitude; - - public slots: - - signals: - - }; -} -#endif // HOMEITEM_H diff --git a/lib/opmapcontrol/src/mapwidget/images/EasystarBlue.png b/lib/opmapcontrol/src/mapwidget/images/EasystarBlue.png deleted file mode 100644 index 4e44eaed96650f7970eddc009bb53146be3e50a3..0000000000000000000000000000000000000000 Binary files a/lib/opmapcontrol/src/mapwidget/images/EasystarBlue.png and /dev/null differ diff --git a/lib/opmapcontrol/src/mapwidget/images/airplane.png b/lib/opmapcontrol/src/mapwidget/images/airplane.png deleted file mode 100644 index 81c73a7c4c64b6cd051923f31a1f552ea262d79d..0000000000000000000000000000000000000000 Binary files a/lib/opmapcontrol/src/mapwidget/images/airplane.png and /dev/null differ diff --git a/lib/opmapcontrol/src/mapwidget/images/airplane.svg b/lib/opmapcontrol/src/mapwidget/images/airplane.svg deleted file mode 100644 index da6977bec18bfc51aa7f8e8a7ce769c130571d93..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/images/airplane.svg +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - diff --git a/lib/opmapcontrol/src/mapwidget/images/airplanepip.png b/lib/opmapcontrol/src/mapwidget/images/airplanepip.png deleted file mode 100644 index d9b2279fc6e0e54a2e98d0b18349f5731f1afbdb..0000000000000000000000000000000000000000 Binary files a/lib/opmapcontrol/src/mapwidget/images/airplanepip.png and /dev/null differ diff --git a/lib/opmapcontrol/src/mapwidget/images/bigMarkerGreen.png b/lib/opmapcontrol/src/mapwidget/images/bigMarkerGreen.png deleted file mode 100644 index 4aed804959cd7450939446ca75515003033a8543..0000000000000000000000000000000000000000 Binary files a/lib/opmapcontrol/src/mapwidget/images/bigMarkerGreen.png and /dev/null differ diff --git a/lib/opmapcontrol/src/mapwidget/images/compas.svg b/lib/opmapcontrol/src/mapwidget/images/compas.svg deleted file mode 100644 index 086b865a1d4831cd5a04f6c9847fb3dd3bd53254..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/images/compas.svg +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/opmapcontrol/src/mapwidget/images/home.png b/lib/opmapcontrol/src/mapwidget/images/home.png deleted file mode 100644 index 817a9476a89a071bd2e0f053d00e6c1d06a56a3b..0000000000000000000000000000000000000000 Binary files a/lib/opmapcontrol/src/mapwidget/images/home.png and /dev/null differ diff --git a/lib/opmapcontrol/src/mapwidget/images/home.svg b/lib/opmapcontrol/src/mapwidget/images/home.svg deleted file mode 100644 index 63fa6a97e811d0f4ed28919590747d66b3ccb7ae..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/images/home.svg +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - diff --git a/lib/opmapcontrol/src/mapwidget/images/home2.svg b/lib/opmapcontrol/src/mapwidget/images/home2.svg deleted file mode 100644 index 4eef55159fb2aea7b4c501a19cd4ed4826c0e78d..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/images/home2.svg +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - image/svg+xml - - - - - - - - - - diff --git a/lib/opmapcontrol/src/mapwidget/images/mapquad.png b/lib/opmapcontrol/src/mapwidget/images/mapquad.png deleted file mode 100644 index 8f968a277295e44cce698127fd1a4dd36d57976e..0000000000000000000000000000000000000000 Binary files a/lib/opmapcontrol/src/mapwidget/images/mapquad.png and /dev/null differ diff --git a/lib/opmapcontrol/src/mapwidget/images/marker.png b/lib/opmapcontrol/src/mapwidget/images/marker.png deleted file mode 100644 index d3770dd74a3a88cfbc6c870530c0283bec7fdf5c..0000000000000000000000000000000000000000 Binary files a/lib/opmapcontrol/src/mapwidget/images/marker.png and /dev/null differ diff --git a/lib/opmapcontrol/src/mapwidget/mapgraphicitem.cpp b/lib/opmapcontrol/src/mapwidget/mapgraphicitem.cpp deleted file mode 100644 index 1a51d425c9c55f9f0bf68481c5de7452fccf5e05..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/mapgraphicitem.cpp +++ /dev/null @@ -1,583 +0,0 @@ -/** -****************************************************************************** -* -* @file mapgraphicitem.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief The main graphicsItem used on the widget, contains the map and map logic -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "uavitem.h" -#include "gpsitem.h" -#include "homeitem.h" -#include "mapgraphicitem.h" - -namespace mapcontrol -{ - MapGraphicItem::MapGraphicItem(internals::Core *core, Configuration *configuration):core(core),config(configuration),MapRenderTransform(1), maxZoom(17),minZoom(2),zoomReal(0),isSelected(false),rotation(0),zoomDigi(0) - { - - showTileGridLines=false; - isMouseOverMarker=false; - maprect=QRectF(0,0,1022,680); - core->SetCurrentRegion(internals::Rectangle(0, 0, maprect.width(), maprect.height())); - core->SetMapType(MapType::GoogleHybrid); - this->SetZoom(2); - connect(core,SIGNAL(OnNeedInvalidation()),this,SLOT(Core_OnNeedInvalidation())); - connect(core,SIGNAL(OnMapDrag()),this,SLOT(ChildPosRefresh())); - connect(core,SIGNAL(OnMapZoomChanged()),this,SLOT(ChildPosRefresh())); - //resize(); - } - void MapGraphicItem::start() - { - core->StartSystem(); - } - - void MapGraphicItem::resize(const QRectF &rect) - { - Q_UNUSED(rect); - { - this->prepareGeometryChange(); - maprect=boundingBox(scene()->sceneRect(),rotation); - this->setTransform(QTransform().translate(-(maprect.width()-scene()->width())/2,-(maprect.height()-scene()->height())/2)); - this->setTransformOriginPoint(maprect.center().x(),maprect.center().y()); - this->setRotation(rotation); - } - - core->OnMapSizeChanged(maprect.width(),maprect.height()); - core->SetCurrentRegion(internals::Rectangle(0, 0, maprect.width(), maprect.height())); - if(isVisible()) - { - core->GoToCurrentPosition(); - } - } - - QRectF MapGraphicItem::boundingRect() const - { - const int Margin = 1; - return maprect.adjusted(-Margin, -Margin, +Margin, +Margin); - } - void MapGraphicItem::Core_OnNeedInvalidation() - { - this->update(); - foreach(QGraphicsItem* i,this->childItems()) - { - WayPointItem* w=qgraphicsitem_cast(i); - if(w) - w->RefreshPos(); - UAVItem* ww=qgraphicsitem_cast(i); - if(ww) - ww->RefreshPos(); - HomeItem* www=qgraphicsitem_cast(i); - if(www) - www->RefreshPos(); - GPSItem* wwww=qgraphicsitem_cast(i); - if(wwww) - wwww->RefreshPos(); - } - } - void MapGraphicItem::ChildPosRefresh() - { - foreach(QGraphicsItem* i,this->childItems()) - { - WayPointItem* w=qgraphicsitem_cast(i); - if(w) - w->RefreshPos(); - UAVItem* ww=qgraphicsitem_cast(i); - if(ww) - ww->RefreshPos(); - HomeItem* www=qgraphicsitem_cast(i); - if(www) - www->RefreshPos(); - GPSItem* wwww=qgraphicsitem_cast(i); - if(wwww) - wwww->RefreshPos(); - } - } - void MapGraphicItem::ConstructLastImage(int const& zoomdiff) - { - QImage temp; - QSize size=boundingRect().size().toSize(); - size.setWidth(size.width()*2*zoomdiff); - size.setHeight(size.height()*2*zoomdiff); - temp=QImage(size, - QImage::Format_ARGB32_Premultiplied); - temp.fill(0); - QPainter imagePainter(&temp); - imagePainter.translate(-boundingRect().topLeft()); - imagePainter.scale(2*zoomdiff,2*zoomdiff); - paintImage(&imagePainter); - imagePainter.end(); - lastimagepoint=Point(core->GetrenderOffset().X()*2*zoomdiff,core->GetrenderOffset().Y()*2*zoomdiff); - lastimage=temp; - } - void MapGraphicItem::paintImage(QPainter *painter) - { - - if(MapRenderTransform!=1) - { - QTransform transform; - transform.translate(-((boundingRect().width()*MapRenderTransform)-(boundingRect().width()))/2,-((boundingRect().height()*MapRenderTransform)-(boundingRect().height()))/2); - transform.scale(MapRenderTransform,MapRenderTransform); - painter->setWorldTransform(transform); - { - DrawMap2D(painter); - } - painter->resetTransform(); - } - else - { - DrawMap2D(painter); - } - //painter->drawRect(maprect); - } - void MapGraphicItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) - { - Q_UNUSED(option); - Q_UNUSED(widget); - - if(MapRenderTransform!=1) - { - QTransform transform; - transform.translate(-((boundingRect().width()*MapRenderTransform)-(boundingRect().width()))/2,-((boundingRect().height()*MapRenderTransform)-(boundingRect().height()))/2); - transform.scale(MapRenderTransform,MapRenderTransform); - - painter->setWorldTransform(transform); - painter->setRenderHint(QPainter::SmoothPixmapTransform,true); - painter->setRenderHint(QPainter::HighQualityAntialiasing,true); - - { - DrawMap2D(painter); - } - painter->resetTransform(); - } - else - { - DrawMap2D(painter); - } - } - void MapGraphicItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) - { - if(core->IsDragging()) - { - if(MapRenderTransform!=1) - { - qreal dx= (event->pos().x()-core->mouseDown.X())/(MapRenderTransform); - qreal dy= (event->pos().y()-core->mouseDown.Y())/(MapRenderTransform); - qreal nx=core->mouseDown.X()+dx; - qreal ny=core->mouseDown.Y()+dy; - core->mouseCurrent.SetX(nx); - core->mouseCurrent.SetY(ny); - } - else - { - core->mouseCurrent.SetX(event->pos().x()); - core->mouseCurrent.SetY(event->pos().y()); - } - { - core->Drag(core->mouseCurrent); - } - - } - else if(isSelected && !selectionStart.IsEmpty() && (event->modifiers() == Qt::AltModifier || event->modifiers() == Qt::ShiftModifier)) - { - selectionEnd = FromLocalToLatLng(event->pos().x(), event->pos().y()); - { - internals::PointLatLng p1 = selectionStart; - internals::PointLatLng p2 = selectionEnd; - - double x1 = qMin(p1.Lng(), p2.Lng()); - double y1 = qMax(p1.Lat(), p2.Lat()); - double x2 = qMax(p1.Lng(), p2.Lng()); - double y2 = qMin(p1.Lat(), p2.Lat()); - - SetSelectedArea(internals::RectLatLng(y1, x1, x2 - x1, y1 - y2)); - } - } - QGraphicsItem::mouseMoveEvent(event); - } - void MapGraphicItem::mousePressEvent(QGraphicsSceneMouseEvent *event) - { - - - - if(!IsMouseOverMarker()) - { - if(event->button() == config->DragButton && CanDragMap()&& !((event->modifiers()==Qt::AltModifier)||(event->modifiers()==Qt::ShiftModifier))) - { - core->mouseDown.SetX(event->pos().x()); - core->mouseDown.SetY(event->pos().y()); - - - this->setCursor(Qt::SizeAllCursor); - - core->BeginDrag(core->mouseDown); - this->update(); - - } - else if(!isSelected && ((event->modifiers()==Qt::AltModifier)||(event->modifiers()==Qt::ShiftModifier))) - { - isSelected = true; - SetSelectedArea (internals::RectLatLng::Empty); - selectionEnd = internals::PointLatLng::Empty; - selectionStart = FromLocalToLatLng(event->pos().x(), event->pos().y()); - } - } - - } - void MapGraphicItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) - { - if(isSelected) - { - isSelected = false; - } - - if(core->IsDragging()) - { - core->EndDrag(); - - this->setCursor(Qt::ArrowCursor); - if(!BoundsOfMap.IsEmpty() && !BoundsOfMap.Contains(core->CurrentPosition())) - { - if(!core->LastLocationInBounds.IsEmpty()) - { - core->SetCurrentPosition(core->LastLocationInBounds); - } - } - } - else - { - if(!selectionEnd.IsEmpty() && !selectionStart.IsEmpty()) - { - if(!selectedArea.IsEmpty() && event->modifiers() == Qt::ShiftModifier) - { - SetZoomToFitRect(SelectedArea()); - } - } - - } - } - bool MapGraphicItem::SetZoomToFitRect(internals::RectLatLng const& rect) - { - int maxZoom = core->GetMaxZoomToFitRect(rect); - if(maxZoom > 0) - { - internals::PointLatLng center=internals::PointLatLng(rect.Lat()-(rect.HeightLat()/2), rect.Lng()+(rect.WidthLng()/2)); - core->SetCurrentPosition(center); - - if(maxZoom > MaxZoom()) - { - maxZoom = MaxZoom(); - } - - if((int) Zoom() != maxZoom) - { - SetZoom(maxZoom); - } - - return true; - } - return false; - } - - void MapGraphicItem::wheelEvent(QGraphicsSceneWheelEvent *event) - { - - if(!IsMouseOverMarker() && !IsDragging()) - { - if(core->GetmouseLastZoom().X() != event->pos().x() && core->mouseLastZoom.Y() != event->pos().y()) - { - if(GetMouseWheelZoomType() == internals::MouseWheelZoomType::MousePositionAndCenter) - { - core->SetCurrentPosition(FromLocalToLatLng(event->pos().x(), event->pos().y())); - } - else if(GetMouseWheelZoomType() == internals::MouseWheelZoomType::ViewCenter) - { - core->SetCurrentPosition(FromLocalToLatLng((int) maprect.width()/2, (int) maprect.height()/2)); - } - else if(GetMouseWheelZoomType() == internals::MouseWheelZoomType::MousePositionWithoutCenter) - { - core->SetCurrentPosition(FromLocalToLatLng(event->pos().x(), event->pos().y())); - - } - - core->mouseLastZoom.SetX((event->pos().x())); - core->mouseLastZoom.SetY((event->pos().y())); - } - - // set mouse position to map center - if(GetMouseWheelZoomType() != internals::MouseWheelZoomType::MousePositionWithoutCenter) - { - { - // System.Drawing.Point p = PointToScreen(new System.Drawing.Point(Width/2, Height/2)); - // Stuff.SetCursorPos((int) p.X, (int) p.Y); - } - } - - core->MouseWheelZooming = true; - - if(event->delta() > 0) - { - SetZoom(ZoomTotal()+1); - } - else if(event->delta() < 0) - { - SetZoom(ZoomTotal()-1); - } - - core->MouseWheelZooming = false; - } - } - void MapGraphicItem::DrawMap2D(QPainter *painter) - { - if(!lastimage.isNull()) - painter->drawImage(core->GetrenderOffset().X()-lastimagepoint.X(),core->GetrenderOffset().Y()-lastimagepoint.Y(),lastimage); - - for(int i = -core->GetsizeOfMapArea().Width(); i <= core->GetsizeOfMapArea().Width(); i++) - { - for(int j = -core->GetsizeOfMapArea().Height(); j <= core->GetsizeOfMapArea().Height(); j++) - { - core->SettilePoint (core->GetcenterTileXYLocation()); - core->SettilePoint(Point(core->GettilePoint().X()+ i,core->GettilePoint().Y()+j)); - { - internals::Tile* t = core->Matrix.TileAt(core->GettilePoint()); - if(true) - { - core->tileRect.SetX(core->GettilePoint().X()*core->tileRect.Width()); - core->tileRect.SetY(core->GettilePoint().Y()*core->tileRect.Height()); - core->tileRect.Offset(core->GetrenderOffset()); - if(core->GetCurrentRegion().IntersectsWith(core->tileRect)) - { - bool found = false; - - // render tile - //lock(t.Overlays) - if(t!=0) - { - foreach(QByteArray img,t->Overlays) - { - if(img.count()!=0) - { - if(!found) - found = true; - { - painter->drawPixmap(core->tileRect.X(),core->tileRect.Y(), core->tileRect.Width(), core->tileRect.Height(),PureImageProxy::FromStream(img)); - // qDebug()<<"tile:"<tileRect.X()<tileRect.Y(); - } - } - } - } - - if(showTileGridLines) - { - painter->setPen(config->EmptyTileBorders); - painter->drawRect(core->tileRect.X(), core->tileRect.Y(), core->tileRect.Width(), core->tileRect.Height()); - { - painter->setFont(config->MissingDataFont); - painter->setPen(Qt::red); - painter->drawText(QRectF(core->tileRect.X(), core->tileRect.Y(), core->tileRect.Width(), core->tileRect.Height()),Qt::AlignCenter,(core->GettilePoint() == core->GetcenterTileXYLocation()? "CENTER: " :"TILE: ")+core->GettilePoint().ToString()); - //qDebug()<<"ShowTileGridLine:"<GettilePoint().ToString()<<"=="<GetcenterTileXYLocation().ToString(); - } - } - - // add text if tile is missing - if(false) - { - - painter->fillRect(QRectF(core->tileRect.X(), core->tileRect.Y(), core->tileRect.Width(), core->tileRect.Height()),config->EmptytileBrush); - painter->setFont(config->MissingDataFont); - painter->drawText(QRectF(core->tileRect.X(), core->tileRect.Y(), core->tileRect.Width(), core->tileRect.Height()),config->EmptyTileText); - - - - painter->setPen(config->EmptyTileBorders); - painter->drawRect(core->tileRect.X(), core->tileRect.Y(), core->tileRect.Width(), core->tileRect.Height()); - - // raise error - - } - if(!SelectedArea().IsEmpty()) - { - core::Point p1 = FromLatLngToLocal(SelectedArea().LocationTopLeft()); - core::Point p2 = FromLatLngToLocal(SelectedArea().LocationRightBottom()); - int x1 = p1.X(); - int y1 = p1.Y(); - int x2 = p2.X(); - int y2 = p2.Y(); - painter->setPen(Qt::black); - painter->setBrush(QBrush(QColor(50,50,100,20))); - painter->drawRect(x1,y1,x2-x1,y2-y1); - } - } - } - } - } - } - // painter->drawRect(core->GetrenderOffset().X()-lastimagepoint.X()-3,core->GetrenderOffset().Y()-lastimagepoint.Y()-3,lastimage.width(),lastimage.height()); -// painter->setPen(Qt::red); -// painter->drawLine(-10,-10,10,10); -// painter->drawLine(10,10,-10,-10); -// painter->drawRect(boundingRect().adjusted(100,100,-100,-100)); - } - - - core::Point MapGraphicItem::FromLatLngToLocal(internals::PointLatLng const& point) - { - core::Point ret = core->FromLatLngToLocal(point); - if(MapRenderTransform!=1) - { - ret.SetX((int) (ret.X() * MapRenderTransform)); - ret.SetY((int) (ret.Y() * MapRenderTransform)); - ret.SetX(ret.X()-((boundingRect().width()*MapRenderTransform)-(boundingRect().width()))/2); - ret.SetY(ret.Y()-((boundingRect().height()*MapRenderTransform)-(boundingRect().height()))/2); - - - } - return ret; - } - internals::PointLatLng MapGraphicItem::FromLocalToLatLng(int x, int y) - { - if(MapRenderTransform!=1) - { - x=x+((boundingRect().width()*MapRenderTransform)-(boundingRect().width()))/2; - y=y+((boundingRect().height()*MapRenderTransform)-(boundingRect().height()))/2; - - x = (int) (x / MapRenderTransform); - y = (int) (y / MapRenderTransform); - } - return core->FromLocalToLatLng(x, y); - } - - double MapGraphicItem::Zoom() - { - return zoomReal; - } - double MapGraphicItem::ZoomDigi() - { - return zoomDigi; - } - double MapGraphicItem::ZoomTotal() - { - return zoomDigi+zoomReal; - } - - void MapGraphicItem::SetZoom(double const& value) - { - if(ZoomTotal() != value) - { - if(value > MaxZoom()) - { - zoomReal = MaxZoom(); - zoomDigi =value-MaxZoom(); - } - else - if(value < MinZoom()) - { - zoomDigi=0; - zoomReal = MinZoom(); - } - else - { - zoomDigi=0; - zoomReal = value; - } - double integer; - double remainder = modf (value , &integer); - if(zoomDigi!=0||remainder != 0) - { - float scaleValue = zoomDigi+remainder + 1; - { - MapRenderTransform = scaleValue; - // qDebug()<<"scale="<MaxZoom()) - integer=MaxZoom(); - SetZoomStep((qint32)(integer)); - // core->GoToCurrentPositionOnZoom(); - this->update(); - - } - else - { - - MapRenderTransform = 1; - - SetZoomStep ((qint32)(value)); - zoomReal = ZoomStep(); - this->update(); - } - } - } - int MapGraphicItem::ZoomStep()const - { - return core->Zoom(); - } - void MapGraphicItem::SetZoomStep(int const& value) - { - if(value-core->Zoom()>0 && value<= MaxZoom()) - ConstructLastImage(value-core->Zoom()); - else if(value!=MaxZoom()) - lastimage=QImage(); - if(value > MaxZoom()) - { - core->SetZoom(MaxZoom()); - emit zoomChanged(MaxZoom()+ZoomDigi(),Zoom(),ZoomDigi()); - } - else if(value < MinZoom()) - { - core->SetZoom(MinZoom()); - emit zoomChanged(MinZoom()+ZoomDigi(),Zoom(),ZoomDigi()); - } - else - { - core->SetZoom(value); - emit zoomChanged(value+ZoomDigi(),Zoom(),ZoomDigi());; - } - - } - - void MapGraphicItem::Offset(int const& x, int const& y) - { - core->DragOffset(Point(x, y)); - } - void MapGraphicItem::mapRotate(qreal angle) - { - if (rotation != angle) { - rotation=angle; - resize(scene()->sceneRect()); - } - } - QRectF MapGraphicItem::boundingBox(const QRectF &rect, const qreal &angle) - { - QRectF ret(rect); - float c=cos(angle*2*M_PI/360); - float s=sin(angle*2*M_PI/360); - ret.setHeight(rect.height()*fabs(c)+rect.width()*fabs(s)); - ret.setWidth(rect.width()*fabs(c)+rect.height()*fabs(s)); - return ret; - } - QSize MapGraphicItem::sizeHint()const - { - core::Size size=core->projection->GetTileMatrixMaxXY(MinZoom()); - core::Size tilesize=core->projection->TileSize(); - QSize rsize((size.Width()+1)*tilesize.Width(),(size.Height()+1)*tilesize.Height()); - return rsize; - } -} diff --git a/lib/opmapcontrol/src/mapwidget/mapgraphicitem.h b/lib/opmapcontrol/src/mapwidget/mapgraphicitem.h deleted file mode 100644 index 0d8bdad979f8c543d8a14e6f870978f29286a5f5..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/mapgraphicitem.h +++ /dev/null @@ -1,213 +0,0 @@ -/** -****************************************************************************** -* -* @file mapgraphicitem.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief The main graphicsItem used on the widget, contains the map and map logic -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef MAPGRAPHICITEM_H -#define MAPGRAPHICITEM_H - -#include -#include "../internals/core.h" -//#include "../internals/point.h" -#include "../core/diagnostics.h" -#include "configuration.h" -#include -#include -#include -#include -#include -#include -#include "waypointitem.h" -#include "configuration.h" -//#include "uavitem.h" -namespace mapcontrol -{ - using namespace mapcontrol; - - class OPMapWidget; - /** - * @brief The main graphicsItem used on the widget, contains the map and map logic - * - * @class MapGraphicItem mapgraphicitem.h "mapgraphicitem.h" - */ - class MapGraphicItem:public QObject,public QGraphicsItem - { - friend class mapcontrol::OPMapWidget; - Q_OBJECT - Q_INTERFACES(QGraphicsItem) - public: - - - /** - * @brief Contructer - * - * @param core - * @param configuration the configuration to be used - * @return - */ - MapGraphicItem(internals::Core *core,Configuration *configuration); - QRectF boundingRect() const; - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); - - QSize sizeHint()const; - /** - * @brief Convertes LatLong coordinates to local item coordinates - * - * @param point LatLong point to be converted - * @return core::Point Local item point - */ - core::Point FromLatLngToLocal(internals::PointLatLng const& point); - /** - * @brief Converts from local item coordinates to LatLong point - * - * @param x x local coordinate - * @param y y local coordinate - * @return internals::PointLatLng LatLng coordinate - */ - internals::PointLatLng FromLocalToLatLng(int x, int y); - /** - * @brief Returns true if map is being dragged - * - * @return - */ - bool IsDragging()const{return core->IsDragging();} - - QImage lastimage; -// QPainter* imagePainter; - core::Point lastimagepoint; - void paintImage(QPainter* painter); - void ConstructLastImage(int const& zoomdiff); - internals::PureProjection* Projection()const{return core->Projection();} - double Zoom(); - double ZoomDigi(); - double ZoomTotal(); - - protected: - void mouseMoveEvent ( QGraphicsSceneMouseEvent * event ); - void mousePressEvent ( QGraphicsSceneMouseEvent * event ); - void wheelEvent ( QGraphicsSceneWheelEvent * event ); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - bool IsMouseOverMarker()const{return isMouseOverMarker;} - - /** - * @brief Returns current map zoom - * - * @return int Current map zoom - */ - int ZoomStep()const; - /** - * @brief Sets map zoom - * - * @param value zoom value - */ - void SetZoomStep(int const& value); - - - private: - bool SetZoomToFitRect(internals::RectLatLng const& rect); - internals::Core *core; - Configuration *config; - bool showTileGridLines; - qreal MapRenderTransform; - void DrawMap2D(QPainter *painter); - /** - * @brief Maximum possible zoom - * - * @var maxZoom - */ - int maxZoom; - /** - * @brief Minimum possible zoom - * - * @var minZoom - */ - int minZoom; - internals::RectLatLng selectedArea; - internals::PointLatLng selectionStart; - internals::PointLatLng selectionEnd; - double zoomReal; - double zoomDigi; - QRectF maprect; - bool isSelected; - bool isMouseOverMarker; - void SetIsMouseOverMarker(bool const& value){isMouseOverMarker = value;} - - qreal rotation; - /** - * @brief Creates a rectangle that represents the "view" of the cuurent map, to compensate - * rotation - * - * @param rect original rectangle - * @param angle angle of rotation - * @return QRectF - */ - QRectF boundingBox(QRectF const& rect, qreal const& angle); - /** - * @brief Returns the maximum allowed zoom - * - * @return int - */ - int MaxZoom()const{return core->MaxZoom();} - /** - * @brief Returns the minimum allowed zoom - * - * @return int - */ - int MinZoom()const{return minZoom;} - internals::MouseWheelZoomType::Types GetMouseWheelZoomType(){return core->GetMouseWheelZoomType();} - void SetSelectedArea(internals::RectLatLng const& value){selectedArea = value;this->update();} - internals::RectLatLng SelectedArea()const{return selectedArea;} - internals::RectLatLng BoundsOfMap; - void Offset(int const& x, int const& y); - bool CanDragMap()const{return core->CanDragMap;} - void SetCanDragMap(bool const& value){core->CanDragMap = value;} - - void SetZoom(double const& value); - void mapRotate ( qreal angle ); - void start(); - void ReloadMap(){core->ReloadMap();} - GeoCoderStatusCode::Types SetCurrentPositionByKeywords(QString const& keys){return core->SetCurrentPositionByKeywords(keys);} - MapType::Types GetMapType(){return core->GetMapType();} - void SetMapType(MapType::Types const& value){core->SetMapType(value);} - private slots: - void Core_OnNeedInvalidation(); - void ChildPosRefresh(); - public slots: - /** - * @brief To be called when the scene size changes - * - * @param rect - */ - void resize ( QRectF const &rect=QRectF() ); - signals: - /** - * @brief Fired when the current zoom is changed - * - * @param zoom - */ - void zoomChanged(double zoomtotal,double zoomreal,double zoomdigi); - }; -} -#endif // MAPGRAPHICITEM_H diff --git a/lib/opmapcontrol/src/mapwidget/mapresources.qrc b/lib/opmapcontrol/src/mapwidget/mapresources.qrc deleted file mode 100644 index bdb546587cec7896aeef14bc21e4b1a26394695b..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/mapresources.qrc +++ /dev/null @@ -1,14 +0,0 @@ - - - images/bigMarkerGreen.png - images/marker.png - images/compas.svg - images/airplane.svg - images/home.png - images/home.svg - images/home2.svg - images/airplanepip.png - images/EasystarBlue.png - images/mapquad.png - - diff --git a/lib/opmapcontrol/src/mapwidget/mapripform.cpp b/lib/opmapcontrol/src/mapwidget/mapripform.cpp deleted file mode 100644 index bbd1725a1aedb5d9bf5fb55a677257302151de5e..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/mapripform.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/** -****************************************************************************** -* -* @file mapripform.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief Form to be used with the MapRipper class -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "mapripform.h" -#include "ui_mapripform.h" - -MapRipForm::MapRipForm(QWidget *parent) : - QWidget(parent), - ui(new Ui::MapRipForm) -{ - ui->setupUi(this); -} - -MapRipForm::~MapRipForm() -{ - delete ui; -} -void MapRipForm::SetPercentage(const int &perc) -{ - ui->progressBar->setValue(perc); -} -void MapRipForm::SetProvider(const QString &prov,const int &zoom) -{ - ui->mainlabel->setText(QString("Currently ripping from:%1 at Zoom level %2").arg(prov).arg(zoom)); -} -void MapRipForm::SetNumberOfTiles(const int &total, const int &actual) -{ - ui->statuslabel->setText(QString("Downloading tile %1 of %2").arg(actual).arg(total)); -} diff --git a/lib/opmapcontrol/src/mapwidget/mapripform.h b/lib/opmapcontrol/src/mapwidget/mapripform.h deleted file mode 100644 index b1ff3637f42b170a2976507226a65f9d754f3278..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/mapripform.h +++ /dev/null @@ -1,51 +0,0 @@ -/** -****************************************************************************** -* -* @file mapripform.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief Form to be used with the MapRipper class -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef MAPRIPFORM_H -#define MAPRIPFORM_H - -#include - -namespace Ui { - class MapRipForm; -} - -class MapRipForm : public QWidget -{ - Q_OBJECT - -public: - explicit MapRipForm(QWidget *parent = 0); - ~MapRipForm(); -public slots: - void SetPercentage(int const& perc); - void SetProvider(QString const& prov,int const& zoom); - void SetNumberOfTiles(int const& total,int const& actual); -private: - Ui::MapRipForm *ui; -}; - -#endif // MAPRIPFORM_H diff --git a/lib/opmapcontrol/src/mapwidget/mapripform.ui b/lib/opmapcontrol/src/mapwidget/mapripform.ui deleted file mode 100644 index 8100f8651c2fa0a19a69e476d919c5b25dc0614e..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/mapripform.ui +++ /dev/null @@ -1,71 +0,0 @@ - - - MapRipForm - - - - 0 - 0 - 392 - 133 - - - - MapRipper - - - - - 20 - 60 - 371 - 23 - - - - 0 - - - - - - 30 - 10 - 321 - 16 - - - - Currently ripping from: - - - - - - 30 - 40 - 341 - 16 - - - - Downloading tile - - - - - - 280 - 100 - 75 - 23 - - - - Cancel - - - - - - diff --git a/lib/opmapcontrol/src/mapwidget/mapripper.cpp b/lib/opmapcontrol/src/mapwidget/mapripper.cpp deleted file mode 100644 index 00a2053cdf9b209a5b156eda045f9d87d4955837..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/mapripper.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/** -****************************************************************************** -* -* @file mapripper.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief A class that allows ripping of a selection of the map -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "mapripper.h" -namespace mapcontrol -{ - - MapRipper::MapRipper(internals::Core * core, const internals::RectLatLng & rect):sleep(100),cancel(false),progressForm(0),core(core) - { - if(!rect.IsEmpty()) - { - type=core->GetMapType(); - progressForm=new MapRipForm; - area=rect; - zoom=core->Zoom(); - maxzoom=core->MaxZoom(); - points=core->Projection()->GetAreaTileList(area,zoom,0); - this->start(); - progressForm->show(); - connect(this,SIGNAL(percentageChanged(int)),progressForm,SLOT(SetPercentage(int))); - connect(this,SIGNAL(numberOfTilesChanged(int,int)),progressForm,SLOT(SetNumberOfTiles(int,int))); - connect(this,SIGNAL(providerChanged(QString,int)),progressForm,SLOT(SetProvider(QString,int))); - connect(this,SIGNAL(finished()),this,SLOT(finish())); - emit numberOfTilesChanged(0,0); - } - } - void MapRipper::finish() - { - if(zoomProjection()->GetAreaTileList(area,zoom,0); - this->start(); - } - else - { - progressForm->close(); - delete progressForm; - this->deleteLater(); - } - } - } - - - void MapRipper::run() - { - int countOk = 0; - bool goodtile=false; - // Stuff.Shuffle(ref list); - QVector types = OPMaps::Instance()->GetAllLayersOfType(type); - int all=points.count(); - for(int i = 0; i < all; i++) - { - emit numberOfTilesChanged(all,i+1); - if(cancel) - break; - - core::Point p = points[i]; - { - //qDebug()<<"offline fetching:"<GetImageFrom(type, p, zoom); - if(img.length()!=0) - { - goodtile=true; - img=NULL; - } - else - goodtile=false; - } - if(goodtile) - { - countOk++; - } - else - { - i--; - QThread::msleep(1000); - continue; - } - } - emit percentageChanged((int) ((i+1)*100/all));//, i+1); - // worker.ReportProgress((int) ((i+1)*100/all), i+1); - - QThread::msleep(sleep); - } - } -} diff --git a/lib/opmapcontrol/src/mapwidget/mapripper.h b/lib/opmapcontrol/src/mapwidget/mapripper.h deleted file mode 100644 index 6b2087a1241d52e6a57a6546ef909c1d2c8ed1fa..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/mapripper.h +++ /dev/null @@ -1,64 +0,0 @@ -/** -****************************************************************************** -* -* @file mapripper.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief A class that allows ripping of a selection of the map -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef MAPRIPPER_H -#define MAPRIPPER_H - -#include -#include "../internals/core.h" -#include "mapripform.h" -#include -#include -namespace mapcontrol -{ - class MapRipper:public QThread - { - Q_OBJECT - public: - MapRipper(internals::Core *,internals::RectLatLng const&); - void run(); - private: - QList points; - int zoom; - core::MapType::Types type; - int sleep; - internals::RectLatLng area; - bool cancel; - MapRipForm * progressForm; - int maxzoom; - internals::Core * core; - - signals: - void percentageChanged(int const& perc); - void numberOfTilesChanged(int const& total,int const& actual); - void providerChanged(QString const& prov,int const& zoom); - - - public slots: - void finish(); - }; -} -#endif // MAPRIPPER_H diff --git a/lib/opmapcontrol/src/mapwidget/mapwidget.pro b/lib/opmapcontrol/src/mapwidget/mapwidget.pro deleted file mode 100644 index 7b824ec6fab6505538a22b1624d0deef6d03d105..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/mapwidget.pro +++ /dev/null @@ -1,44 +0,0 @@ -TEMPLATE = lib -TARGET = opmapwidget -DEFINES += OPMAPWIDGET_LIBRARY -include(../../../../openpilotgcslibrary.pri) - -# DESTDIR = ../build -SOURCES += mapgraphicitem.cpp \ - opmapwidget.cpp \ - configuration.cpp \ - waypointitem.cpp \ - uavitem.cpp \ - gpsitem.cpp \ - trailitem.cpp \ - homeitem.cpp \ - mapripform.cpp \ - mapripper.cpp -LIBS += -L../build \ - -lcore \ - -linternals \ - -lcore - -POST_TARGETDEPS += ../build/libcore.a -POST_TARGETDEPS += ../build/libinternals.a - -HEADERS += mapgraphicitem.h \ - opmapwidget.h \ - configuration.h \ - waypointitem.h \ - uavitem.h \ - gpsitem.h \ - uavmapfollowtype.h \ - uavtrailtype.h \ - trailitem.h \ - homeitem.h \ - mapripform.h \ - mapripper.h -QT += opengl -QT += network -QT += sql -QT += svg -RESOURCES += mapresources.qrc - -FORMS += \ - mapripform.ui diff --git a/lib/opmapcontrol/src/mapwidget/opmapwidget.cpp b/lib/opmapcontrol/src/mapwidget/opmapwidget.cpp deleted file mode 100644 index 64599a082093bbb08957106525926fabe19a1958..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/opmapwidget.cpp +++ /dev/null @@ -1,347 +0,0 @@ -/** -****************************************************************************** -* -* @file opmapwidget.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief The Map Widget, this is the part exposed to the user -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "opmapwidget.h" -#include -#include -#include "waypointitem.h" - -namespace mapcontrol -{ - - OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config):QGraphicsView(parent),configuration(config),UAV(0),GPS(0),Home(0),followmouse(true),compass(0),showuav(false),showhome(false),showDiag(false),diagGraphItem(0),diagTimer(0) - { - setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - core=new internals::Core; - map=new MapGraphicItem(core,config); - mscene.addItem(map); - this->setScene(&mscene); - this->adjustSize(); - connect(map,SIGNAL(zoomChanged(double,double,double)),this,SIGNAL(zoomChanged(double,double,double))); - connect(map->core,SIGNAL(OnCurrentPositionChanged(internals::PointLatLng)),this,SIGNAL(OnCurrentPositionChanged(internals::PointLatLng))); - connect(map->core,SIGNAL(OnEmptyTileError(int,core::Point)),this,SIGNAL(OnEmptyTileError(int,core::Point))); - connect(map->core,SIGNAL(OnMapDrag()),this,SIGNAL(OnMapDrag())); - connect(map->core,SIGNAL(OnMapTypeChanged(MapType::Types)),this,SIGNAL(OnMapTypeChanged(MapType::Types))); - connect(map->core,SIGNAL(OnMapZoomChanged()),this,SIGNAL(OnMapZoomChanged())); - connect(map->core,SIGNAL(OnTileLoadComplete()),this,SIGNAL(OnTileLoadComplete())); - connect(map->core,SIGNAL(OnTileLoadStart()),this,SIGNAL(OnTileLoadStart())); - connect(map->core,SIGNAL(OnTilesStillToLoad(int)),this,SIGNAL(OnTilesStillToLoad(int))); - SetShowDiagnostics(showDiag); - this->setMouseTracking(followmouse); - SetShowCompass(true); - - } - void OPMapWidget::SetShowDiagnostics(bool const& value) - { - showDiag=value; - if(!showDiag) - { - if(diagGraphItem!=0) - { - delete diagGraphItem; - diagGraphItem=0; - } - if(diagTimer!=0) - { - delete diagTimer; - diagTimer=0; - } - } - else - { - diagTimer=new QTimer(); - connect(diagTimer,SIGNAL(timeout()),this,SLOT(diagRefresh())); - diagTimer->start(500); - } - - } - void OPMapWidget::SetShowUAV(const bool &value) - { - if(value && UAV==0) - { - UAV=new UAVItem(map,this); - UAV->setParentItem(map); - connect(this,SIGNAL(UAVLeftSafetyBouble(internals::PointLatLng)),UAV,SIGNAL(UAVLeftSafetyBouble(internals::PointLatLng))); - connect(this,SIGNAL(UAVReachedWayPoint(int,WayPointItem*)),UAV,SIGNAL(UAVReachedWayPoint(int,WayPointItem*))); - } - else if(!value) - { - if(UAV!=0) - { - delete UAV; - UAV=0; - } - - } - if(value && GPS==0) - { - GPS=new GPSItem(map,this); - GPS->setParentItem(map); - } - else if(!value) - { - if(GPS!=0) - { - delete GPS; - GPS=0; - } - - } - } - void OPMapWidget::SetShowHome(const bool &value) - { - if(value && Home==0) - { - Home=new HomeItem(map,this); - Home->setParentItem(map); - } - else if(!value) - { - if(Home!=0) - { - delete Home; - Home=0; - } - - } - } - - void OPMapWidget::resizeEvent(QResizeEvent *event) - { - if (scene()) - scene()->setSceneRect( - QRect(QPoint(0, 0), event->size())); - QGraphicsView::resizeEvent(event); - if(compass) - compass->setScale(0.1+0.05*(qreal)(event->size().width())/1000*(qreal)(event->size().height())/600); - - } - QSize OPMapWidget::sizeHint() const - { - return map->sizeHint(); - } - void OPMapWidget::showEvent(QShowEvent *event) - { - connect(&mscene,SIGNAL(sceneRectChanged(QRectF)),map,SLOT(resize(QRectF))); - map->start(); - QGraphicsView::showEvent(event); - } - OPMapWidget::~OPMapWidget() - { - delete UAV; - delete Home; - delete map; - delete core; - delete configuration; - foreach(QGraphicsItem* i,this->items()) - { - delete i; - } - } - void OPMapWidget::closeEvent(QCloseEvent *event) - { - core->OnMapClose(); - event->accept(); - } - void OPMapWidget::SetUseOpenGL(const bool &value) - { - useOpenGL=value; - if (useOpenGL) - setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); - else - setupViewport(new QWidget()); - update(); - } - internals::PointLatLng OPMapWidget::currentMousePosition() - { - return currentmouseposition; - } - - void OPMapWidget::mouseMoveEvent(QMouseEvent *event) - { - QGraphicsView::mouseMoveEvent(event); - QPointF p=event->posF(); - p=map->mapFromParent(p); - currentmouseposition=map->FromLocalToLatLng(p.x(),p.y()); - } - ////////////////WAYPOINT//////////////////////// - WayPointItem* OPMapWidget::WPCreate() - { - WayPointItem* item=new WayPointItem(this->CurrentPosition(),0,map); - ConnectWP(item); - item->setParentItem(map); - return item; - } - void OPMapWidget::WPCreate(WayPointItem* item) - { - ConnectWP(item); - item->setParentItem(map); - } - WayPointItem* OPMapWidget::WPCreate(internals::PointLatLng const& coord,int const& altitude) - { - WayPointItem* item=new WayPointItem(coord,altitude,map); - ConnectWP(item); - item->setParentItem(map); - return item; - } - WayPointItem* OPMapWidget::WPCreate(internals::PointLatLng const& coord,int const& altitude, QString const& description) - { - WayPointItem* item=new WayPointItem(coord,altitude,description,map); - ConnectWP(item); - item->setParentItem(map); - return item; - } - WayPointItem* OPMapWidget::WPInsert(const int &position) - { - WayPointItem* item=new WayPointItem(this->CurrentPosition(),0,map); - item->SetNumber(position); - ConnectWP(item); - item->setParentItem(map); - emit WPInserted(position,item); - return item; - } - void OPMapWidget::WPInsert(WayPointItem* item,const int &position) - { - item->SetNumber(position); - ConnectWP(item); - item->setParentItem(map); - emit WPInserted(position,item); - - } - WayPointItem* OPMapWidget::WPInsert(internals::PointLatLng const& coord,int const& altitude,const int &position) - { - WayPointItem* item=new WayPointItem(coord,altitude,map); - item->SetNumber(position); - ConnectWP(item); - item->setParentItem(map); - emit WPInserted(position,item); - return item; - } - WayPointItem* OPMapWidget::WPInsert(internals::PointLatLng const& coord,int const& altitude, QString const& description,const int &position) - { - WayPointItem* item=new WayPointItem(coord,altitude,description,map); - item->SetNumber(position); - ConnectWP(item); - item->setParentItem(map); - emit WPInserted(position,item); - return item; - } - void OPMapWidget::WPDelete(WayPointItem *item) - { - emit WPDeleted(item->Number()); - delete item; - } - void OPMapWidget::WPDeleteAll() - { - foreach(QGraphicsItem* i,map->childItems()) - { - WayPointItem* w=qgraphicsitem_cast(i); - if(w) - delete w; - } - } - QList OPMapWidget::WPSelected() - { - QList list; - foreach(QGraphicsItem* i,mscene.selectedItems()) - { - WayPointItem* w=qgraphicsitem_cast(i); - if(w) - list.append(w); - } - return list; - } - void OPMapWidget::WPRenumber(WayPointItem *item, const int &newnumber) - { - item->SetNumber(newnumber); - } - - void OPMapWidget::ConnectWP(WayPointItem *item) - { - connect(item,SIGNAL(WPNumberChanged(int,int,WayPointItem*)),this,SIGNAL(WPNumberChanged(int,int,WayPointItem*))); - connect(item,SIGNAL(WPValuesChanged(WayPointItem*)),this,SIGNAL(WPValuesChanged(WayPointItem*))); - connect(this,SIGNAL(WPInserted(int,WayPointItem*)),item,SLOT(WPInserted(int,WayPointItem*))); - connect(this,SIGNAL(WPNumberChanged(int,int,WayPointItem*)),item,SLOT(WPRenumbered(int,int,WayPointItem*))); - connect(this,SIGNAL(WPDeleted(int)),item,SLOT(WPDeleted(int))); - } - void OPMapWidget::diagRefresh() - { - if(showDiag) - { - if(diagGraphItem==0) - { - diagGraphItem=new QGraphicsTextItem(); - mscene.addItem(diagGraphItem); - diagGraphItem->setPos(10,100); - diagGraphItem->setZValue(3); - diagGraphItem->setFlag(QGraphicsItem::ItemIsMovable,true); - diagGraphItem->setDefaultTextColor(Qt::yellow); - } - diagGraphItem->setPlainText(core->GetDiagnostics().toString()); - } - else - if(diagGraphItem!=0) - { - delete diagGraphItem; - diagGraphItem=0; - } - } - - ////////////////////////////////////////////// - void OPMapWidget::SetShowCompass(const bool &value) - { - if(value && !compass) - { - compass=new QGraphicsSvgItem(QString::fromUtf8(":/markers/images/compas.svg")); - compass->setScale(0.1+0.05*(qreal)(this->size().width())/1000*(qreal)(this->size().height())/600); - // compass->setTransformOriginPoint(compass->boundingRect().width(),compass->boundingRect().height()); - compass->setFlag(QGraphicsItem::ItemIsMovable,true); - mscene.addItem(compass); - compass->setTransformOriginPoint(compass->boundingRect().width()/2,compass->boundingRect().height()/2); - compass->setPos(55-compass->boundingRect().width()/2,55-compass->boundingRect().height()/2); - compass->setZValue(3); - compass->setOpacity(0.7); - - } - if(!value && compass) - { - delete compass; - compass=0; - } - } - void OPMapWidget::SetRotate(qreal const& value) - { - map->mapRotate(value); - if(compass && (compass->rotation() != value)) { - compass->setRotation(value); - } - } - void OPMapWidget::RipMap() - { - new MapRipper(core,map->SelectedArea()); - } -} diff --git a/lib/opmapcontrol/src/mapwidget/opmapwidget.h b/lib/opmapcontrol/src/mapwidget/opmapwidget.h deleted file mode 100644 index 723fd515e0fa0ab084ee0afa2634e7bf53e5050d..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/opmapwidget.h +++ /dev/null @@ -1,480 +0,0 @@ -/** -****************************************************************************** -* -* @file opmapwidget.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief The Map Widget, this is the part exposed to the user -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef OPMAPWIDGET_H -#define OPMAPWIDGET_H - -#include "../mapwidget/mapgraphicitem.h" -#include "../core/geodecoderstatus.h" -#include "../core/maptype.h" -#include "../core/languagetype.h" -#include "../core/diagnostics.h" -#include "configuration.h" -#include -#include -#include "waypointitem.h" -#include "QtSvg/QGraphicsSvgItem" -#include "configuration.h" -#include "uavitem.h" -#include "gpsitem.h" -#include "homeitem.h" -#include "mapripper.h" -namespace mapcontrol -{ - class UAVItem; - class GPSItem; - class HomeItem; - /** - * @brief Collection of static functions to help dealing with various enums used - * Contains functions for enumToString conversio, StringToEnum, QStringList of enum values... - * - * @class Helper opmapwidget.h "opmapwidget.h" - */ - class Helper - { - public: - /** - * @brief Converts from String to Type - * - * @param value String to convert - * @return - */ - static MapType::Types MapTypeFromString(QString const& value){return MapType::TypeByStr(value);} - /** - * @brief Converts from Type to String - */ - static QString StrFromMapType(MapType::Types const& value){return MapType::StrByType(value);} - /** - * @brief Returns QStringList with string representing all the enum values - */ - static QStringList MapTypes(){return MapType::TypesList();} - - /** - * @brief Converts from String to Type - */ - static GeoCoderStatusCode::Types GeoCoderStatusCodeFromString(QString const& value){return GeoCoderStatusCode::TypeByStr(value);} - /** - * @brief Converts from Type to String - */ - static QString StrFromGeoCoderStatusCode(GeoCoderStatusCode::Types const& value){return GeoCoderStatusCode::StrByType(value);} - /** - * @brief Returns QStringList with string representing all the enum values - */ - static QStringList GeoCoderTypes(){return GeoCoderStatusCode::TypesList();} - - /** - * @brief Converts from String to Type - */ - static internals::MouseWheelZoomType::Types MouseWheelZoomTypeFromString(QString const& value){return internals::MouseWheelZoomType::TypeByStr(value);} - /** - * @brief Converts from Type to String - */ - static QString StrFromMouseWheelZoomType(internals::MouseWheelZoomType::Types const& value){return internals::MouseWheelZoomType::StrByType(value);} - /** - * @brief Returns QStringList with string representing all the enum values - */ - static QStringList MouseWheelZoomTypes(){return internals::MouseWheelZoomType::TypesList();} - /** - * @brief Converts from String to Type - */ - static core::LanguageType::Types LanguageTypeFromString(QString const& value){return core::LanguageType::TypeByStr(value);} - /** - * @brief Converts from Type to String - */ - static QString StrFromLanguageType(core::LanguageType::Types const& value){return core::LanguageType::StrByType(value);} - /** - * @brief Returns QStringList with string representing all the enum values - */ - static QStringList LanguageTypes(){return core::LanguageType::TypesList();} - /** - * @brief Converts from String to Type - */ - static core::AccessMode::Types AccessModeFromString(QString const& value){return core::AccessMode::TypeByStr(value);} - /** - * @brief Converts from Type to String - */ - static QString StrFromAccessMode(core::AccessMode::Types const& value){return core::AccessMode::StrByType(value);} - /** - * @brief Returns QStringList with string representing all the enum values - */ - static QStringList AccessModeTypes(){return core::AccessMode::TypesList();} - - /** - * @brief Converts from String to Type - */ - static UAVMapFollowType::Types UAVMapFollowFromString(QString const& value){return UAVMapFollowType::TypeByStr(value);} - /** - * @brief Converts from Type to String - */ - static QString StrFromUAVMapFollow(UAVMapFollowType::Types const& value){return UAVMapFollowType::StrByType(value);} - /** - * @brief Returns QStringList with string representing all the enum values - */ - static QStringList UAVMapFollowTypes(){return UAVMapFollowType::TypesList();} - /** - * @brief Converts from String to Type - */ - static UAVTrailType::Types UAVTrailTypeFromString(QString const& value){return UAVTrailType::TypeByStr(value);} - /** - * @brief Converts from Type to String - */ - static QString StrFromUAVTrailType(UAVTrailType::Types const& value){return UAVTrailType::StrByType(value);} - /** - * @brief Returns QStringList with string representing all the enum values - */ - static QStringList UAVTrailTypes(){return UAVTrailType::TypesList();} - }; - - class OPMapWidget:public QGraphicsView - { - Q_OBJECT - - // Q_PROPERTY(int MaxZoom READ MaxZoom WRITE SetMaxZoom) - Q_PROPERTY(int MinZoom READ MinZoom WRITE SetMinZoom) - Q_PROPERTY(bool ShowTileGridLines READ ShowTileGridLines WRITE SetShowTileGridLines) - Q_PROPERTY(double Zoom READ ZoomTotal WRITE SetZoom) - Q_PROPERTY(qreal Rotate READ Rotate WRITE SetRotate) - Q_ENUMS(internals::MouseWheelZoomType::Types) - Q_ENUMS(internals::GeoCoderStatusCode::Types) - - public: - QSize sizeHint() const; - /** - * @brief Constructor - * - * @param parent parent widget - * @param config pointer to configuration classed to be used - * @return - */ - OPMapWidget(QWidget *parent=0, mapcontrol::Configuration *config=new mapcontrol::Configuration()); - ~OPMapWidget(); - - /** - * @brief Returns true if map is showing gridlines - * - * @return bool - */ - bool ShowTileGridLines()const {return map->showTileGridLines;} - - /** - * @brief Defines if map is to show gridlines - * - * @param value - * @return - */ - void SetShowTileGridLines(bool const& value){map->showTileGridLines=value;map->update();} - - /** - * @brief Returns the maximum zoom for the map - * - */ - int MaxZoom()const{return map->MaxZoom();} - - // void SetMaxZoom(int const& value){map->maxZoom = value;} - - /** - * @brief - * - */ - int MinZoom()const{return map->minZoom;} - /** - * @brief - * - * @param value - */ - void SetMinZoom(int const& value){map->minZoom = value;} - - internals::MouseWheelZoomType::Types GetMouseWheelZoomType(){return map->core->GetMouseWheelZoomType();} - void SetMouseWheelZoomType(internals::MouseWheelZoomType::Types const& value){map->core->SetMouseWheelZoomType(value);} - // void SetMouseWheelZoomTypeByStr(const QString &value){map->core->SetMouseWheelZoomType(internals::MouseWheelZoomType::TypeByStr(value));} - // QString GetMouseWheelZoomTypeStr(){return map->GetMouseWheelZoomTypeStr();} - - internals::RectLatLng SelectedArea()const{return map->selectedArea;} - void SetSelectedArea(internals::RectLatLng const& value){ map->selectedArea = value;this->update();} - - bool CanDragMap()const{return map->CanDragMap();} - void SetCanDragMap(bool const& value){map->SetCanDragMap(value);} - - internals::PointLatLng CurrentPosition()const{return map->core->CurrentPosition();} - void SetCurrentPosition(internals::PointLatLng const& value){map->core->SetCurrentPosition(value);} - - double ZoomReal(){return map->Zoom();} - double ZoomDigi(){return map->ZoomDigi();} - double ZoomTotal(){return map->ZoomTotal();} - void SetZoom(double const& value){map->SetZoom(value);} - - qreal Rotate(){return map->rotation;} - void SetRotate(qreal const& value); - - void ReloadMap(){map->ReloadMap(); map->resize();} - - GeoCoderStatusCode::Types SetCurrentPositionByKeywords(QString const& keys){return map->SetCurrentPositionByKeywords(keys);} - - bool UseOpenGL(){return useOpenGL;} - void SetUseOpenGL(bool const& value); - - MapType::Types GetMapType(){return map->core->GetMapType();} - void SetMapType(MapType::Types const& value){map->lastimage=QImage(); map->core->SetMapType(value);} - - bool isStarted(){return map->core->isStarted();} - - Configuration* configuration; - - internals::PointLatLng currentMousePosition(); - - void SetFollowMouse(bool const& value){followmouse=value;this->setMouseTracking(followmouse);} - bool FollowMouse(){return followmouse;} - - internals::PointLatLng GetFromLocalToLatLng(QPointF p) {return map->FromLocalToLatLng(p.x(),p.y());} - - /** - * @brief Creates a new WayPoint on the center of the map - * - * @return WayPointItem a pointer to the WayPoint created - */ - WayPointItem* WPCreate(); - /** - * @brief Creates a new WayPoint - * - * @param item the WayPoint to create - */ - void WPCreate(WayPointItem* item); - /** - * @brief Creates a new WayPoint - * - * @param coord the coordinates in LatLng of the WayPoint - * @param altitude the Altitude of the WayPoint - * @return WayPointItem a pointer to the WayPoint created - */ - WayPointItem* WPCreate(internals::PointLatLng const& coord,int const& altitude); - /** - * @brief Creates a new WayPoint - * - * @param coord the coordinates in LatLng of the WayPoint - * @param altitude the Altitude of the WayPoint - * @param description the description of the WayPoint - * @return WayPointItem a pointer to the WayPoint created - */ - WayPointItem* WPCreate(internals::PointLatLng const& coord,int const& altitude, QString const& description); - /** - * @brief Inserts a new WayPoint on the specified position - * - * @param position index of the WayPoint - * @return WayPointItem a pointer to the WayPoint created - */ - WayPointItem* WPInsert(int const& position); - /** - * @brief Inserts a new WayPoint on the specified position - * - * @param item the WayPoint to Insert - * @param position index of the WayPoint - */ - void WPInsert(WayPointItem* item,int const& position); - /** - * @brief Inserts a new WayPoint on the specified position - * - * @param coord the coordinates in LatLng of the WayPoint - * @param altitude the Altitude of the WayPoint - * @param position index of the WayPoint - * @return WayPointItem a pointer to the WayPoint Inserted - */ - WayPointItem* WPInsert(internals::PointLatLng const& coord,int const& altitude,int const& position); - /** - * @brief Inserts a new WayPoint on the specified position - * - * @param coord the coordinates in LatLng of the WayPoint - * @param altitude the Altitude of the WayPoint - * @param description the description of the WayPoint - * @param position index of the WayPoint - * @return WayPointItem a pointer to the WayPoint Inserted - */ - WayPointItem* WPInsert(internals::PointLatLng const& coord,int const& altitude, QString const& description,int const& position); - - /** - * @brief Deletes the WayPoint - * - * @param item the WayPoint to delete - */ - void WPDelete(WayPointItem* item); - /** - * @brief deletes all WayPoints - * - */ - void WPDeleteAll(); - /** - * @brief Returns the currently selected WayPoints - * - * @return @return QList - */ - QList WPSelected(); - - /** - * @brief Renumbers the WayPoint and all others as needed - * - * @param item the WayPoint to renumber - * @param newnumber the WayPoint's new number - */ - void WPRenumber(WayPointItem* item,int const& newnumber); - - void SetShowCompass(bool const& value); - - UAVItem* UAV; - GPSItem* GPS; - HomeItem* Home; - void SetShowUAV(bool const& value); - bool ShowUAV()const{return showuav;} - void SetShowHome(bool const& value); - bool ShowHome()const{return showhome;} - void SetShowDiagnostics(bool const& value); - private: - internals::Core *core; - MapGraphicItem *map; - QGraphicsScene mscene; - bool useOpenGL; - GeoCoderStatusCode x; - MapType y; - core::AccessMode xx; - internals::PointLatLng currentmouseposition; - bool followmouse; - void ConnectWP(WayPointItem* item); - QGraphicsSvgItem *compass; - bool showuav; - bool showhome; - QTimer * diagTimer; - QGraphicsTextItem * diagGraphItem; - bool showDiag; - private slots: - void diagRefresh(); - // WayPointItem* item;//apagar - protected: - void resizeEvent(QResizeEvent *event); - void showEvent ( QShowEvent * event ); - void closeEvent(QCloseEvent *event); - void mouseMoveEvent ( QMouseEvent * event ); - // private slots: - signals: - void zoomChanged(double zoomt,double zoom, double zoomd); - /** - * @brief fires when one of the WayPoints numbers changes (not fired if due to a auto-renumbering) - * - * @param oldnumber WayPoint old number - * @param newnumber WayPoint new number - * @param waypoint a pointer to the WayPoint that was renumbered - */ - void WPNumberChanged(int const& oldnumber,int const& newnumber,WayPointItem* waypoint); - /** - * @brief Fired when the description, altitude or coordinates of a WayPoint changed - * - * @param waypoint a pointer to the WayPoint - */ - void WPValuesChanged(WayPointItem* waypoint); - /** - * @brief Fires when a new WayPoint is inserted - * - * @param number new WayPoint number - * @param waypoint WayPoint inserted - */ - void WPReached(WayPointItem* waypoint); - /** - * @brief Fires when a new WayPoint is inserted - * - * @param number new WayPoint number - * @param waypoint WayPoint inserted - */ - void WPInserted(int const& number,WayPointItem* waypoint); - /** - * @brief Fires When a WayPoint is deleted - * - * @param number number of the deleted WayPoint - */ - void WPDeleted(int const& number); - /** - * @brief Fires When a WayPoint is Reached - * - * @param number number of the Reached WayPoint - */ - void UAVReachedWayPoint(int const& waypointnumber,WayPointItem* waypoint); - /** - * @brief Fires When the UAV lives the safety bouble - * - * @param position the position of the UAV - */ - void UAVLeftSafetyBouble(internals::PointLatLng const& position); - - /** - * @brief Fires when map position changes - * - * @param point the point in LatLng of the new center of the map - */ - void OnCurrentPositionChanged(internals::PointLatLng point); - /** - * @brief Fires when there are no more tiles to load - * - */ - void OnTileLoadComplete(); - /** - * @brief Fires when tiles loading begins - * - */ - void OnTileLoadStart(); - /** - * @brief Fires when the map is dragged - * - */ - void OnMapDrag(); - /** - * @brief Fires when map zoom changes - * - */ - void OnMapZoomChanged(); - /** - * @brief Fires when map type changes - * - * @param type The maps new type - */ - void OnMapTypeChanged(MapType::Types type); - /** - * @brief Fires when an error ocurred while loading a tile - * - * @param zoom tile zoom - * @param pos tile position - */ - void OnEmptyTileError(int zoom, core::Point pos); - /** - * @brief Fires when the number of tiles in the load queue changes - * - * @param number the number of tiles still in the queue - */ - void OnTilesStillToLoad(int number); - public slots: - /** - * @brief Ripps the current selection to the DB - */ - void RipMap(); - - }; -} -#endif // OPMAPWIDGET_H diff --git a/lib/opmapcontrol/src/mapwidget/trailitem.cpp b/lib/opmapcontrol/src/mapwidget/trailitem.cpp deleted file mode 100644 index 41e50c29bf8367292813d7372fd21190aef10fd1..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/trailitem.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/** -****************************************************************************** -* -* @file trailitem.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief A graphicsItem representing a trail point -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "trailitem.h" -#include -namespace mapcontrol -{ - TrailItem::TrailItem(internals::PointLatLng const& coord,int const& altitude, QBrush color, QGraphicsItem* parent):QGraphicsItem(parent),coord(coord) - { - m_brush=color; - QDateTime time=QDateTime::currentDateTime(); - QString coord_str = " " + QString::number(coord.Lat(), 'f', 6) + " " + QString::number(coord.Lng(), 'f', 6); - setToolTip(QString(tr("Position:")+"%1\n"+tr("Altitude:")+"%2\n"+tr("Time:")+"%3").arg(coord_str).arg(QString::number(altitude)).arg(time.toString())); - } - - void TrailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) - { - // painter->drawRect(QRectF(-3,-3,6,6)); - painter->setBrush(m_brush); - painter->drawEllipse(-2,-2,4,4); - } - QRectF TrailItem::boundingRect()const - { - return QRectF(-2,-2,4,4); - } - - - int TrailItem::type()const - { - return Type; - } - - -} diff --git a/lib/opmapcontrol/src/mapwidget/trailitem.h b/lib/opmapcontrol/src/mapwidget/trailitem.h deleted file mode 100644 index 4af8282d5485102ade296054b2157bb96f858858..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/trailitem.h +++ /dev/null @@ -1,63 +0,0 @@ -/** -****************************************************************************** -* -* @file trailitem.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief A graphicsItem representing a WayPoint -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef TRAILITEM_H -#define TRAILITEM_H - -#include -#include -#include -#include "../internals/pointlatlng.h" -#include - -namespace mapcontrol -{ - - class TrailItem:public QObject,public QGraphicsItem - { - Q_OBJECT - Q_INTERFACES(QGraphicsItem) - public: - enum { Type = UserType + 3 }; - TrailItem(internals::PointLatLng const& coord,int const& altitude, QBrush color, QGraphicsItem* parent); - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); - QRectF boundingRect() const; - int type() const; - internals::PointLatLng coord; - private: - QBrush m_brush; - - - public slots: - - signals: - - }; -} -#endif // TRAILITEM_H - - diff --git a/lib/opmapcontrol/src/mapwidget/uavitem.cpp b/lib/opmapcontrol/src/mapwidget/uavitem.cpp deleted file mode 100644 index 5499d55f38f97a637f1228bd4be667a1ded67082..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/uavitem.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/** -****************************************************************************** -* -* @file uavitem.cpp -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief A graphicsItem representing a UAV -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include "../internals/pureprojection.h" -#include "uavitem.h" -namespace mapcontrol -{ - UAVItem::UAVItem(MapGraphicItem* map,OPMapWidget* parent):map(map),mapwidget(parent),showtrail(true),trailtime(5),traildistance(50),autosetreached(true) - ,autosetdistance(100) - { - pic.load(QString::fromUtf8(":/markers/images/mapquad.png")); - // Don't scale but trust the image we are given - // pic=pic.scaled(50,33,Qt::IgnoreAspectRatio); - localposition=map->FromLatLngToLocal(mapwidget->CurrentPosition()); - this->setPos(localposition.X(),localposition.Y()); - this->setZValue(4); - trail=new QGraphicsItemGroup(); - trail->setParentItem(map); - - - this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true); - mapfollowtype=UAVMapFollowType::None; - trailtype=UAVTrailType::ByDistance; - timer.start(); - - // rect=QRectF(0,0,renderer.defaultSize().width()*0.05,renderer.defaultSize().height()*0.05); - - } - UAVItem::~UAVItem() - { - delete trail; - } - - void UAVItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) - { - Q_UNUSED(option); - Q_UNUSED(widget); - // painter->rotate(-90); - painter->drawPixmap(-pic.width()/2,-pic.height()/2,pic); - // painter->drawRect(QRectF(-pic.width()/2,-pic.height()/2,pic.width()-1,pic.height()-1)); - } - QRectF UAVItem::boundingRect()const - { - return QRectF(-pic.width()/2,-pic.height()/2,pic.width(),pic.height()); - } - void UAVItem::SetUAVPos(const internals::PointLatLng &position, const int &altitude) - { - if(coord.IsEmpty()) - lastcoord=coord; - if(coord!=position) - { - - if(trailtype==UAVTrailType::ByTimeElapsed) - { - if(timer.elapsed()>trailtime*1000) - { - trail->addToGroup(new TrailItem(position,altitude,Qt::red,this)); - timer.restart(); - } - - } - else if(trailtype==UAVTrailType::ByDistance) - { - if(qAbs(internals::PureProjection::DistanceBetweenLatLng(lastcoord,position)*1000)>traildistance) - { - trail->addToGroup(new TrailItem(position,altitude,Qt::red,this)); - lastcoord=position; - } - } - coord=position; - this->altitude=altitude; - RefreshPos(); - if(mapfollowtype==UAVMapFollowType::CenterAndRotateMap||mapfollowtype==UAVMapFollowType::CenterMap) - { - mapwidget->SetCurrentPosition(coord); - } - this->update(); - if(autosetreached) - { - foreach(QGraphicsItem* i,map->childItems()) - { - WayPointItem* wp=qgraphicsitem_cast(i); - if(wp) - { - if(Distance3D(wp->Coord(),wp->Altitude())SetReached(true); - emit UAVReachedWayPoint(wp->Number(),wp); - } - } - } - } - if(mapwidget->Home!=0) - { - //verify if the UAV is inside the safety bouble - if(Distance3D(mapwidget->Home->Coord(),mapwidget->Home->Altitude())>mapwidget->Home->SafeArea()) - { - if(mapwidget->Home->safe!=false) - { - mapwidget->Home->safe=false; - mapwidget->Home->update(); - emit UAVLeftSafetyBouble(this->coord); - } - } - else - { - if(mapwidget->Home->safe!=true) - { - mapwidget->Home->safe=true; - mapwidget->Home->update(); - } - } - - } - } - } - - /** - * Rotate the UAV Icon on the map, or rotate the map - * depending on the display mode - */ - void UAVItem::SetUAVHeading(const qreal &value) - { - if(mapfollowtype==UAVMapFollowType::CenterAndRotateMap) - { - mapwidget->SetRotate(-value); - } - else { - if (this->rotation() != value) - this->setRotation(value); - } - } - - - int UAVItem::type()const - { - return Type; - } - - - void UAVItem::RefreshPos() - { - localposition=map->FromLatLngToLocal(coord); - this->setPos(localposition.X(),localposition.Y()); - foreach(QGraphicsItem* i,trail->childItems()) - { - TrailItem* w=qgraphicsitem_cast(i); - if(w) - w->setPos(map->FromLatLngToLocal(w->coord).X(),map->FromLatLngToLocal(w->coord).Y()); - //this->update(); - } - - } - void UAVItem::SetTrailType(const UAVTrailType::Types &value) - { - trailtype=value; - if(trailtype==UAVTrailType::ByTimeElapsed) - timer.restart(); - } - void UAVItem::SetShowTrail(const bool &value) - { - showtrail=value; - trail->setVisible(value); - } - void UAVItem::DeleteTrail()const - { - foreach(QGraphicsItem* i,trail->childItems()) - delete i; - } - double UAVItem::Distance3D(const internals::PointLatLng &coord, const int &altitude) - { - return sqrt(pow(internals::PureProjection::DistanceBetweenLatLng(this->coord,coord)*1000,2)+ - pow(this->altitude-altitude,2)); - - } -} diff --git a/lib/opmapcontrol/src/mapwidget/uavitem.h b/lib/opmapcontrol/src/mapwidget/uavitem.h deleted file mode 100644 index 7250b900d209df895250cc9f9cbab2b170114f1b..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/uavitem.h +++ /dev/null @@ -1,209 +0,0 @@ -/** -****************************************************************************** -* -* @file uavitem.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief A graphicsItem representing a WayPoint -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef UAVITEM_H -#define UAVITEM_H - -#include -#include -#include -#include "../internals/pointlatlng.h" -#include "mapgraphicitem.h" -#include "waypointitem.h" -#include -#include "uavmapfollowtype.h" -#include "uavtrailtype.h" -#include -#include "opmapwidget.h" -#include "trailitem.h" -namespace mapcontrol -{ - class WayPointItem; - class OPMapWidget; - /** -* @brief A QGraphicsItem representing the UAV -* -* @class UAVItem uavitem.h "mapwidget/uavitem.h" -*/ - class UAVItem:public QObject,public QGraphicsItem - { - Q_OBJECT - Q_INTERFACES(QGraphicsItem) - public: - enum { Type = UserType + 2 }; - UAVItem(MapGraphicItem* map,OPMapWidget* parent); - ~UAVItem(); - /** - * @brief Sets the UAV position - * - * @param position LatLng point - * @param altitude altitude in meters - */ - void SetUAVPos(internals::PointLatLng const& position,int const& altitude); - /** - * @brief Sets the UAV heading - * - * @param value heading angle (north=0deg) - */ - void SetUAVHeading(qreal const& value); - /** - * @brief Returns the UAV position - * - * @return internals::PointLatLng - */ - internals::PointLatLng UAVPos()const{return coord;} - /** - * @brief Sets the Map follow type - * - * @param value can be "none"(map doesnt follow UAV), "CenterMap"(map moves to keep UAV centered) or "CenterAndRotateMap"(map moves and rotates to keep UAV centered and straight) - */ - void SetMapFollowType(UAVMapFollowType::Types const& value){mapfollowtype=value;} - /** - * @brief Sets the trail type - * - * @param value can be "NoTrail"(no trail is plotted), "ByTimeElapsed"(a trail point is plotted each TrailTime()) or ByDistance(a trail point is plotted if the distance between the UAV and the last trail point is bigger than TrailDistance()) - */ - void SetTrailType(UAVTrailType::Types const& value); - /** - * @brief Returns the map follow method used - * - * @return UAVMapFollowType::Types - */ - UAVMapFollowType::Types GetMapFollowType()const{return mapfollowtype;} - /** - * @brief Returns the UAV trail type. It can be plotted by time elapsed or distance - * - * @return UAVTrailType::Types - */ - UAVTrailType::Types GetTrailType()const{return trailtype;} - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); - void RefreshPos(); - QRectF boundingRect() const; - /** - * @brief Sets the trail time to be used if TrailType is ByTimeElapsed - * - * @param seconds the UAV trail time elapsed value. If the trail type is time elapsed - * a trail point will be plotted each "value returned" seconds. - */ - void SetTrailTime(int const& seconds){trailtime=seconds;} - /** - * @brief Returns the UAV trail time elapsed value. If the trail type is time elapsed - * a trail point will be plotted each "value returned" seconds. - * - * @return int - */ - int TrailTime()const{return trailtime;} - /** - * @brief Sets the trail distance to be used if TrailType is ByDistance - * - * @param distance the UAV trail plot distance. - * If the trail type is ByDistance a trail dot is plotted if - * the distance between the current UAV position and the last trail point - * is bigger than the returned value - */ - void SetTrailDistance(int const& distance){traildistance=distance;} - /** - * @brief Returns the UAV trail plot distance. - * If the trail type is distance diference a trail dot is plotted if - * the distance between the current UAV position and the last trail point - * is bigger than the returned value - * - * @return int - */ - int TrailDistance()const{return traildistance;} - /** - * @brief Returns true if UAV trail is shown - * - * @return bool - */ - bool ShowTrail()const{return showtrail;} - /** - * @brief Used to define if the UAV displays a trail - * - * @param value - */ - void SetShowTrail(bool const& value); - /** - * @brief Deletes all the trail points - */ - void DeleteTrail()const; - /** - * @brief Returns true if the UAV automaticaly sets WP reached value (changing its color) - * - * @return bool - */ - bool AutoSetReached()const{return autosetreached;} - /** - * @brief Defines if the UAV can set the WP's "reached" value automaticaly. - * - * @param value - */ - void SetAutoSetReached(bool const& value){autosetreached=value;} - /** - * @brief Returns the 3D distance in meters necessary for the UAV to set WP's to "reached" - * - * @return double - */ - double AutoSetDistance()const{return autosetdistance;} - /** - * @brief Sets the the 3D distance in meters necessary for the UAV to set WP's to "reached" - * - * @param value - */ - void SetAutoSetDistance(double const& value){autosetdistance=value;} - - int type() const; - private: - MapGraphicItem* map; - - int altitude; - UAVMapFollowType::Types mapfollowtype; - UAVTrailType::Types trailtype; - internals::PointLatLng coord; - internals::PointLatLng lastcoord; - QPixmap pic; - core::Point localposition; - OPMapWidget* mapwidget; - QGraphicsItemGroup* trail; - QTime timer; - bool showtrail; - int trailtime; - int traildistance; - bool autosetreached; - double Distance3D(internals::PointLatLng const& coord, int const& altitude); - double autosetdistance; - // QRectF rect; - - public slots: - - signals: - void UAVReachedWayPoint(int const& waypointnumber,WayPointItem* waypoint); - void UAVLeftSafetyBouble(internals::PointLatLng const& position); - }; -} -#endif // UAVITEM_H diff --git a/lib/opmapcontrol/src/mapwidget/uavmapfollowtype.h b/lib/opmapcontrol/src/mapwidget/uavmapfollowtype.h deleted file mode 100644 index a2321a4c3152ca73ce6b109674e21dd5f774403e..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/uavmapfollowtype.h +++ /dev/null @@ -1,86 +0,0 @@ -/** -****************************************************************************** -* -* @file uavmapfollowtype.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief An enum representing the various map follow modes -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef UAVMAPFOLLOWTYPE_H -#define UAVMAPFOLLOWTYPE_H -#include -#include -#include -#include -namespace mapcontrol { - class UAVMapFollowType:public QObject - { - Q_OBJECT - Q_ENUMS(Types) - public: - enum Types - { - /// - /// only centers the map on the UAV - /// - CenterMap, - - /// - /// centers and rotates map on the UAV - /// - CenterAndRotateMap, - - /// - /// map is not connected to UAV position or heading - /// - None - }; - static QString StrByType(Types const& value) - { - QMetaObject metaObject = UAVMapFollowType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - QString s=metaEnum.valueToKey(value); - return s; - } - static Types TypeByStr(QString const& value) - { - QMetaObject metaObject = UAVMapFollowType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - Types s=(Types)metaEnum.keyToValue(value.toLatin1()); - return s; - } - static QStringList TypesList() - { - QStringList ret; - QMetaObject metaObject = UAVMapFollowType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - for(int x=0;x -#include -#include -#include -namespace mapcontrol { - class UAVTrailType:public QObject - { - Q_OBJECT - Q_ENUMS(Types) - public: - enum Types - { - /** - * @brief UAV does not plot a trail - * - * @var NoTrail - */ - NoTrail, - /** - * @brief UAV plots a trail point every 'x' seconds - * - * @var ByTimeElapsed - */ - ByTimeElapsed, - /** - * @brief UAV plots a trail point every 'x' meters (ground distance) - * - * @var ByDistance - */ - ByDistance - }; - static QString StrByType(Types const& value) - { - QMetaObject metaObject = UAVTrailType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - QString s=metaEnum.valueToKey(value); - return s; - } - static Types TypeByStr(QString const& value) - { - QMetaObject metaObject = UAVTrailType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - Types s=(Types)metaEnum.keyToValue(value.toLatin1()); - return s; - } - static QStringList TypesList() - { - QStringList ret; - QMetaObject metaObject = UAVTrailType().staticMetaObject; - QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types")); - for(int x=0;xsetFlag(QGraphicsItem::ItemIsMovable,true); - this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true); - this->setFlag(QGraphicsItem::ItemIsSelectable,true); - // transf.translate(picture.width()/2,picture.height()); - // this->setTransform(transf); - SetShowNumber(shownumber); - RefreshToolTip(); - RefreshPos(); - } - WayPointItem::WayPointItem(const internals::PointLatLng &coord,int const& altitude, const QString &description, MapGraphicItem *map):coord(coord),reached(false),description(description),shownumber(true),isDragging(false),altitude(altitude),map(map) - { - text=0; - numberI=0; - picture.load(QString::fromUtf8(":/markers/images/marker.png")); - number=WayPointItem::snumber; - ++WayPointItem::snumber; - this->setFlag(QGraphicsItem::ItemIsMovable,true); - this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true); - this->setFlag(QGraphicsItem::ItemIsSelectable,true); - //transf.translate(picture.width()/2,picture.height()); - // this->setTransform(transf); - SetShowNumber(shownumber); - RefreshToolTip(); - RefreshPos(); - } - - QRectF WayPointItem::boundingRect() const - { - return QRectF(-picture.width()/2,-picture.height(),picture.width(),picture.height()); - } - void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) - { - Q_UNUSED(option); - Q_UNUSED(widget); - painter->drawPixmap(-picture.width()/2,-picture.height(),picture); - if(this->isSelected()) - painter->drawRect(QRectF(-picture.width()/2,-picture.height(),picture.width()-1,picture.height()-1)); - } - void WayPointItem::mousePressEvent(QGraphicsSceneMouseEvent *event) - { - if(event->button()==Qt::LeftButton) - { - text=new QGraphicsSimpleTextItem(this); - textBG=new QGraphicsRectItem(this); - -// textBG->setBrush(Qt::white); -// textBG->setOpacity(0.5); - - textBG->setBrush(QColor(255, 255, 255, 128)); - - text->setPen(QPen(Qt::red)); - text->setPos(10,-picture.height()); - textBG->setPos(10,-picture.height()); - text->setZValue(3); - RefreshToolTip(); - isDragging=true; - } - QGraphicsItem::mousePressEvent(event); - } - void WayPointItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) - { - if(event->button()==Qt::LeftButton) - { - delete text; - delete textBG; - coord=map->FromLocalToLatLng(this->pos().x(),this->pos().y()); - isDragging=false; - RefreshToolTip(); - - emit WPValuesChanged(this); - } - QGraphicsItem::mouseReleaseEvent(event); - } - void WayPointItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) - { - - if(isDragging) - { - coord=map->FromLocalToLatLng(this->pos().x(),this->pos().y()); - QString coord_str = " " + QString::number(coord.Lat(), 'f', 6) + " " + QString::number(coord.Lng(), 'f', 6); - text->setText(coord_str); - textBG->setRect(text->boundingRect()); - - emit WPValuesChanged(this); - } - QGraphicsItem::mouseMoveEvent(event); - } - void WayPointItem::SetAltitude(const int &value) - { - altitude=value; - RefreshToolTip(); - - emit WPValuesChanged(this); - this->update(); - } - void WayPointItem::SetCoord(const internals::PointLatLng &value) - { - coord=value; - emit WPValuesChanged(this); - RefreshPos(); - RefreshToolTip(); - this->update(); - } - void WayPointItem::SetDescription(const QString &value) - { - description=value; - RefreshToolTip(); - emit WPValuesChanged(this); - this->update(); - } - void WayPointItem::SetNumber(const int &value) - { - emit WPNumberChanged(number,value,this); - number=value; - RefreshToolTip(); - numberI->setText(QString::number(number)); - numberIBG->setRect(numberI->boundingRect().adjusted(-2,0,1,0)); - this->update(); - } - void WayPointItem::SetReached(const bool &value) - { - reached=value; - emit WPValuesChanged(this); - if(value) - picture.load(QString::fromUtf8(":/markers/images/bigMarkerGreen.png")); - else - picture.load(QString::fromUtf8(":/markers/images/marker.png")); - this->update(); - - } - void WayPointItem::SetShowNumber(const bool &value) - { - shownumber=value; - if((numberI==0) && value) - { - numberI=new QGraphicsSimpleTextItem(this); - numberIBG=new QGraphicsRectItem(this); - numberIBG->setBrush(Qt::white); - numberIBG->setOpacity(0.5); - numberI->setZValue(3); - numberI->setPen(QPen(Qt::blue)); - numberI->setPos(0,-13-picture.height()); - numberIBG->setPos(0,-13-picture.height()); - numberI->setText(QString::number(number)); - numberIBG->setRect(numberI->boundingRect().adjusted(-2,0,1,0)); - } - else if (!value && numberI) - { - delete numberI; - delete numberIBG; - } - this->update(); - } - void WayPointItem::WPDeleted(const int &onumber) - { - if(number>onumber) --number; - numberI->setText(QString::number(number)); - numberIBG->setRect(numberI->boundingRect().adjusted(-2,0,1,0)); - RefreshToolTip(); - this->update(); - } - void WayPointItem::WPInserted(const int &onumber, WayPointItem *waypoint) - { - if(waypoint!=this) - { - if(onumber<=number) ++number; - numberI->setText(QString::number(number)); - RefreshToolTip(); - this->update(); - } - } - void WayPointItem::WPRenumbered(const int &oldnumber, const int &newnumber, WayPointItem *waypoint) - { - if (waypoint!=this) - { - if(((oldnumber>number) && (newnumber<=number))) - { - ++number; - numberI->setText(QString::number(number)); - numberIBG->setRect(numberI->boundingRect().adjusted(-2,0,1,0)); - RefreshToolTip(); - } - else if (((oldnumbernumber))) - { - --number; - numberI->setText(QString::number(number)); - numberIBG->setRect(numberI->boundingRect().adjusted(-2,0,1,0)); - RefreshToolTip(); - } - else if (newnumber==number) - { - ++number; - numberI->setText(QString::number(number)); - RefreshToolTip(); - } - this->update(); - } - } - int WayPointItem::type() const - { - // Enable the use of qgraphicsitem_cast with this item. - return Type; - } - - WayPointItem::~WayPointItem() - { - --WayPointItem::snumber; - } - void WayPointItem::RefreshPos() - { - core::Point point=map->FromLatLngToLocal(coord); - this->setPos(point.X(),point.Y()); - } - void WayPointItem::RefreshToolTip() - { - QString coord_str = " " + QString::number(coord.Lat(), 'f', 6) + " " + QString::number(coord.Lng(), 'f', 6); - setToolTip(QString("WayPoint Number:%1\nDescription:%2\nCoordinate:%4\nAltitude:%5").arg(QString::number(WayPointItem::number)).arg(description).arg(coord_str).arg(QString::number(altitude))); - } - - int WayPointItem::snumber=0; -} diff --git a/lib/opmapcontrol/src/mapwidget/waypointitem.h b/lib/opmapcontrol/src/mapwidget/waypointitem.h deleted file mode 100644 index b9bee5ce53a14d4fde0e6dc8e0a4638e1f0a9ed8..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/mapwidget/waypointitem.h +++ /dev/null @@ -1,210 +0,0 @@ -/** -****************************************************************************** -* -* @file waypointitem.h -* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -* @brief A graphicsItem representing a WayPoint -* @see The GNU Public License (GPL) Version 3 -* @defgroup OPMapWidget -* @{ -* -*****************************************************************************/ -/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program 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 General Public License -* for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef WAYPOINTITEM_H -#define WAYPOINTITEM_H - -#include -#include -#include -#include "../internals/pointlatlng.h" -#include "mapgraphicitem.h" -#include -namespace mapcontrol -{ -/** -* @brief A QGraphicsItem representing a WayPoint -* -* @class WayPointItem waypointitem.h "waypointitem.h" -*/ -class WayPointItem:public QObject,public QGraphicsItem -{ - Q_OBJECT - Q_INTERFACES(QGraphicsItem) -public: - enum { Type = UserType + 1 }; - /** - * @brief Constructer - * - * @param coord coordinates in LatLng of the Waypoint - * @param altitude altitude of the WayPoint - * @param map pointer to map to use - * @return - */ - WayPointItem(internals::PointLatLng const& coord,int const& altitude,MapGraphicItem* map); - /** - * @brief Constructer - * - * @param coord coordinates in LatLng of the WayPoint - * @param altitude altitude of the WayPoint - * @param description description fo the WayPoint - * @param map pointer to map to use - * @return - */ - WayPointItem(internals::PointLatLng const& coord,int const& altitude,QString const& description,MapGraphicItem* map); - /** - * @brief Returns the WayPoint description - * - * @return QString - */ - QString Description(){return description;} - /** - * @brief Sets the WayPoint description - * - * @param value - */ - void SetDescription(QString const& value); - /** - * @brief Returns true if WayPoint is Reached - * - * @return bool - */ - bool Reached(){return reached;} - /** - * @brief Sets if WayPoint is Reached - * - * @param value - */ - void SetReached(bool const& value); - /** - * @brief Returns the WayPoint number - * - */ - int Number(){return number;} - /** - * @brief Sets WayPoint number - * - * @param value - */ - void SetNumber(int const& value); - /** - * @brief Returns WayPoint LatLng coordinate - * - */ - internals::PointLatLng Coord(){return coord;} - /** - * @brief Sets WayPoint LatLng coordinate - * - * @param value - */ - void SetCoord(internals::PointLatLng const& value); - /** - * @brief Used if WayPoint number is to be drawn on screen - * - */ - bool ShowNumber(){return shownumber;} - /** - * @brief Used to set if WayPoint number is to be drawn on screen - * - * @param value - */ - void SetShowNumber(bool const& value); - /** - * @brief Returns the WayPoint altitude - * - * @return int - */ - int Altitude(){return altitude;} - /** - * @brief Sets the WayPoint Altitude - * - * @param value - */ - void SetAltitude(int const& value); - int type() const; - QRectF boundingRect() const; - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); - void RefreshPos(); - void RefreshToolTip(); - QPixmap picture; -~WayPointItem(); - - static int snumber; -protected: - void mouseMoveEvent ( QGraphicsSceneMouseEvent * event ); - void mousePressEvent ( QGraphicsSceneMouseEvent * event ); - void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - - -private: - internals::PointLatLng coord;//coordinates of this WayPoint - bool reached; - QString description; - bool shownumber; - bool isDragging; - int altitude; - MapGraphicItem* map; - int number; - - - QGraphicsSimpleTextItem* text; - QGraphicsRectItem* textBG; - QGraphicsSimpleTextItem* numberI; - QGraphicsRectItem* numberIBG; - QTransform transf; - -public slots: - /** - * @brief Called when a WayPoint is deleted - * - * @param number number of the WayPoint that was deleted - */ - void WPDeleted(int const& number); - /** - * @brief Called when a WayPoint is renumbered - * - * @param oldnumber the old WayPoint number - * @param newnumber the new WayPoint number - * @param waypoint a pointer to the WayPoint renumbered - */ - void WPRenumbered(int const& oldnumber,int const& newnumber,WayPointItem* waypoint); - /** - * @brief Called when a WayPoint is inserted - * - * @param number the number of the WayPoint - * @param waypoint a pointer to the WayPoint inserted - */ - void WPInserted(int const& number,WayPointItem* waypoint); -signals: - /** - * @brief fires when this WayPoint number changes (not fired if due to a auto-renumbering) - * - * @param oldnumber this WayPoint old number - * @param newnumber this WayPoint new number - * @param waypoint a pointer to this WayPoint - */ - void WPNumberChanged(int const& oldnumber,int const& newnumber,WayPointItem* waypoint); - /** - * @brief Fired when the description, altitude or coordinates change - * - * @param waypoint a pointer to this WayPoint - */ - void WPValuesChanged(WayPointItem* waypoint); - -}; -} -#endif // WAYPOINTITEM_H diff --git a/lib/opmapcontrol/src/src.pro b/lib/opmapcontrol/src/src.pro deleted file mode 100644 index b676d74dc2b5f8e4966518a142f14f48a2fc1790..0000000000000000000000000000000000000000 --- a/lib/opmapcontrol/src/src.pro +++ /dev/null @@ -1,6 +0,0 @@ -TEMPLATE = subdirs -CONFIG += ordered -SUBDIRS = core -SUBDIRS += internals -SUBDIRS += mapwidget -#SUBDIRS +=finaltest diff --git a/qgroundcontrol.pri b/qgroundcontrol.pri index 35789238296a666aeef1b4846671184cce192439..d0c54457b8afd62260ff665016ef73a8da4ac9d6 100644 --- a/qgroundcontrol.pri +++ b/qgroundcontrol.pri @@ -1,15 +1,10 @@ -#------------------------------------------------- -# +# ------------------------------------------------- # QGroundControl - Micro Air Vehicle Groundstation -# # Please see our website at -# -# Author: -# Lorenz Meier -# -# (c) 2009-2010 PIXHAWK Team -# -# This file is part of the mav groundstation project +# Maintainer: +# Lorenz Meier +# (c) 2009-2011 QGroundControl Developers +# This file is part of the open groundstation project # QGroundControl is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -20,30 +15,27 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with QGroundControl. If not, see . -# -#------------------------------------------------- - - -#$$BASEDIR/lib/qextserialport/include -# $$BASEDIR/lib/openjaus/libjaus/include \ -# $$BASEDIR/lib/openjaus/libopenJaus/include +# ------------------------------------------------- message(Qt version $$[QT_VERSION]) -message(Using Qt from $$[QTDIR]) +message(Using Qt from $(QTDIR)) + +QT_DIR = $$(QTDIR) release { # DEFINES += QT_NO_DEBUG_OUTPUT # DEFINES += QT_NO_WARNING_OUTPUT } -QMAKE_POST_LINK += echo "Copying files" +win32-msvc2008|win32-msvc2010 { + QMAKE_POST_LINK += $$quote(echo "Copying files"$$escape_expand(\\n)) +} else { + QMAKE_POST_LINK += $$quote(echo "Copying files") +} # Turn off serial port warnings DEFINES += _TTY_NOWARN_ -#QMAKE_POST_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/debug/. -#QMAKE_POST_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/release/. - # MAC OS X macx { @@ -181,8 +173,6 @@ message("Compiling for linux 32") INCLUDEPATH += /usr/include \ /usr/local/include \ /usr/include/qt4/phonon - # $$BASEDIR/lib/flite/include \ - # $$BASEDIR/lib/flite/lang message(Building for GNU/Linux 32bit/i386) @@ -256,8 +246,6 @@ linux-g++-64 { INCLUDEPATH += /usr/include \ /usr/include/qt4/phonon - # $$BASEDIR/lib/flite/include \ - # $$BASEDIR/lib/flite/lang # 64-bit Linux @@ -316,9 +304,14 @@ linux-g++-64 { } # Windows (32bit) -win32-msvc2008 { +win32-msvc2008|win32-msvc2010 { + win32-msvc2008 { message(Building for Windows Visual Studio 2008 (32bit)) + } + win32-msvc2010 { + message(Building for Windows Visual Studio 2010 (32bit)) + } # QAxContainer support is needed for the Internet Control # element showing the Google Earth window @@ -353,7 +346,7 @@ exists($$BASEDIR/lib/osg123) { message("Building support for OSG") DEPENDENCIES_PRESENT += osg -# Include OpenSceneGraph and osgEarth libraries +# Include OpenSceneGraph INCLUDEPATH += $$BASEDIR/lib/osgEarth/win32/include \ $$BASEDIR/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/include LIBS += -L$$BASEDIR/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/lib \ @@ -364,14 +357,6 @@ LIBS += -L$$BASEDIR/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/lib \ -losgText \ -lOpenThreads DEFINES += QGC_OSG_ENABLED -exists($$BASEDIR/lib/osgEarth123) { - DEPENDENCIES_PRESENT += osgearth - message("Building support for osgEarth") - DEFINES += QGC_OSGEARTH_ENABLED - LIBS += -L$$BASEDIR/lib/osgEarth/win32/lib \ - -losgEarth \ - -losgEarthUtil -} } RC_FILE = $$BASEDIR/qgroundcontrol.rc @@ -379,21 +364,47 @@ exists($$BASEDIR/lib/osgEarth123) { # Copy dependencies BASEDIR_WIN = $$replace(BASEDIR,"/","\\") TARGETDIR_WIN = $$replace(TARGETDIR,"/","\\") + QTDIR_WIN = $(QTDIR) exists($$TARGETDIR/debug) { - QMAKE_POST_LINK += && copy /Y \"$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll\" \"$$TARGETDIR_WIN\\debug\\SDL.dll\" - QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\audio\" \"$$TARGETDIR_WIN\\debug\\audio\\\" /S /E /Y - QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\models\" \"$$TARGETDIR_WIN\\debug\\models\\\" /S /E /Y - QMAKE_POST_LINK += && copy /Y \"$$BASEDIR_WIN\\images\\earth.html\" \"$$TARGETDIR_WIN\\debug\\earth.html\" + QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\audio" "$$TARGETDIR_WIN\\debug\\audio" /E /I $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\models" "$$TARGETDIR_WIN\\debug\\models" /E /I $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\images\\earth.html" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /Y "$$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\debug" /E /I /EXCLUDE:copydebug.txt $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\phonond4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtCored4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtGuid4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtMultimediad4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtNetworkd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtOpenGLd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtSqld4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtSvgd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtWebKitd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtXmld4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtXmlPatternsd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) } exists($$TARGETDIR/release) { - QMAKE_POST_LINK += && copy /Y \"$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll\" \"$$TARGETDIR_WIN\\release\\SDL.dll\" - QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\audio\" \"$$TARGETDIR_WIN\\release\\audio\\\" /S /E /Y - QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\models\" \"$$TARGETDIR_WIN\\release\\models\\\" /S /E /Y - QMAKE_POST_LINK += && copy /Y \"$$BASEDIR_WIN\\images\\earth.html\" \"$$TARGETDIR_WIN\\release\\earth.html\" + QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\audio" "$$TARGETDIR_WIN\\release\\audio" /E /I $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\models" "$$TARGETDIR_WIN\\release\\models" /E /I $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\images\\earth.html" "$$TARGETDIR_WIN\\release\\earth.html" $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(xcopy /Y "$$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\release" /E /I /EXCLUDE:copyrelease.txt $$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\phonon4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtCore4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtGui4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtMultimedia4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtNetwork4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtOpenGL4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtSql4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtSvg4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtWebKit4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtXml4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(copy /Y "$$(QTDIR)\\bin\\QtXmlPatterns4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qgroundcontrol.exp"$$escape_expand(\\n)) + QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qgroundcontrol.lib"$$escape_expand(\\n)) } - } # Windows (32bit) @@ -405,6 +416,10 @@ win32-g++ { CONFIG += CONSOLE OUTPUT += CONSOLE + # The EIGEN library needs this define + # to make the internal min/max functions work + DEFINES += NOMINMAX + INCLUDEPATH += $$BASEDIR/lib/sdl/include \ $$BASEDIR/lib/opal/include #\ #\ #"C:\Program Files\Microsoft SDKs\Windows\v7.0\Include" diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 36cecff242b55889dbd6657945a3b17d0acfb5e2..7b645d1b799eccaea1e8c28660aec34092e66e9a 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -16,62 +16,9 @@ # You should have received a copy of the GNU General Public License # along with QGroundControl. If not, see . # ------------------------------------------------- -# Include QMapControl map library -# prefer version from external directory / -# from http://github.com/pixhawk/qmapcontrol/ -# over bundled version in lib directory -# Version from GIT repository is preferred -# include ( "../qmapcontrol/QMapControl/QMapControl.pri" ) #{ -# Include bundled version if necessary -# include(lib/QMapControl/QMapControl.pri) -include(src/libs/nmea/nmea.pri) - -# EIGEN matrix library (header-only) -INCLUDEPATH += src/libs/eigen - -# This is a HACK - linking to openpilot repo for now -# OPMapControl is a OpenPilot-independent map library -# provided by the OpenPilot team - thanks, great piece -# of open-source software! -# (We're not reusing any part of the OP GCS, just the map library) - - -# Try to get it from OP mainline, if this fails fall back to internal copies -exists(../openpilot-xxxxxxx/ground/openpilotgcs/src/libs) { -include(../openpilot/ground/openpilotgcs/src/libs/utils/utils_external.pri) -include(../openpilot/ground/openpilotgcs/src/libs/opmapcontrol/opmapcontrol_external.pri) -DEPENDPATH += \ - ../openpilot/ground/openpilotgcs/src/libs/utils \ - ../openpilot/ground/openpilotgcs/src/libs/utils/src \ - ../openpilot/ground/openpilotgcs/src/libs/opmapcontrol \ - ../openpilot/ground/openpilotgcs/src/libs/opmapcontrol/src -INCLUDEPATH += \ - ../openpilot/ground/openpilotgcs/src/libs/utils \ - ../openpilot/ground/openpilotgcs/src/libs \ - ../openpilot/ground/openpilotgcs/src/libs/opmapcontrol - message("----- USING MAINLINE OPENPILOT FROM ../openpilot -----") - message("Using OpenPilot's mapcontrol library from external folder") - message("------------------------------------------------------------------------") -} else { -include(src/libs/utils/utils_external.pri) -include(src/libs/opmapcontrol/opmapcontrol_external.pri) -DEPENDPATH += \ - src/libs/utils \ - src/libs/utils/src \ - src/libs/opmapcontrol \ - src/libs/opmapcontrol/src \ - src/libs/opmapcontrol/src/mapwidget - -INCLUDEPATH += \ - src/libs/utils \ - src/libs \ - src/libs/opmapcontrol -} - -# include(lib/opmapcontrol/opmapcontrol.pri) -# message("Including bundled QMapControl version as FALLBACK. This is fine on Linux and MacOS, but not the best choice in Windows") +# Qt configuration QT += network \ opengl \ svg \ @@ -79,6 +26,7 @@ QT += network \ phonon \ webkit \ sql + TEMPLATE = app TARGET = qgroundcontrol BASEDIR = $$IN_PWD @@ -88,8 +36,34 @@ LANGUAGE = C++ OBJECTS_DIR = $$BUILDDIR/obj MOC_DIR = $$BUILDDIR/moc UI_HEADERS_DIR = $$BUILDDIR/ui +RCC_DIR = $$BUILDDIR/rcc MAVLINK_CONF = "" + +################################################################# +# EXTERNAL LIBRARY CONFIGURATION + +# Include NMEA parsing library (currently unused) +include(src/libs/nmea/nmea.pri) + +# EIGEN matrix library (header-only) +INCLUDEPATH += src/libs/eigen + +# OPMapControl library (from OpenPilot) +include(src/libs/utils/utils_external.pri) +include(src/libs/opmapcontrol/opmapcontrol_external.pri) +DEPENDPATH += \ + src/libs/utils \ + src/libs/utils/src \ + src/libs/opmapcontrol \ + src/libs/opmapcontrol/src \ + src/libs/opmapcontrol/src/mapwidget + +INCLUDEPATH += \ + src/libs/utils \ + src/libs \ + src/libs/opmapcontrol + # If the user config file exists, it will be included. # if the variable MAVLINK_CONF contains the name of an # additional project, QGroundControl includes the support @@ -145,14 +119,12 @@ contains(MAVLINK_CONF, ardupilotmega) { DEFINES += QGC_USE_ARDUPILOTMEGA_MESSAGES } -# } + # Include general settings for QGroundControl # necessary as last include to override any non-acceptable settings # done by the plugins above include(qgroundcontrol.pri) - - # Include MAVLink generator DEPENDPATH += \ src/apps/mavlinkgen @@ -181,19 +153,14 @@ INCLUDEPATH += . \ thirdParty/qserialport/src \ src/libs/qextserialport -# Include serial port library -# include(src/lib/qextserialport/qextserialport.pri) -# include qserial library +# Include serial port library (QSerial) include(thirdParty/qserialport/qgroundcontrol-qserialport.pri) -# Serial port detection +# Serial port detection (ripped-off from qextserialport library) macx::SOURCES += src/libs/qextserialport/qextserialenumerator_osx.cpp linux-g++::SOURCES += src/libs/qextserialport/qextserialenumerator_unix.cpp win32::SOURCES += src/libs/qextserialport/qextserialenumerator_win.cpp -# ../mavlink/include \ -# MAVLink/include \ -# mavlink/include # Input FORMS += src/ui/MainWindow.ui \ src/ui/CommSettings.ui \ @@ -352,10 +319,11 @@ HEADERS += src/MG.h \ src/ui/map/QGCMapTool.h \ src/ui/map/QGCMapToolBar.h \ src/libs/qextserialport/qextserialenumerator.h \ - src/QGCGeo.h + src/QGCGeo.h \ + src/ui/QGCToolBar.h # Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler -macx|win32-msvc2008::HEADERS += src/ui/map3D/QGCGoogleEarthView.h +macx|win32-msvc2008|win32-msvc2010::HEADERS += src/ui/map3D/QGCGoogleEarthView.h contains(DEPENDENCIES_PRESENT, osg) { message("Including headers for OpenSceneGraph") @@ -475,8 +443,13 @@ SOURCES += src/main.cc \ src/ui/map/MAV2DIcon.cc \ src/ui/map/Waypoint2DIcon.cc \ src/ui/map/QGCMapTool.cc \ - src/ui/map/QGCMapToolBar.cc -macx|win32-msvc2008::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc + src/ui/map/QGCMapToolBar.cc \ + src/ui/QGCToolBar.cc + +# Enable Google Earth only on Mac OS and Windows with Visual Studio compiler +macx|win32-msvc2008|win32-msvc2010::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc + +# Enable OSG only if it has been found contains(DEPENDENCIES_PRESENT, osg) { message("Including sources for OpenSceneGraph") @@ -508,7 +481,9 @@ contains(DEPENDENCIES_PRESENT, libfreenect) { # Enable only if libfreenect is available SOURCES += src/input/Freenect.cc } -RESOURCES += mavground.qrc + +# Add icons and other resources +RESOURCES += qgroundcontrol.qrc # Include RT-LAB Library win32:exists(src/lib/opalrt/OpalApi.h):exists(C:/OPAL-RT/RT-LAB7.2.4/Common/bin) { diff --git a/mavground.qrc b/qgroundcontrol.qrc similarity index 100% rename from mavground.qrc rename to qgroundcontrol.qrc diff --git a/src/Waypoint.cc b/src/Waypoint.cc index 48efb6978ecfb47a87311749a190f3f680a60f00..2fd5a7099fd5c1ff1c793d72c90c712fbdeba3e6 100644 --- a/src/Waypoint.cc +++ b/src/Waypoint.cc @@ -221,8 +221,8 @@ void Waypoint::setAcceptanceRadius(double radius) void Waypoint::setParam1(double param1) { - qDebug() << "SENDER:" << QObject::sender(); - qDebug() << "PARAM1 SET REQ:" << param1; + //qDebug() << "SENDER:" << QObject::sender(); + //qDebug() << "PARAM1 SET REQ:" << param1; if (this->param1 != param1) { this->param1 = param1; emit changed(this); diff --git a/src/apps/mavlinkgen/generator/MAVLinkXMLParser.cc b/src/apps/mavlinkgen/generator/MAVLinkXMLParser.cc index da23a1f60e22d00c4b9a45bb96a83fc998d74cef..34cc9ec9bc067a77e76d3099a8e3ba57e0e8fff5 100644 --- a/src/apps/mavlinkgen/generator/MAVLinkXMLParser.cc +++ b/src/apps/mavlinkgen/generator/MAVLinkXMLParser.cc @@ -276,8 +276,8 @@ bool MAVLinkXMLParser::generate() else if (pp2.isElement()) { fieldComment += pp2.text() + sep; - pp = pp.nextSibling(); } + pp = pp.nextSibling(); } fieldComment = fieldComment.replace("\n", " "); fieldComment = " /* " + fieldComment.simplified() + " */"; diff --git a/src/comm/SerialLink.cc b/src/comm/SerialLink.cc index db53054b0f93050a3b2feaca312adbde15422b63..952f2f217640c6f7f26fa3ec7504e40bc532718b 100644 --- a/src/comm/SerialLink.cc +++ b/src/comm/SerialLink.cc @@ -300,7 +300,7 @@ bool SerialLink::hardwareConnect() emit connected(true); } - qDebug() << "CONNECTING LINK: " << __FILE__ << __LINE__ << "with settings" << port->portName() << getBaudRate() << getDataBits() << getParityType() << getStopBits(); + //qDebug() << "CONNECTING LINK: " << __FILE__ << __LINE__ << "with settings" << port->portName() << getBaudRate() << getDataBits() << getParityType() << getStopBits(); writeSettings(); @@ -627,7 +627,7 @@ bool SerialLink::setBaudRateString(const QString& rate) bool SerialLink::setBaudRate(int rate) { - qDebug() << "BAUD RATE:" << rate; + //qDebug() << "BAUD RATE:" << rate; bool reconnect = false; bool accepted = true; // This is changed if none of the data rates matches @@ -796,7 +796,7 @@ bool SerialLink::setParityType(int parity) bool SerialLink::setDataBits(int dataBits) { - qDebug() << "Setting" << dataBits << "data bits"; + //qDebug() << "Setting" << dataBits << "data bits"; bool reconnect = false; if (isConnected()) reconnect = true; bool accepted = true; diff --git a/src/comm/UDPLink.cc b/src/comm/UDPLink.cc index ce53ad0f6509dc68c3147ed4edbeb88f18760a52..5147379bd98092e9cd3ed7b42e66fe2d80f608d2 100644 --- a/src/comm/UDPLink.cc +++ b/src/comm/UDPLink.cc @@ -2,7 +2,7 @@ QGroundControl Open Source Ground Control Station -(c) 2009, 2010 QGROUNDCONTROL PROJECT +(c) 2009 - 2011 QGROUNDCONTROL PROJECT This file is part of the QGROUNDCONTROL project @@ -85,9 +85,9 @@ void UDPLink::setPort(int port) */ void UDPLink::addHost(const QString& host) { - qDebug() << "UDP:" << "ADDING HOST:" << host; + //qDebug() << "UDP:" << "ADDING HOST:" << host; if (host.contains(":")) { - qDebug() << "HOST: " << host.split(":").first(); + //qDebug() << "HOST: " << host.split(":").first(); QHostInfo info = QHostInfo::fromName(host.split(":").first()); if (info.error() == QHostInfo::NoError) { @@ -103,7 +103,7 @@ void UDPLink::addHost(const QString& host) } } hosts.append(address); - qDebug() << "Address:" << address.toString(); + //qDebug() << "Address:" << address.toString(); // Set port according to user input ports.append(host.split(":").last().toInt()); } diff --git a/src/input/JoystickInput.cc b/src/input/JoystickInput.cc index d5bdb55efe59e1cbceaeaa8681fca8f017ef738d..805f9a5d6534c3ffd4ee0575ca45ce20d0f84f17 100644 --- a/src/input/JoystickInput.cc +++ b/src/input/JoystickInput.cc @@ -143,7 +143,7 @@ void JoystickInput::run() switch(event.type) { case SDL_KEYDOWN: /* handle keyboard stuff here */ - qDebug() << "KEY PRESSED!"; + //qDebug() << "KEY PRESSED!"; break; case SDL_QUIT: @@ -153,7 +153,7 @@ void JoystickInput::run() case SDL_JOYBUTTONDOWN: /* Handle Joystick Button Presses */ if ( event.jbutton.button == 0 ) { - qDebug() << "BUTTON PRESSED!"; + //qDebug() << "BUTTON PRESSED!"; } break; @@ -170,7 +170,7 @@ void JoystickInput::run() break; default: - qDebug() << "SDL event occured"; + //qDebug() << "SDL event occured"; break; } } diff --git a/src/libs/opmapcontrol/src/core/tilecachequeue.cpp b/src/libs/opmapcontrol/src/core/tilecachequeue.cpp index 166e66a2911963a0b2848b0639c9255dc8019baf..db8e4d4b96230c352ad9c924f902081f826807b3 100644 --- a/src/libs/opmapcontrol/src/core/tilecachequeue.cpp +++ b/src/libs/opmapcontrol/src/core/tilecachequeue.cpp @@ -98,7 +98,9 @@ void TileCacheQueue::run() else { + #ifdef DEBUG_TILECACHEQUEUE qDebug()<<"Cache engine BEGIN WAIT"; + #endif //DEBUG_TILECACHEQUEUE waitmutex.lock(); int tout=4000; if(!waitc.wait(&waitmutex,tout)) @@ -115,7 +117,9 @@ void TileCacheQueue::run() } mutex.unlock(); } + #ifdef DEBUG_TILECACHEQUEUE qDebug()<<"Cache Engine DID NOT TimeOut"; + #endif //DEBUG_TILECACHEQUEUE waitmutex.unlock(); } } diff --git a/src/libs/opmapcontrol/src/mapwidget/waypointitem.cpp b/src/libs/opmapcontrol/src/mapwidget/waypointitem.cpp index 216a904194a68d0c2e13f418adb7610635d5331a..f2fcac0fe539c7bc9563240b213ae32516a3b02d 100644 --- a/src/libs/opmapcontrol/src/mapwidget/waypointitem.cpp +++ b/src/libs/opmapcontrol/src/mapwidget/waypointitem.cpp @@ -113,7 +113,7 @@ namespace mapcontrol delete textBG; coord=map->FromLocalToLatLng(this->pos().x(),this->pos().y()); QString coord_str = " " + QString::number(coord.Lat(), 'f', 6) + " " + QString::number(coord.Lng(), 'f', 6); - qDebug() << "WP MOVE:" << coord_str << __FILE__ << __LINE__; + // qDebug() << "WP MOVE:" << coord_str << __FILE__ << __LINE__; isDragging=false; RefreshToolTip(); @@ -129,7 +129,7 @@ namespace mapcontrol coord=map->FromLocalToLatLng(this->pos().x(),this->pos().y()); QString coord_str = " " + QString::number(coord.Lat(), 'f', 6) + " " + QString::number(coord.Lng(), 'f', 6); text->setText(coord_str); - qDebug() << "WP DRAG:" << coord_str << __FILE__ << __LINE__; + // qDebug() << "WP DRAG:" << coord_str << __FILE__ << __LINE__; textBG->setRect(text->boundingRect()); emit WPValuesChanged(this); diff --git a/src/libs/qextserialport/qextserialenumerator_win.cpp b/src/libs/qextserialport/qextserialenumerator_win.cpp index 07d348f191361fead754fdeedf8dfc974fe1153b..1f205acc36a162b63b267fd5154e83b0e9f968cc 100644 --- a/src/libs/qextserialport/qextserialenumerator_win.cpp +++ b/src/libs/qextserialport/qextserialenumerator_win.cpp @@ -9,6 +9,13 @@ #include //#include "qextserialport.h" #include +#ifdef Q_OS_WIN +#ifndef _MSC_VER +#include +#include +#include +#endif +#endif QextSerialEnumerator::QextSerialEnumerator( ) { @@ -193,12 +200,12 @@ bool QextSerialEnumerator::getDeviceDetailsWin( QextPortInfo* portInfo, HDEVINFO QString hardwareIDs = getDeviceProperty(devInfo, devData, SPDRP_HARDWAREID); HKEY devKey = SetupDiOpenDevRegKey(devInfo, devData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ); - QRegExp rx("^COM(\\d+)"); - QString fullName(getRegKeyValue(devKey, TEXT("PortName"))); - if(fullName.contains(rx)) { - int portnum = rx.cap(1).toInt(); - if(portnum > 9) // COM ports greater than 9 need \\.\ prepended - fullName.prepend("\\\\.\\"); + QRegExp rx("^COM(\\d+)"); + QString fullName(getRegKeyValue(devKey, TEXT("PortName"))); + if(fullName.contains(rx)) { + int portnum = rx.cap(1).toInt(); + if(portnum > 9) // COM ports greater than 9 need \\.\ prepended + fullName.prepend("\\\\.\\"); } portInfo->portName = fullName; diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 13b9349297c198c4f172884366b0dbad26b83499..e62fc127a0b282962946ad4d6a769c163062815f 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -242,6 +242,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) emit statusChanged(this, uasState, stateDescription); emit statusChanged(this->status); + shortStateText = uasState; + stateAudio = " changed status to " + uasState; } @@ -311,6 +313,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) break; } + shortModeText = mode; + emit modeChanged(this->getUASID(), mode, ""); //qDebug() << "2 SYSTEM MODE:" << mode; @@ -2106,6 +2110,16 @@ QString UAS::getUASName(void) const return result; } +const QString& UAS::getShortState() const +{ + return shortStateText; +} + +const QString& UAS::getShortMode() const +{ + return shortModeText; +} + void UAS::addLink(LinkInterface* link) { if (!links->contains(link)) { diff --git a/src/uas/UAS.h b/src/uas/UAS.h index 78a8377c2b22681efda2d483f3f0f5eb4046b875..d958cb66aca8d293a1cf84400b5e6815d50bdd93 100644 --- a/src/uas/UAS.h +++ b/src/uas/UAS.h @@ -68,6 +68,10 @@ public: /** @brief The name of the robot */ QString getUASName(void) const; + /** @brief Get short state */ + const QString& getShortState() const; + /** @brief Get short mode */ + const QString& getShortMode() const; /** @brief Get the unique system id */ int getUASID() const; /** @brief Get the airframe */ @@ -198,6 +202,8 @@ protected: //COMMENTS FOR TEST UNIT int airframe; ///< The airframe type bool attitudeKnown; ///< True if attitude was received, false else QGCUASParamManager* paramManager; ///< Parameter manager class + QString shortStateText; ///< Short textual state description + QString shortModeText; ///< Short textual mode description public: /** @brief Set the current battery type */ diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h index 2c31401fe39bff57f0a409fddd2edada9ca611da..56ac5383fd5454002e0ef09fad35c2f09fef320b 100644 --- a/src/uas/UASInterface.h +++ b/src/uas/UASInterface.h @@ -60,6 +60,10 @@ public: /** @brief The name of the robot **/ virtual QString getUASName() const = 0; + /** @brief Get short state */ + virtual const QString& getShortState() const = 0; + /** @brief Get short mode */ + virtual const QString& getShortMode() const = 0; //virtual QColor getColor() = 0; virtual int getUASID() const = 0; ///< Get the ID of the connected UAS /** @brief The time interval the robot is switched on **/ diff --git a/src/uas/UASManager.h b/src/uas/UASManager.h index 85fc4217ac34d83f0119ced477aef4cb51e41a09..a421b2199568aa9814ab4a2eba28f6f83c8064d7 100644 --- a/src/uas/UASManager.h +++ b/src/uas/UASManager.h @@ -2,7 +2,7 @@ QGroundControl Open Source Ground Control Station -(c) 2009, 2010 QGROUNDCONTROL PROJECT +(c) 2009 - 2011 QGROUNDCONTROL PROJECT This file is part of the QGROUNDCONTROL project @@ -224,7 +224,12 @@ signals: void activeUASStatusChanged(int systemId, bool active); /** @brief Current home position changed */ void homePositionChanged(double lat, double lon, double alt); - +public: + /* Need to align struct pointer to prevent a memory assertion: + * See http://eigen.tuxfamily.org/dox-devel/TopicUnalignedArrayAssert.html + * for details + */ + EIGEN_MAKE_ALIGNED_OPERATOR_NEW }; #endif // _UASMANAGER_H_ diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index 3485f60718ab110148c228ce7eb6f64e7d735d01..c541cb3f93ce034a3e63adb60a508a386bbcd5ab 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -57,7 +57,7 @@ void UASWaypointManager::timeout() protocol_timer.start(PROTOCOL_TIMEOUT_MS); current_retries--; emit updateStatusString(tr("Timeout, retrying (retries left: %1)").arg(current_retries)); - qDebug() << "Timeout, retrying (retries left:" << current_retries << ")"; + // qDebug() << "Timeout, retrying (retries left:" << current_retries << ")"; if (current_state == WP_GETLIST) { sendWaypointRequestList(); } else if (current_state == WP_GETLIST_GETWPS) { @@ -74,7 +74,7 @@ void UASWaypointManager::timeout() } else { protocol_timer.stop(); - qDebug() << "Waypoint transaction (state=" << current_state << ") timed out going to state WP_IDLE"; + // qDebug() << "Waypoint transaction (state=" << current_state << ") timed out going to state WP_IDLE"; emit updateStatusString("Operation timed out."); @@ -92,7 +92,7 @@ void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, qui protocol_timer.start(PROTOCOL_TIMEOUT_MS); current_retries = PROTOCOL_MAX_RETRIES; - qDebug() << "got waypoint count (" << count << ") from ID " << systemId; + // qDebug() << "got waypoint count (" << count << ") from ID " << systemId; if (count > 0) { current_count = count; @@ -103,7 +103,7 @@ void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, qui } else { protocol_timer.stop(); emit updateStatusString("done."); - qDebug() << "No waypoints on UAS " << systemId; + // qDebug() << "No waypoints on UAS " << systemId; current_state = WP_IDLE; current_count = 0; current_wp_id = 0; @@ -122,7 +122,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ current_retries = PROTOCOL_MAX_RETRIES; if(wp->seq == current_wp_id) { - //qDebug() << "Got WP: " << wp->seq << wp->x << wp->y << wp->z << wp->param4 << "auto:" << wp->autocontinue << "curr:" << wp->current << wp->param1 << wp->param2 << "Frame:"<< (MAV_FRAME) wp->frame << "Command:" << (MAV_CMD) wp->command; + //// qDebug() << "Got WP: " << wp->seq << wp->x << wp->y << wp->z << wp->param4 << "auto:" << wp->autocontinue << "curr:" << wp->current << wp->param1 << wp->param2 << "Frame:"<< (MAV_FRAME) wp->frame << "Command:" << (MAV_CMD) wp->command; Waypoint *lwp = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->param1, wp->param2, wp->param3, wp->param4, wp->autocontinue, wp->current, (MAV_FRAME) wp->frame, (MAV_CMD) wp->command); addWaypoint(lwp, false); @@ -145,7 +145,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ emit readGlobalWPFromUAS(false); emit updateStatusString("done."); - qDebug() << "got all waypoints from ID " << systemId; + // qDebug() << "got all waypoints from ID " << systemId; } } else { emit updateStatusString(tr("Waypoint ID mismatch, rejecting waypoint")); @@ -163,12 +163,12 @@ void UASWaypointManager::handleWaypointAck(quint8 systemId, quint8 compId, mavli protocol_timer.stop(); current_state = WP_IDLE; emit updateStatusString("done."); - qDebug() << "sent all waypoints to ID " << systemId; + // qDebug() << "sent all waypoints to ID " << systemId; } else if(current_state == WP_CLEARLIST) { protocol_timer.stop(); current_state = WP_IDLE; emit updateStatusString("done."); - qDebug() << "cleared waypoint list of ID " << systemId; + // qDebug() << "cleared waypoint list of ID " << systemId; } } } @@ -217,18 +217,18 @@ void UASWaypointManager::handleWaypointCurrent(quint8 systemId, quint8 compId, m } } - //qDebug() << "Updated waypoints list"; + //// qDebug() << "Updated waypoints list"; } emit updateStatusString(QString("New current waypoint %1").arg(wpc->seq)); //emit update to UI widgets emit currentWaypointChanged(wpc->seq); - //qDebug() << "new current waypoint" << wpc->seq; + //// qDebug() << "new current waypoint" << wpc->seq; } } void UASWaypointManager::notifyOfChange(Waypoint* wp) { - qDebug() << "WAYPOINT CHANGED: ID:" << wp->getId(); + // qDebug() << "WAYPOINT CHANGED: ID:" << wp->getId(); // If only one waypoint was changed, emit only WP signal if (wp != NULL) { emit waypointChanged(uas.getUASID(), wp); @@ -713,7 +713,7 @@ void UASWaypointManager::writeWaypoints() sendWaypointClearAll(); } else { //we're in another transaction, ignore command - qDebug() << "UASWaypointManager::sendWaypoints() doing something else ignoring command"; + // qDebug() << "UASWaypointManager::sendWaypoints() doing something else ignoring command"; } } @@ -731,7 +731,7 @@ void UASWaypointManager::sendWaypointClearAll() uas.sendMessage(message); MG::SLEEP::usleep(PROTOCOL_DELAY_MS * 1000); - qDebug() << "sent waypoint clear all to ID " << wpca.target_system; + // qDebug() << "sent waypoint clear all to ID " << wpca.target_system; } void UASWaypointManager::sendWaypointSetCurrent(quint16 seq) @@ -749,7 +749,7 @@ void UASWaypointManager::sendWaypointSetCurrent(quint16 seq) uas.sendMessage(message); MG::SLEEP::usleep(PROTOCOL_DELAY_MS * 1000); - qDebug() << "sent waypoint set current (" << wpsc.seq << ") to ID " << wpsc.target_system; + // qDebug() << "sent waypoint set current (" << wpsc.seq << ") to ID " << wpsc.target_system; } void UASWaypointManager::sendWaypointCount() @@ -761,14 +761,14 @@ void UASWaypointManager::sendWaypointCount() wpc.target_component = MAV_COMP_ID_WAYPOINTPLANNER; wpc.count = current_count; - qDebug() << "sent waypoint count (" << wpc.count << ") to ID " << wpc.target_system; + // qDebug() << "sent waypoint count (" << wpc.count << ") to ID " << wpc.target_system; emit updateStatusString(QString("Starting to transmit waypoints...")); mavlink_msg_waypoint_count_encode(uas.mavlink->getSystemId(), uas.mavlink->getComponentId(), &message, &wpc); uas.sendMessage(message); MG::SLEEP::usleep(PROTOCOL_DELAY_MS * 1000); - qDebug() << "sent waypoint count (" << wpc.count << ") to ID " << wpc.target_system; + // qDebug() << "sent waypoint count (" << wpc.count << ") to ID " << wpc.target_system; } void UASWaypointManager::sendWaypointRequestList() @@ -785,7 +785,7 @@ void UASWaypointManager::sendWaypointRequestList() uas.sendMessage(message); MG::SLEEP::usleep(PROTOCOL_DELAY_MS * 1000); - qDebug() << "sent waypoint list request to ID " << wprl.target_system; + // qDebug() << "sent waypoint list request to ID " << wprl.target_system; } @@ -805,13 +805,13 @@ void UASWaypointManager::sendWaypointRequest(quint16 seq) uas.sendMessage(message); MG::SLEEP::usleep(PROTOCOL_DELAY_MS * 1000); - qDebug() << "sent waypoint request (" << wpr.seq << ") to ID " << wpr.target_system; + // qDebug() << "sent waypoint request (" << wpr.seq << ") to ID " << wpr.target_system; } void UASWaypointManager::sendWaypoint(quint16 seq) { mavlink_message_t message; - qDebug() <<" WP Buffer count: "<seq).arg(current_count)); - qDebug() << "sent waypoint (" << wp->seq << ") to ID " << wp->target_system<<" WP Buffer count: "<seq << ") to ID " << wp->target_system<<" WP Buffer count: "<getSystemId(), uas.mavlink->getComponentId(), &message, wp); uas.sendMessage(message); @@ -846,5 +846,5 @@ void UASWaypointManager::sendWaypointAck(quint8 type) uas.sendMessage(message); MG::SLEEP::usleep(PROTOCOL_DELAY_MS * 1000); - qDebug() << "sent waypoint ack (" << wpa.type << ") to ID " << wpa.target_system; + // qDebug() << "sent waypoint ack (" << wpa.type << ") to ID " << wpa.target_system; } diff --git a/src/ui/HUD.cc b/src/ui/HUD.cc index e186b0a2dc4e31bb8ef588819e2972672569bba5..d5bf4bf0a8a0392c473fbb8760390556f8ce8708 100644 --- a/src/ui/HUD.cc +++ b/src/ui/HUD.cc @@ -198,7 +198,7 @@ void HUD::showEvent(QShowEvent* event) { // React only to internal (pre-display) // events - Q_UNUSED(event) + QGLWidget::showEvent(event); refreshTimer->start(updateInterval); } @@ -206,7 +206,7 @@ void HUD::hideEvent(QHideEvent* event) { // React only to internal (pre-display) // events - Q_UNUSED(event); + QGLWidget::hideEvent(event); refreshTimer->stop(); } diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 420705b79a68f9b6451333af39c9975456fcc052..1f39e4a270f82bdce497007c098cc9a21cd91032 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -1,4 +1,24 @@ -/*=================================================================== +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +(c) 2009 - 2011 QGROUNDCONTROL PROJECT + +This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + ======================================================================*/ /** @@ -15,7 +35,6 @@ #include #include -#include "MG.h" #include "QGC.h" #include "MAVLinkSimulationLink.h" #include "SerialLink.h" @@ -138,6 +157,14 @@ MainWindow::MainWindow(QWidget *parent): joystickWidget = 0; joystick = new JoystickInput(); + // Load Toolbar + toolBar = new QGCToolBar(this); + this->addToolBar(toolBar); + // Add actions + toolBar->addPerspectiveChangeAction(ui.actionOperatorsView); + toolBar->addPerspectiveChangeAction(ui.actionEngineersView); + toolBar->addPerspectiveChangeAction(ui.actionPilotsView); + // Enable and update view presentView(); diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 1407fe4a33fa632c778423757acd798ed8273e19..6b21e2f43f479cf2c9a083edcb6f278ddb79d972 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -67,7 +67,7 @@ This file is part of the QGROUNDCONTROL project #if (defined Q_OS_MAC) | (defined _MSC_VER) #include "QGCGoogleEarthView.h" #endif -//#include "QMap3DWidget.h" +#include "QGCToolBar.h" #include "SlugsDataSensorView.h" #include "LogCompressor.h" @@ -419,6 +419,8 @@ protected: QPointer slugsHilSimWidget; QPointer slugsCamControlWidget; + QPointer toolBar; + // Popup widgets JoystickWidget* joystickWidget; diff --git a/src/ui/QGCParamWidget.cc b/src/ui/QGCParamWidget.cc index af87c7ed15da2fb4245906579d6a82777b85d69a..c5883b0a998e438e0ceed2d6b2f811346d9ef203 100644 --- a/src/ui/QGCParamWidget.cc +++ b/src/ui/QGCParamWidget.cc @@ -676,7 +676,7 @@ void QGCParamWidget::retransmissionGuardTick() */ void QGCParamWidget::requestParameterUpdate(int component, const QString& parameter) { - + // FIXME - IMPLEMENT THIS! } diff --git a/src/ui/QGCSensorSettingsWidget.cc b/src/ui/QGCSensorSettingsWidget.cc index 6f2e30697d7d1473fd20adc3fcdfe53ae05a0bf9..92307dab2431d9141ae841bced1e08d9cfd5e773 100644 --- a/src/ui/QGCSensorSettingsWidget.cc +++ b/src/ui/QGCSensorSettingsWidget.cc @@ -71,6 +71,9 @@ QGCSensorSettingsWidget::QGCSensorSettingsWidget(UASInterface* uas, QWidget *par connect(ui->magCalButton, SIGNAL(clicked()), mav, SLOT(startMagnetometerCalibration())); connect(ui->pressureCalButton, SIGNAL(clicked()), mav, SLOT(startPressureCalibration())); connect(ui->gyroCalButton, SIGNAL(clicked()), mav, SLOT(startGyroscopeCalibration())); + + // Hide the calibration stuff - done in custom widgets anyway + ui->groupBox_3->hide(); } void QGCSensorSettingsWidget::delayedSendRawSensor(int rate) diff --git a/src/ui/QGCToolBar.cc b/src/ui/QGCToolBar.cc new file mode 100644 index 0000000000000000000000000000000000000000..d07b089fac494e8a19d180fcc2b76336a9f88bef --- /dev/null +++ b/src/ui/QGCToolBar.cc @@ -0,0 +1,161 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +(c) 2009 - 2011 QGROUNDCONTROL PROJECT + +This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + +======================================================================*/ + +#include +#include +#include "QGCToolBar.h" +#include "UASManager.h" + +QGCToolBar::QGCToolBar(QWidget *parent) : + QToolBar(parent), + toggleLoggingAction(NULL), + logReplayAction(NULL), + mav(NULL) +{ + setObjectName("QGC_TOOLBAR"); + createCustomWidgets(); + setActiveUAS(UASManager::instance()->getActiveUAS()); + connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); +} + +void QGCToolBar::addPerspectiveChangeAction(QAction* action) +{ + addAction(action); +} + +void QGCToolBar::setActiveUAS(UASInterface* active) +{ + // Do nothing if system is the same or NULL + if ((active == NULL) || mav == active) return; + + if (mav) + { + // Disconnect old system + disconnect(mav, SIGNAL(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*,QString,QString))); + disconnect(mav, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); + disconnect(mav, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString))); + disconnect(mav, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint))); + } + + // Connect new system + mav = active; + connect(active, SIGNAL(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*, QString,QString))); + connect(active, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); + connect(active, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString))); + connect(active, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint))); + + // Update all values once + nameLabel->setText(mav->getUASName()); + modeLabel->setText(mav->getShortMode()); + stateLabel->setText(mav->getShortState()); + setSystemType(mav, mav->getSystemType()); +} + +void QGCToolBar::createCustomWidgets() +{ + // Add internal actions + // Add MAV widget + symbolButton = new QToolButton(this); + nameLabel = new QLabel("------", this); + modeLabel = new QLabel("------", this); + stateLabel = new QLabel("------", this); + wpLabel = new QLabel("---", this); + distlabel = new QLabel("--- ---- m", this); + //symbolButton->setIcon(":"); + symbolButton->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; } QToolButton { font-weight: bold; font-size: 12px; border: 0px solid #999999; border-radius: 5px; min-width:22px; max-width: 22px; min-height: 22px; max-height: 22px; padding: 0px; margin: 0px; background-color: none; }"); + addWidget(symbolButton); + addWidget(nameLabel); + addWidget(modeLabel); + addWidget(stateLabel); + addWidget(wpLabel); + addWidget(distlabel); + + toggleLoggingAction = new QAction(QIcon(":"), "Start Logging", this); + logReplayAction = new QAction(QIcon(":"), "Start Replay", this); + + //addAction(toggleLoggingAction); + //addAction(logReplayAction); + + addSeparator(); +} + +void QGCToolBar::updateState(UASInterface* system, QString name, QString description) +{ + Q_UNUSED(system); + Q_UNUSED(description); + stateLabel->setText(tr(" State: %1").arg(name)); +} + +void QGCToolBar::updateMode(int system, QString name, QString description) +{ + Q_UNUSED(system); + Q_UNUSED(description); + modeLabel->setText(tr(" Mode: %1").arg(name)); +} + +void QGCToolBar::updateName(const QString& name) +{ + nameLabel->setText(name); +} + +/** + * The current system type is represented through the system icon. + * + * @param uas Source system, has to be the same as this->uas + * @param systemType type ID, following the MAVLink system type conventions + * @see http://pixhawk.ethz.ch/software/mavlink + */ +void QGCToolBar::setSystemType(UASInterface* uas, unsigned int systemType) +{ + Q_UNUSED(uas); + // Set matching icon + switch (systemType) { + case 0: + symbolButton->setIcon(QIcon(":/images/mavs/generic.svg")); + break; + case 1: + symbolButton->setIcon(QIcon(":/images/mavs/fixed-wing.svg")); + break; + case 2: + symbolButton->setIcon(QIcon(":/images/mavs/quadrotor.svg")); + break; + case 3: + symbolButton->setIcon(QIcon(":/images/mavs/coaxial.svg")); + break; + case 4: + symbolButton->setIcon(QIcon(":/images/mavs/helicopter.svg")); + break; + case 5: + symbolButton->setIcon(QIcon(":/images/mavs/unknown.svg")); + break; + default: + symbolButton->setIcon(QIcon(":/images/mavs/unknown.svg")); + break; + } +} + +QGCToolBar::~QGCToolBar() +{ + delete toggleLoggingAction; + delete logReplayAction; +} diff --git a/src/ui/QGCToolBar.h b/src/ui/QGCToolBar.h new file mode 100644 index 0000000000000000000000000000000000000000..fc5648e4ca00a30e7b45eab945cc771616e6a0f2 --- /dev/null +++ b/src/ui/QGCToolBar.h @@ -0,0 +1,69 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +(c) 2009 - 2011 QGROUNDCONTROL PROJECT + +This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + +======================================================================*/ + +#ifndef QGCTOOLBAR_H +#define QGCTOOLBAR_H + +#include +#include +#include +#include +#include "UASInterface.h" + +class QGCToolBar : public QToolBar +{ + Q_OBJECT + +public: + explicit QGCToolBar(QWidget *parent = 0); + void addPerspectiveChangeAction(QAction* action); + ~QGCToolBar(); + +public slots: + /** @brief Set the system that is currently displayed by this widget */ + void setActiveUAS(UASInterface* active); + /** @brief Set the system state */ + void updateState(UASInterface* system, QString name, QString description); + /** @brief Set the system mode */ + void updateMode(int system, QString name, QString description); + /** @brief Update the system name */ + void updateName(const QString& name); + /** @brief Set the MAV system type */ + void setSystemType(UASInterface* uas, unsigned int systemType); + +protected: + void createCustomWidgets(); + + QAction* toggleLoggingAction; + QAction* logReplayAction; + UASInterface* mav; + QToolButton* symbolButton; + QLabel* nameLabel; + QLabel* modeLabel; + QLabel* stateLabel; + QLabel* wpLabel; + QLabel* distlabel; + +}; + +#endif // QGCTOOLBAR_H diff --git a/src/ui/WaypointView.cc b/src/ui/WaypointView.cc index 2d817cd86f6dc0554691cad52255eeb95728c8f0..9d157ca142c2dd5ee323bb0f2d1ece6323ba4007 100644 --- a/src/ui/WaypointView.cc +++ b/src/ui/WaypointView.cc @@ -504,7 +504,7 @@ void WaypointView::updateValues() if (customCommand->commandSpinBox->value() != wp->getAction()) { customCommand->commandSpinBox->setValue(wp->getAction()); - qDebug() << "Changed action"; + // qDebug() << "Changed action"; } // Param 1 if (customCommand->param1SpinBox->value() != wp->getParam1()) { @@ -545,7 +545,7 @@ void WaypointView::updateValues() if (currId != lastId) { - qDebug() << "COLOR ID: " << currId; + // qDebug() << "COLOR ID: " << currId; if (currId == 1) { //backGroundColor = backGroundColor.lighter(150); @@ -555,7 +555,7 @@ void WaypointView::updateValues() { backGroundColor = QColor("#252528").lighter(250); } - qDebug() << "COLOR:" << backGroundColor.name(); + // qDebug() << "COLOR:" << backGroundColor.name(); // Update color based on id QString groupBoxStyle = QString("QGroupBox {padding: 0px; margin: 0px; border: 0px; background-color: %1; }").arg(backGroundColor.name()); diff --git a/src/ui/linechart/IncrementalPlot.cc b/src/ui/linechart/IncrementalPlot.cc index 862308f8c10802b0940ff9f11aff4875b4a75352..841a108caa47348511402342a5f2419b22e1766a 100644 --- a/src/ui/linechart/IncrementalPlot.cc +++ b/src/ui/linechart/IncrementalPlot.cc @@ -259,10 +259,10 @@ void IncrementalPlot::resetScaling() void IncrementalPlot::updateScale() { const double margin = 0.05; - double xMinRange = xmin-(xmin*margin); - double xMaxRange = xmax+(xmax*margin); - double yMinRange = ymin-(ymin*margin); - double yMaxRange = ymax+(ymax*margin); + double xMinRange = xmin-(qAbs(xmin*margin)); + double xMaxRange = xmax+(qAbs(xmax*margin)); + double yMinRange = ymin-(qAbs(ymin*margin)); + double yMaxRange = ymax+(qAbs(ymax*margin)); if (symmetric) { double xRange = xMaxRange - xMinRange; double yRange = yMaxRange - yMinRange; diff --git a/src/ui/map/MAV2DIcon.cc b/src/ui/map/MAV2DIcon.cc index 4fd378181b55efe0143f8f70bb2b8d2928b0d0fa..d36b2f91f7ab8ee3c8ab3e7ea55762b06069a602 100644 --- a/src/ui/map/MAV2DIcon.cc +++ b/src/ui/map/MAV2DIcon.cc @@ -53,7 +53,7 @@ void MAV2DIcon::setSelectedUAS(bool selected) */ void MAV2DIcon::setYaw(float yaw) { - //qDebug() << "MAV2Icon" << yaw; + //// qDebug() << "MAV2Icon" << yaw; float diff = fabs(yaw - this->yaw); while (diff > (float)M_PI) { diff -= (float)M_PI; @@ -111,7 +111,7 @@ void MAV2DIcon::drawAirframePolygon(int airframe, QPainter& painter, int radius, painter.rotate(yawRotate); - //qDebug() << "ICON SIZE:" << radius; + //// qDebug() << "ICON SIZE:" << radius; float iconSize = radius*0.9f; QPolygonF poly(24); @@ -158,7 +158,7 @@ void MAV2DIcon::drawAirframePolygon(int airframe, QPainter& painter, int radius, painter.rotate(yawRotate); - //qDebug() << "ICON SIZE:" << radius; + //// qDebug() << "ICON SIZE:" << radius; QPointF front(0, 0.2); front = front *iconSize; @@ -199,7 +199,7 @@ void MAV2DIcon::drawAirframePolygon(int airframe, QPainter& painter, int radius, int yawRotate = static_cast(yawDeg) % 360; painter.rotate(yawRotate); - //qDebug() << "ICON SIZE:" << radius; + //// qDebug() << "ICON SIZE:" << radius; float iconSize = radius*0.7f; @@ -254,7 +254,7 @@ void MAV2DIcon::drawAirframePolygon(int airframe, QPainter& painter, int radius, painter.rotate(yawRotate); - //qDebug() << "ICON SIZE:" << radius; + //// qDebug() << "ICON SIZE:" << radius; float iconSize = radius*0.9f; QPolygonF poly(3); diff --git a/src/ui/map/QGCMapToolBar.cc b/src/ui/map/QGCMapToolBar.cc index 7eed4610aed12e5fe91b4a8c26d865150ea1544d..eebc1f75ee0bc9a3e650abf6cc138efe366f1437 100644 --- a/src/ui/map/QGCMapToolBar.cc +++ b/src/ui/map/QGCMapToolBar.cc @@ -4,8 +4,13 @@ QGCMapToolBar::QGCMapToolBar(QWidget *parent) : QWidget(parent), + ui(new Ui::QGCMapToolBar), map(NULL), - ui(new Ui::QGCMapToolBar) + optionsMenu(this), + trailPlotMenu(this), + updateTimesMenu(this), + trailSettingsGroup(new QActionGroup(this)), + updateTimesGroup(new QActionGroup(this)) { ui->setupUi(this); } @@ -19,6 +24,7 @@ void QGCMapToolBar::setMap(QGCMapWidget* map) connect(ui->goToButton, SIGNAL(clicked()), map, SLOT(showGoToDialog())); connect(ui->goHomeButton, SIGNAL(clicked()), map, SLOT(goHome())); connect(ui->lastPosButton, SIGNAL(clicked()), map, SLOT(loadSettings())); + connect(ui->clearTrailsButton, SIGNAL(clicked()), map, SLOT(deleteTrails())); connect(map, SIGNAL(OnTileLoadStart()), this, SLOT(tileLoadStart())); connect(map, SIGNAL(OnTileLoadComplete()), this, SLOT(tileLoadEnd())); connect(map, SIGNAL(OnTilesStillToLoad(int)), this, SLOT(tileLoadProgress(int))); @@ -30,60 +36,164 @@ void QGCMapToolBar::setMap(QGCMapWidget* map) // Edit mode handling ui->editButton->hide(); -// const int uavTrailTimeList[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; // seconds -// const int uavTrailTimeCount = 10; - -// const int uavTrailDistanceList[] = {1, 2, 5, 10, 20, 50, 100, 200, 500}; // meters -// const int uavTrailDistanceCount = 9; - -// optionsMenu.setParent(this); - - -// // Build up menu -// //trailPlotMenu(tr("Add trail dot every.."), this); -// for (int i = 0; i < uavTrailTimeCount; ++i) -// { -// trailPlotMenu.addAction(QString("%1 second%2").arg(uavTrailTimeList[i]).arg((uavTrailTimeList[i] > 1) ? "s" : ""), this, SLOT(setUAVTrailTime())); -// } -// for (int i = 0; i < uavTrailDistanceCount; ++i) -// { -// trailPlotMenu.addAction(QString("%1 meter%2").arg(uavTrailDistanceList[i]).arg((uavTrailDistanceList[i] > 1) ? "s" : ""), this, SLOT(setUAVTrailDistance())); -// } -// optionsMenu.addMenu(&trailPlotMenu); - -// ui->optionsButton->setMenu(&optionsMenu); + const int uavTrailTimeList[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; // seconds + const int uavTrailTimeCount = 10; + + const int uavTrailDistanceList[] = {1, 2, 5, 10, 20, 50, 100, 200, 500}; // meters + const int uavTrailDistanceCount = 9; + + // Set exclusive items + trailSettingsGroup->setExclusive(true); + updateTimesGroup->setExclusive(true); + + + // Build up menu + trailPlotMenu.setTitle(tr("&Add trail dot every..")); + updateTimesMenu.setTitle(tr("&Limit map view update rate to..")); + + // FIXME MARK CURRENT VALUES IN MENU + QAction* action = trailPlotMenu.addAction(tr("No trail"), this, SLOT(setUAVTrailTime())); + action->setData(-1); + action->setCheckable(true); + trailSettingsGroup->addAction(action); + + for (int i = 0; i < uavTrailTimeCount; ++i) + { + QAction* action = trailPlotMenu.addAction(tr("%1 second%2").arg(uavTrailTimeList[i]).arg((uavTrailTimeList[i] > 1) ? "s" : ""), this, SLOT(setUAVTrailTime())); + action->setData(uavTrailTimeList[i]); + action->setCheckable(true); + trailSettingsGroup->addAction(action); + if (static_cast(map->getTrailType()) == mapcontrol::UAVTrailType::ByTimeElapsed && map->getTrailInterval() == uavTrailTimeList[i]) + { + // This is the current active time, set the action checked + action->setChecked(true); + } + } + for (int i = 0; i < uavTrailDistanceCount; ++i) + { + QAction* action = trailPlotMenu.addAction(tr("%1 meter%2").arg(uavTrailDistanceList[i]).arg((uavTrailDistanceList[i] > 1) ? "s" : ""), this, SLOT(setUAVTrailDistance())); + action->setData(uavTrailDistanceList[i]); + action->setCheckable(true); + trailSettingsGroup->addAction(action); + if (static_cast(map->getTrailType()) == mapcontrol::UAVTrailType::ByDistance && map->getTrailInterval() == uavTrailDistanceList[i]) + { + // This is the current active time, set the action checked + action->setChecked(true); + } + } + + // Set no trail checked if no action is checked yet + if (!trailSettingsGroup->checkedAction()) + { + action->setChecked(true); + } + + optionsMenu.addMenu(&trailPlotMenu); + + // Add update times menu + for (int i = 100; i < 5000; i+=400) + { + float time = i/1000.0f; // Convert from ms to seconds + QAction* action = updateTimesMenu.addAction(tr("%1 seconds").arg(time), this, SLOT(setUpdateInterval())); + action->setData(time); + action->setCheckable(true); + if (time == map->getUpdateRateLimit()) + { + action->blockSignals(true); + action->setChecked(true); + action->blockSignals(false); + } + updateTimesGroup->addAction(action); + } + + // If the current time is not part of the menu defaults + // still add it as new option + if (!updateTimesGroup->checkedAction()) + { + float time = map->getUpdateRateLimit(); + QAction* action = updateTimesMenu.addAction(tr("uptate every %1 seconds").arg(time), this, SLOT(setUpdateInterval())); + action->setData(time); + action->setCheckable(true); + action->setChecked(true); + updateTimesGroup->addAction(action); + } + optionsMenu.addMenu(&updateTimesMenu); + + + ui->optionsButton->setMenu(&optionsMenu); } } void QGCMapToolBar::setUAVTrailTime() { + QObject* sender = QObject::sender(); + QAction* action = qobject_cast(sender); + if (action) + { + bool ok; + int trailTime = action->data().toInt(&ok); + if (ok) + { + (map->setTrailModeTimed(trailTime)); + ui->posLabel->setText(tr("Trail mode: Every %1 second%2").arg(trailTime).arg((trailTime > 1) ? "s" : "")); + } + } } void QGCMapToolBar::setUAVTrailDistance() { + QObject* sender = QObject::sender(); + QAction* action = qobject_cast(sender); + if (action) + { + bool ok; + int trailDistance = action->data().toInt(&ok); + if (ok) + { + map->setTrailModeDistance(trailDistance); + ui->posLabel->setText(tr("Trail mode: Every %1 meter%2").arg(trailDistance).arg((trailDistance == 1) ? "s" : "")); + } + } +} + +void QGCMapToolBar::setUpdateInterval() +{ + QObject* sender = QObject::sender(); + QAction* action = qobject_cast(sender); + + if (action) + { + bool ok; + float time = action->data().toFloat(&ok); + if (ok) + { + map->setUpdateRateLimit(time); + ui->posLabel->setText(tr("Map update rate limit: %1 second%2").arg(time).arg((time != 1.0f) ? "s" : "")); + } + } } void QGCMapToolBar::tileLoadStart() { - ui->posLabel->setText(QString("Starting to load tiles..")); + ui->posLabel->setText(tr("Starting to load tiles..")); } void QGCMapToolBar::tileLoadEnd() { - ui->posLabel->setText(QString("Finished")); + ui->posLabel->setText(tr("Finished")); } void QGCMapToolBar::tileLoadProgress(int progress) { if (progress == 1) { - ui->posLabel->setText(QString("1 tile to load..")); + ui->posLabel->setText(tr("1 tile to load..")); } else if (progress > 0) { - ui->posLabel->setText(QString("%1 tiles to load..").arg(progress)); + ui->posLabel->setText(tr("%1 tiles to load..").arg(progress)); } else { @@ -94,4 +204,7 @@ void QGCMapToolBar::tileLoadProgress(int progress) QGCMapToolBar::~QGCMapToolBar() { delete ui; + delete trailSettingsGroup; + delete updateTimesGroup; + // FIXME Delete all actions } diff --git a/src/ui/map/QGCMapToolBar.h b/src/ui/map/QGCMapToolBar.h index d7d4284bd43319f19db850e9cfcf06bf69af4d0f..a7e75f220f64daf5c3a66f35a566a36d753447cb 100644 --- a/src/ui/map/QGCMapToolBar.h +++ b/src/ui/map/QGCMapToolBar.h @@ -3,6 +3,7 @@ #include #include +#include class QGCMapWidget; @@ -26,14 +27,18 @@ public slots: void tileLoadProgress(int progress); void setUAVTrailTime(); void setUAVTrailDistance(); + void setUpdateInterval(); + +private: + Ui::QGCMapToolBar *ui; protected: QGCMapWidget* map; QMenu optionsMenu; QMenu trailPlotMenu; - -private: - Ui::QGCMapToolBar *ui; + QMenu updateTimesMenu; + QActionGroup* trailSettingsGroup; + QActionGroup* updateTimesGroup; }; #endif // QGCMAPTOOLBAR_H diff --git a/src/ui/map/QGCMapToolBar.ui b/src/ui/map/QGCMapToolBar.ui index 84d7a8a615bab543a75713fb86cbae7d96356600..e75c9c49bb92954945b8815158e44e2c2ce889ed 100644 --- a/src/ui/map/QGCMapToolBar.ui +++ b/src/ui/map/QGCMapToolBar.ui @@ -6,14 +6,14 @@ 0 0 - 669 + 695 35 Form - + 12 @@ -56,39 +56,46 @@ - + - Follow + Clear Trails - + - 00.00 00.00 + Follow - + - Options + 00.00 00.00 - + Qt::Horizontal - 242 + 40 20 + + + + Options + + + diff --git a/src/ui/map/QGCMapWidget.cc b/src/ui/map/QGCMapWidget.cc index 744a71fecd6704dd1cd1264b29d9e27b318f75a9..62cfca8a82fbab80ab65547830d15636e149685c 100644 --- a/src/ui/map/QGCMapWidget.cc +++ b/src/ui/map/QGCMapWidget.cc @@ -7,14 +7,17 @@ #include "UASWaypointManager.h" QGCMapWidget::QGCMapWidget(QWidget *parent) : - mapcontrol::OPMapWidget(parent), - currWPManager(NULL), - firingWaypointChange(NULL), - maxUpdateInterval(2), // 2 seconds - followUAVEnabled(false) + mapcontrol::OPMapWidget(parent), + currWPManager(NULL), + firingWaypointChange(NULL), + maxUpdateInterval(2.1), // 2 seconds + followUAVEnabled(false), + trailType(mapcontrol::UAVTrailType::ByTimeElapsed), + trailInterval(2.0f), + followUAVID(0) { // Widget is inactive until shown - + loadSettings(false); // Set cache mode } @@ -26,7 +29,7 @@ QGCMapWidget::~QGCMapWidget() void QGCMapWidget::showEvent(QShowEvent* event) { - // FIXME XXX this is a hack to trick OPs current 1-system design + // Disable OP's standard UAV, we have more than one SetShowUAV(false); // Pass on to parent widget @@ -42,50 +45,13 @@ void QGCMapWidget::showEvent(QShowEvent* event) internals::PointLatLng pos_lat_lon = internals::PointLatLng(0, 0); - // // ************** - // // default home position - - // home_position.coord = pos_lat_lon; - // home_position.altitude = altitude; - // home_position.locked = false; - - // // ************** - // // default magic waypoint params - - // magic_waypoint.map_wp_item = NULL; - // magic_waypoint.coord = home_position.coord; - // magic_waypoint.altitude = altitude; - // magic_waypoint.description = "Magic waypoint"; - // magic_waypoint.locked = false; - // magic_waypoint.time_seconds = 0; - // magic_waypoint.hold_time_seconds = 0; - SetMouseWheelZoomType(internals::MouseWheelZoomType::MousePositionWithoutCenter); // set how the mouse wheel zoom functions SetFollowMouse(true); // we want a contiuous mouse position reading SetShowHome(true); // display the HOME position on the map -// SetShowUAV(true); // display the UAV position on the map - //SetShowDiagnostics(true); // Not needed in flight / production mode - - Home->SetSafeArea(30); // set radius (meters) Home->SetShowSafeArea(true); // show the safe area - -//// UAV->SetTrailTime(uav_trail_time_list[0]); // seconds -//// UAV->SetTrailDistance(uav_trail_distance_list[1]); // meters - -//// UAV->SetTrailType(mapcontrol::UAVTrailType::ByTimeElapsed); -//// UAV->SetTrailType(mapcontrol::UAVTrailType::ByDistance); - -// GPS->SetTrailTime(uav_trail_time_list[0]); // seconds -// GPS->SetTrailDistance(uav_trail_distance_list[1]); // meters - - // GPS->SetTrailType(UAVTrailType::ByTimeElapsed); - - SetCurrentPosition(pos_lat_lon); // set the map position Home->SetCoord(pos_lat_lon); // set the HOME position -// UAV->SetUAVPos(pos_lat_lon, 0.0); // set the UAV position -// GPS->SetUAVPos(pos_lat_lon, 0.0); // set the UAV position setFrameStyle(QFrame::NoFrame); // no border frame setBackgroundBrush(QBrush(Qt::black)); // tile background @@ -96,19 +62,16 @@ void QGCMapWidget::showEvent(QShowEvent* event) // Set currently selected system activeUASSet(UASManager::instance()->getActiveUAS()); - // FIXME XXX this is a hack to trick OPs current 1-system design - SetShowUAV(false); - - // Connect map updates to the adapter slots connect(this, SIGNAL(WPValuesChanged(WayPointItem*)), this, SLOT(handleMapWaypointEdit(WayPointItem*))); - + SetCurrentPosition(pos_lat_lon); // set the map position setFocus(); // Start timer connect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateGlobalPosition())); updateTimer.start(maxUpdateInterval*1000); + // Update all UAV positions updateGlobalPosition(); //QTimer::singleShot(800, this, SLOT(loadSettings())); } @@ -119,7 +82,10 @@ void QGCMapWidget::hideEvent(QHideEvent* event) OPMapWidget::hideEvent(event); } -void QGCMapWidget::loadSettings() +/** + * @param changePosition Load also the last position from settings and update the map position. + */ +void QGCMapWidget::loadSettings(bool changePosition) { // Atlantic Ocean near Africa, coordinate origin double lastZoom = 1; @@ -128,11 +94,32 @@ void QGCMapWidget::loadSettings() QSettings settings; settings.beginGroup("QGC_MAPWIDGET"); - lastLat = settings.value("LAST_LATITUDE", lastLat).toDouble(); - lastLon = settings.value("LAST_LONGITUDE", lastLon).toDouble(); - lastZoom = settings.value("LAST_ZOOM", lastZoom).toDouble(); + if (changePosition) + { + lastLat = settings.value("LAST_LATITUDE", lastLat).toDouble(); + lastLon = settings.value("LAST_LONGITUDE", lastLon).toDouble(); + lastZoom = settings.value("LAST_ZOOM", lastZoom).toDouble(); + } + trailType = static_cast(settings.value("TRAIL_TYPE", trailType).toInt()); + trailInterval = settings.value("TRAIL_INTERVAL", trailInterval).toFloat(); settings.endGroup(); + // SET TRAIL TYPE + foreach (mapcontrol::UAVItem* uav, GetUAVS()) + { + // Set the correct trail type + uav->SetTrailType(trailType); + // Set the correct trail interval + if (trailType == mapcontrol::UAVTrailType::ByDistance) + { + uav->SetTrailDistance(trailInterval); + } + else if (trailType == mapcontrol::UAVTrailType::ByTimeElapsed) + { + uav->SetTrailTime(trailInterval); + } + } + // SET INITIAL POSITION AND ZOOM internals::PointLatLng pos_lat_lon = internals::PointLatLng(lastLat, lastLon); SetCurrentPosition(pos_lat_lon); // set the map position @@ -147,6 +134,8 @@ void QGCMapWidget::storeSettings() settings.setValue("LAST_LATITUDE", pos.Lat()); settings.setValue("LAST_LONGITUDE", pos.Lng()); settings.setValue("LAST_ZOOM", ZoomReal()); + settings.setValue("TRAIL_TYPE", static_cast(trailType)); + settings.setValue("TRAIL_INTERVAL", trailInterval); settings.endGroup(); settings.sync(); } @@ -163,13 +152,13 @@ void QGCMapWidget::mouseDoubleClickEvent(QMouseEvent* event) // Create new waypoint internals::PointLatLng pos = map->FromLocalToLatLng(event->pos().x(), event->pos().y()); Waypoint* wp = currWPManager->createWaypoint(); -// wp->blockSignals(true); -// wp->setFrame(MAV_FRAME_GLOBAL_RELATIVE_ALT); + // wp->blockSignals(true); + // wp->setFrame(MAV_FRAME_GLOBAL_RELATIVE_ALT); wp->setLatitude(pos.Lat()); wp->setLongitude(pos.Lng()); wp->setAltitude(0); -// wp->blockSignals(false); -// currWPManager->notifyOfChange(wp); + // wp->blockSignals(false); + // currWPManager->notifyOfChange(wp); } } OPMapWidget::mouseDoubleClickEvent(event); @@ -182,7 +171,7 @@ void QGCMapWidget::mouseDoubleClickEvent(QMouseEvent* event) */ void QGCMapWidget::addUAS(UASInterface* uas) { - qDebug() << "ADDING UAS"; + // // qDebug() << "ADDING UAS"; connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); //connect(uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*,double,double,double,quint64))); connect(uas, SIGNAL(systemSpecsChanged(int)), this, SLOT(updateSystemSpecs(int))); @@ -401,7 +390,7 @@ void QGCMapWidget::handleMapWaypointEdit(mapcontrol::WayPointItem* waypoint) if (firingWaypointChange == wp) return; // Not in cycle, block now from entering it firingWaypointChange = wp; - qDebug() << "UPDATING WP FROM MAP"; + // // qDebug() << "UPDATING WP FROM MAP"; // Update WP values internals::PointLatLng pos = waypoint->Coord(); @@ -416,9 +405,9 @@ void QGCMapWidget::handleMapWaypointEdit(mapcontrol::WayPointItem* waypoint) internals::PointLatLng coord = waypoint->Coord(); QString coord_str = " " + QString::number(coord.Lat(), 'f', 6) + " " + QString::number(coord.Lng(), 'f', 6); - qDebug() << "MAP WP COORD (MAP):" << coord_str << __FILE__ << __LINE__; + // // qDebug() << "MAP WP COORD (MAP):" << coord_str << __FILE__ << __LINE__; QString wp_str = QString::number(wp->getLatitude(), 'f', 6) + " " + QString::number(wp->getLongitude(), 'f', 6); - qDebug() << "MAP WP COORD (WP):" << wp_str << __FILE__ << __LINE__; + // // qDebug() << "MAP WP COORD (WP):" << wp_str << __FILE__ << __LINE__; firingWaypointChange = NULL; diff --git a/src/ui/map/QGCMapWidget.h b/src/ui/map/QGCMapWidget.h index 2b6048161b5a45823b4143e6628e4aaa281b497f..d1d34e4b82335548773b9a504b227c9549eb7615 100644 --- a/src/ui/map/QGCMapWidget.h +++ b/src/ui/map/QGCMapWidget.h @@ -26,6 +26,12 @@ public: /** @brief Map centered on current active system */ bool getFollowUAVEnabled() { return followUAVEnabled; } + /** @brief The maximum map update rate */ + float getUpdateRateLimit() { return maxUpdateInterval; } + /** @brief Get the trail type */ + int getTrailType() { return static_cast(trailType); } + /** @brief Get the trail interval */ + float getTrailInterval() { return trailInterval; } signals: void homePositionChanged(double latitude, double longitude, double altitude); @@ -60,8 +66,50 @@ public slots: void cacheVisibleRegion(); /** @brief Set follow mode */ void setFollowUAVEnabled(bool enabled) { followUAVEnabled = enabled; } + /** @brief Set trail to time mode and set time @param seconds The minimum time between trail dots in seconds. If set to a value < 0, trails will be disabled*/ + void setTrailModeTimed(int seconds) + { + foreach(mapcontrol::UAVItem* uav, GetUAVS()) + { + if (seconds >= 0) + { + uav->SetTrailTime(seconds); + uav->SetTrailType(mapcontrol::UAVTrailType::ByTimeElapsed); + } + else + { + uav->SetTrailType(mapcontrol::UAVTrailType::NoTrail); + } + } + } + /** @brief Set trail to distance mode and set time @param meters The minimum distance between trail dots in meters. The actual distance depends on the MAV's update rate as well. If set to a value < 0, trails will be disabled*/ + void setTrailModeDistance(int meters) + { + foreach(mapcontrol::UAVItem* uav, GetUAVS()) + { + if (meters >= 0) + { + uav->SetTrailDistance(meters); + uav->SetTrailType(mapcontrol::UAVTrailType::ByDistance); + } + else + { + uav->SetTrailType(mapcontrol::UAVTrailType::NoTrail); + } + } + } + /** @brief Delete all trails */ + void deleteTrails() + { + foreach(mapcontrol::UAVItem* uav, GetUAVS()) + { + uav->DeleteTrail(); + } + } - void loadSettings(); + /** @brief Load the settings for this widget from disk */ + void loadSettings(bool changePosition=true); + /** @brief Store the settings for this widget to disk */ void storeSettings(); protected slots: @@ -93,6 +141,8 @@ protected: }; editMode currEditMode; ///< The current edit mode on the map bool followUAVEnabled; ///< Does the map follow the UAV? + mapcontrol::UAVTrailType::Types trailType; ///< Time or distance based trail dots + float trailInterval; ///< Time or distance between trail items int followUAVID; ///< Which UAV should be tracked? diff --git a/src/ui/map/Waypoint2DIcon.cc b/src/ui/map/Waypoint2DIcon.cc index ab85b4463c65982655a2168e4d2cfa76c281cabb..3bf54232f556aceb02a2a136146338969d01df4a 100644 --- a/src/ui/map/Waypoint2DIcon.cc +++ b/src/ui/map/Waypoint2DIcon.cc @@ -12,6 +12,8 @@ Waypoint2DIcon::Waypoint2DIcon(mapcontrol::MapGraphicItem* map, mapcontrol::OPMa showOrbit(false), color(Qt::red) { + Q_UNUSED(name); + SetHeading(0); SetNumber(listindex); this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true); @@ -60,7 +62,7 @@ void Waypoint2DIcon::updateWaypoint() SetHeading(waypoint->getYaw()); SetCoord(internals::PointLatLng(waypoint->getLatitude(), waypoint->getLongitude())); - qDebug() << "UPDATING WP:" << waypoint->getId() << "LAT:" << waypoint->getLatitude() << "LON:" << waypoint->getLongitude(); + // qDebug() << "UPDATING WP:" << waypoint->getId() << "LAT:" << waypoint->getLatitude() << "LON:" << waypoint->getLongitude(); SetDescription(waypoint->getDescription()); SetAltitude(waypoint->getAltitude()); @@ -68,7 +70,7 @@ void Waypoint2DIcon::updateWaypoint() drawIcon(); QRectF newSize = boundingRect(); - qDebug() << "WIDTH" << newSize.width() << "<" << oldSize.width(); + // qDebug() << "WIDTH" << newSize.width() << "<" << oldSize.width(); // If new size is smaller than old size, update surrounding if ((newSize.width() <= oldSize.width()) || (newSize.height() <= oldSize.height())) @@ -78,8 +80,8 @@ void Waypoint2DIcon::updateWaypoint() int oldWidth = oldSize.width() + 20; int oldHeight = oldSize.height() + 20; map->update(this->x()-10, this->y()-10, oldWidth, oldHeight); - //qDebug() << "UPDATING DUE TO SMALLER SIZE"; - //qDebug() << "X:" << this->x()-1 << "Y:" << this->y()-1 << "WIDTH:" << oldWidth << "HEIGHT:" << oldHeight; + //// qDebug() << "UPDATING DUE TO SMALLER SIZE"; + //// qDebug() << "X:" << this->x()-1 << "Y:" << this->y()-1 << "WIDTH:" << oldWidth << "HEIGHT:" << oldHeight; } else { diff --git a/src/ui/uas/UASView.cc b/src/ui/uas/UASView.cc index 41a173c64a9565c8c57970d0a912c01f1f9dbfd4..4d294e41249e1e9a1de6310bea30f9fd586777e0 100644 --- a/src/ui/uas/UASView.cc +++ b/src/ui/uas/UASView.cc @@ -146,6 +146,9 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : m_ui->killButton->hide(); m_ui->shutdownButton->hide(); + // Set state and mode + updateMode(uas->getUASID(), uas->getShortMode(), ""); + updateState(uas, uas->getShortState(), ""); setSystemType(uas, uas->getSystemType()); } @@ -228,7 +231,7 @@ void UASView::mouseDoubleClickEvent (QMouseEvent * event) { Q_UNUSED(event); UASManager::instance()->setActiveUAS(uas); - qDebug() << __FILE__ << __LINE__ << "DOUBLECLICKED"; + // qDebug() << __FILE__ << __LINE__ << "DOUBLECLICKED"; } void UASView::enterEvent(QEvent* event) @@ -239,10 +242,10 @@ void UASView::enterEvent(QEvent* event) grabMouse(QCursor(Qt::PointingHandCursor)); } } - qDebug() << __FILE__ << __LINE__ << "IN FOCUS"; + // qDebug() << __FILE__ << __LINE__ << "IN FOCUS"; if (event->type() == QEvent::MouseButtonDblClick) { - qDebug() << __FILE__ << __LINE__ << "UAS CLICKED!"; + // qDebug() << __FILE__ << __LINE__ << "UAS CLICKED!"; } } @@ -496,7 +499,7 @@ void UASView::refresh() //repaint(); static quint64 lastupdate = 0; - //qDebug() << "UASVIEW update diff: " << MG::TIME::getGroundTimeNow() - lastupdate; + //// qDebug() << "UASVIEW update diff: " << MG::TIME::getGroundTimeNow() - lastupdate; lastupdate = MG::TIME::getGroundTimeNow(); // FIXME @@ -504,10 +507,10 @@ void UASView::refresh() if (generalUpdateCount == 4) { #if (QGC_EVENTLOOP_DEBUG) - qDebug() << "EVENTLOOP:" << __FILE__ << __LINE__; + // qDebug() << "EVENTLOOP:" << __FILE__ << __LINE__; #endif generalUpdateCount = 0; - //qDebug() << "UPDATING EVERYTHING"; + //// qDebug() << "UPDATING EVERYTHING"; // State m_ui->stateLabel->setText(state); m_ui->statusTextLabel->setText(stateDesc); diff --git a/thirdParty/mavlink/include/ardupilotmega/ardupilotmega.h b/thirdParty/mavlink/include/ardupilotmega/ardupilotmega.h index 98139a642702d55b6d8fc1756806e32dd967d9ab..4d13e0b543c9a021cd9811f4378bb84dfdc47d49 100644 --- a/thirdParty/mavlink/include/ardupilotmega/ardupilotmega.h +++ b/thirdParty/mavlink/include/ardupilotmega/ardupilotmega.h @@ -1,7 +1,7 @@ /** @file * @brief MAVLink comm protocol. - * @see http://pixhawk.ethz.ch/software/mavlink - * Generated on Thursday, March 31 2011, 22:06 UTC + * @see http://qgroundcontrol.org/mavlink/ + * Generated on Wednesday, July 27 2011, 14:17 UTC */ #ifndef ARDUPILOTMEGA_H #define ARDUPILOTMEGA_H @@ -33,6 +33,13 @@ extern "C" { // MESSAGE DEFINITIONS + + +// MESSAGE LENGTHS + +#undef MAVLINK_MESSAGE_LENGTHS +#define MAVLINK_MESSAGE_LENGTHS { 3, 4, 8, 14, 8, 28, 3, 32, 0, 2, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 19, 2, 23, 21, 0, 37, 26, 101, 26, 16, 32, 32, 37, 32, 11, 17, 17, 16, 18, 36, 4, 4, 2, 2, 4, 2, 2, 3, 14, 12, 18, 16, 8, 27, 25, 0, 0, 0, 0, 0, 5, 5, 26, 16, 36, 5, 6, 0, 0, 21, 0, 0, 0, 18, 20, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 14, 14, 51 } + #ifdef __cplusplus } #endif diff --git a/thirdParty/mavlink/include/ardupilotmega/mavlink.h b/thirdParty/mavlink/include/ardupilotmega/mavlink.h index 1e2a10442fe3e384b3a8cc53fe26356055709e92..8ee2430d74ef6945bd88749e49e4bc4105c40747 100644 --- a/thirdParty/mavlink/include/ardupilotmega/mavlink.h +++ b/thirdParty/mavlink/include/ardupilotmega/mavlink.h @@ -1,7 +1,7 @@ /** @file * @brief MAVLink comm protocol. * @see http://pixhawk.ethz.ch/software/mavlink - * Generated on Thursday, March 31 2011, 22:06 UTC + * Generated on Wednesday, July 27 2011, 14:17 UTC */ #ifndef MAVLINK_H #define MAVLINK_H diff --git a/thirdParty/mavlink/include/common/common.h b/thirdParty/mavlink/include/common/common.h index df1f685d91d1c2d92c4c671f9b5b8232bec4240f..bf99ef000314ed026055dca19e22cc106f0e59fe 100644 --- a/thirdParty/mavlink/include/common/common.h +++ b/thirdParty/mavlink/include/common/common.h @@ -1,7 +1,7 @@ /** @file * @brief MAVLink comm protocol. - * @see http://pixhawk.ethz.ch/software/mavlink - * Generated on Thursday, March 31 2011, 22:06 UTC + * @see http://qgroundcontrol.org/mavlink/ + * Generated on Wednesday, July 27 2011, 14:17 UTC */ #ifndef COMMON_H #define COMMON_H @@ -28,55 +28,65 @@ extern "C" { // ENUM DEFINITIONS -/** @brief Commands to be executed by the MAV. They can be executed on user request, or as part of a mission script. If the action is used in a mission, the parameter mapping to the waypoint/mission message is as follows: Param 1, Param 2, Param 3, Param 4, X: Param 5, Y:Param 6, Z:Param 7. This command list is similar what ARINC 424 is for commercial aircraft: A data format how to interpret waypoint/mission data. */ +/** @brief Commands to be executed by the MAV. They can be executed on user request, or as part of a mission script. If the action is used in a mission, the parameter mapping to the waypoint/mission message is as follows: Param 1, Param 2, Param 3, Param 4, X: Param 5, Y:Param 6, Z:Param 7. This command list is similar what ARINC 424 is for commercial aircraft: A data format how to interpret waypoint/mission data. */ enum MAV_CMD { - MAV_CMD_NAV_WAYPOINT=16, /* Navigate to waypoint.Hold time in decimal seconds. (ignored by fixed wing, time to stay at waypoint for rotary wing)Acceptance radius in meters (if the sphere with this radius is hit, the waypoint counts as reached)0 to pass through the WP, if > 0 radius in meters to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.Desired yaw angle at waypoint (rotary wing)LatitudeLongitudeAltitude*/ - MAV_CMD_NAV_LOITER_UNLIM=17, /* Loiter around this waypoint an unlimited amount of timeEmptyEmptyRadius around waypoint, in meters. If positive loiter clockwise, else counter-clockwiseDesired yaw angle.LatitudeLongitudeAltitude*/ - MAV_CMD_NAV_LOITER_TURNS=18, /* Loiter around this waypoint for X turnsTurnsEmptyRadius around waypoint, in meters. If positive loiter clockwise, else counter-clockwiseDesired yaw angle.LatitudeLongitudeAltitude*/ - MAV_CMD_NAV_LOITER_TIME=19, /* Loiter around this waypoint for X secondsSeconds (decimal)EmptyRadius around waypoint, in meters. If positive loiter clockwise, else counter-clockwiseDesired yaw angle.LatitudeLongitudeAltitude*/ - MAV_CMD_NAV_RETURN_TO_LAUNCH=20, /* Return to launch locationEmptyEmptyEmptyEmptyEmptyEmptyEmpty*/ - MAV_CMD_NAV_LAND=21, /* Land at locationEmptyEmptyEmptyDesired yaw angle.LatitudeLongitudeAltitude*/ - MAV_CMD_NAV_TAKEOFF=22, /* Takeoff from ground / handMinimum pitch (if airspeed sensor present), desired pitch without sensorEmptyEmptyYaw angle (if magnetometer present), ignored without magnetometerLatitudeLongitudeAltitude*/ - MAV_CMD_NAV_ORIENTATION_TARGET=80, /* Set the location the system should be heading towards (camera heads or rotary wing aircraft).EmptyEmptyEmptyEmptyLatitudeLongitudeAltitude*/ - MAV_CMD_NAV_PATHPLANNING=81, /* Control autonomous path planning on the MAV.0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy gridEmptyYaw angle at goal, in compass degrees, [0..360]Latitude/X of goalLongitude/Y of goalAltitude/Z of goal*/ - MAV_CMD_NAV_LAST=95, /* NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumerationEmptyEmptyEmptyEmptyEmptyEmptyEmpty*/ - MAV_CMD_CONDITION_DELAY=112, /* Delay mission state machine.Delay in seconds (decimal)EmptyEmptyEmptyEmptyEmptyEmpty*/ - MAV_CMD_CONDITION_CHANGE_ALT=113, /* Ascend/descend at rate. Delay mission state machine until desired altitude reached.Descent / Ascend rate (m/s)EmptyEmptyEmptyEmptyEmptyFinish Altitude*/ - MAV_CMD_CONDITION_DISTANCE=114, /* Delay mission state machine until within desired distance of next NAV point.Distance (meters)EmptyEmptyEmptyEmptyEmptyEmpty*/ - MAV_CMD_CONDITION_YAW=115, /* Reach a certain target angle.target angle: [0-360], 0 is northspeed during yaw change:[deg per second]direction: negative: counter clockwise, positive: clockwise [-1,1]relative offset or absolute angle: [ 1,0]EmptyEmptyEmpty*/ - MAV_CMD_CONDITION_LAST=159, /* NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumerationEmptyEmptyEmptyEmptyEmptyEmptyEmpty*/ - MAV_CMD_DO_SET_MODE=176, /* Set system mode.Mode, as defined by ENUM MAV_MODEEmptyEmptyEmptyEmptyEmptyEmpty*/ - MAV_CMD_DO_JUMP=177, /* Jump to the desired command in the mission list. Repeat this action only the specified number of timesSequence numberRepeat countEmptyEmptyEmptyEmptyEmpty*/ - MAV_CMD_DO_CHANGE_SPEED=178, /* Change speed and/or throttle set points.Speed type (0=Airspeed, 1=Ground Speed)Speed (m/s, -1 indicates no change)Throttle ( Percent, -1 indicates no change)EmptyEmptyEmptyEmpty*/ - MAV_CMD_DO_SET_HOME=179, /* Changes the home location either to the current location or a specified location.Use current (1=use current location, 0=use specified location)EmptyEmptyEmptyLatitudeLongitudeAltitude*/ - MAV_CMD_DO_SET_PARAMETER=180, /* Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter.Parameter numberParameter valueEmptyEmptyEmptyEmptyEmpty*/ - MAV_CMD_DO_SET_RELAY=181, /* Set a relay to a condition.Relay numberSetting (1=on, 0=off, others possible depending on system hardware)EmptyEmptyEmptyEmptyEmpty*/ - MAV_CMD_DO_REPEAT_RELAY=182, /* Cycle a relay on and off for a desired number of cyles with a desired period.Relay numberCycle countCycle time (seconds, decimal)EmptyEmptyEmptyEmpty*/ - MAV_CMD_DO_SET_SERVO=183, /* Set a servo to a desired PWM value.Servo numberPWM (microseconds, 1000 to 2000 typical)EmptyEmptyEmptyEmptyEmpty*/ - MAV_CMD_DO_REPEAT_SERVO=184, /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period.Servo numberPWM (microseconds, 1000 to 2000 typical)Cycle countCycle time (seconds)EmptyEmptyEmpty*/ - MAV_CMD_DO_CONTROL_VIDEO=200, /* Control onboard camera system.Camera ID (-1 for all)Transmission: 0: disabled, 1: enabled compressed, 2: enabled rawTransmission mode: 0: video stream, >0: single images every n seconds (decimal)Recording: 0: disabled, 1: enabled compressed, 2: enabled rawEmptyEmptyEmpty*/ - MAV_CMD_DO_LAST=240, /* NOP - This command is only used to mark the upper limit of the DO commands in the enumerationEmptyEmptyEmptyEmptyEmptyEmptyEmpty*/ - MAV_CMD_PREFLIGHT_CALIBRATION=241, /* Trigger calibration. This command will be only accepted if in pre-flight mode.Gyro calibration: 0: no, 1: yesMagnetometer calibration: 0: no, 1: yesGround pressure: 0: no, 1: yesRadio calibration: 0: no, 1: yesEmptyEmptyEmpty*/ - MAV_CMD_PREFLIGHT_STORAGE=245, /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode.Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROMMission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROMReservedReservedEmptyEmptyEmpty*/ + MAV_CMD_NAV_WAYPOINT=16, /* Navigate to waypoint. | Hold time in decimal seconds. (ignored by fixed wing, time to stay at waypoint for rotary wing) | Acceptance radius in meters (if the sphere with this radius is hit, the waypoint counts as reached) | 0 to pass through the WP, if > 0 radius in meters to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control. | Desired yaw angle at waypoint (rotary wing) | Latitude | Longitude | Altitude | */ + MAV_CMD_NAV_LOITER_UNLIM=17, /* Loiter around this waypoint an unlimited amount of time | Empty | Empty | Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise | Desired yaw angle. | Latitude | Longitude | Altitude | */ + MAV_CMD_NAV_LOITER_TURNS=18, /* Loiter around this waypoint for X turns | Turns | Empty | Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise | Desired yaw angle. | Latitude | Longitude | Altitude | */ + MAV_CMD_NAV_LOITER_TIME=19, /* Loiter around this waypoint for X seconds | Seconds (decimal) | Empty | Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise | Desired yaw angle. | Latitude | Longitude | Altitude | */ + MAV_CMD_NAV_RETURN_TO_LAUNCH=20, /* Return to launch location | Empty | Empty | Empty | Empty | Empty | Empty | Empty | */ + MAV_CMD_NAV_LAND=21, /* Land at location | Empty | Empty | Empty | Desired yaw angle. | Latitude | Longitude | Altitude | */ + MAV_CMD_NAV_TAKEOFF=22, /* Takeoff from ground / hand | Minimum pitch (if airspeed sensor present), desired pitch without sensor | Empty | Empty | Yaw angle (if magnetometer present), ignored without magnetometer | Latitude | Longitude | Altitude | */ + MAV_CMD_NAV_ROI=80, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicles control system to control the vehicle attitude and the attitude of various sensors such as cameras. | Region of intereset mode. (see MAV_ROI enum) | Waypoint index/ target ID. (see MAV_ROI enum) | ROI index (allows a vehicle to manage multiple ROI's) | Empty | x the location of the fixed ROI (see MAV_FRAME) | y | z | */ + MAV_CMD_NAV_PATHPLANNING=81, /* Control autonomous path planning on the MAV. | 0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning | 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid | Empty | Yaw angle at goal, in compass degrees, [0..360] | Latitude/X of goal | Longitude/Y of goal | Altitude/Z of goal | */ + MAV_CMD_NAV_LAST=95, /* NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration | Empty | Empty | Empty | Empty | Empty | Empty | Empty | */ + MAV_CMD_CONDITION_DELAY=112, /* Delay mission state machine. | Delay in seconds (decimal) | Empty | Empty | Empty | Empty | Empty | Empty | */ + MAV_CMD_CONDITION_CHANGE_ALT=113, /* Ascend/descend at rate. Delay mission state machine until desired altitude reached. | Descent / Ascend rate (m/s) | Empty | Empty | Empty | Empty | Empty | Finish Altitude | */ + MAV_CMD_CONDITION_DISTANCE=114, /* Delay mission state machine until within desired distance of next NAV point. | Distance (meters) | Empty | Empty | Empty | Empty | Empty | Empty | */ + MAV_CMD_CONDITION_YAW=115, /* Reach a certain target angle. | target angle: [0-360], 0 is north | speed during yaw change:[deg per second] | direction: negative: counter clockwise, positive: clockwise [-1,1] | relative offset or absolute angle: [ 1,0] | Empty | Empty | Empty | */ + MAV_CMD_CONDITION_LAST=159, /* NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration | Empty | Empty | Empty | Empty | Empty | Empty | Empty | */ + MAV_CMD_DO_SET_MODE=176, /* Set system mode. | Mode, as defined by ENUM MAV_MODE | Empty | Empty | Empty | Empty | Empty | Empty | */ + MAV_CMD_DO_JUMP=177, /* Jump to the desired command in the mission list. Repeat this action only the specified number of times | Sequence number | Repeat count | Empty | Empty | Empty | Empty | Empty | */ + MAV_CMD_DO_CHANGE_SPEED=178, /* Change speed and/or throttle set points. | Speed type (0=Airspeed, 1=Ground Speed) | Speed (m/s, -1 indicates no change) | Throttle ( Percent, -1 indicates no change) | Empty | Empty | Empty | Empty | */ + MAV_CMD_DO_SET_HOME=179, /* Changes the home location either to the current location or a specified location. | Use current (1=use current location, 0=use specified location) | Empty | Empty | Empty | Latitude | Longitude | Altitude | */ + MAV_CMD_DO_SET_PARAMETER=180, /* Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. | Parameter number | Parameter value | Empty | Empty | Empty | Empty | Empty | */ + MAV_CMD_DO_SET_RELAY=181, /* Set a relay to a condition. | Relay number | Setting (1=on, 0=off, others possible depending on system hardware) | Empty | Empty | Empty | Empty | Empty | */ + MAV_CMD_DO_REPEAT_RELAY=182, /* Cycle a relay on and off for a desired number of cyles with a desired period. | Relay number | Cycle count | Cycle time (seconds, decimal) | Empty | Empty | Empty | Empty | */ + MAV_CMD_DO_SET_SERVO=183, /* Set a servo to a desired PWM value. | Servo number | PWM (microseconds, 1000 to 2000 typical) | Empty | Empty | Empty | Empty | Empty | */ + MAV_CMD_DO_REPEAT_SERVO=184, /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. | Servo number | PWM (microseconds, 1000 to 2000 typical) | Cycle count | Cycle time (seconds) | Empty | Empty | Empty | */ + MAV_CMD_DO_CONTROL_VIDEO=200, /* Control onboard camera system. | Camera ID (-1 for all) | Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw | Transmission mode: 0: video stream, >0: single images every n seconds (decimal) | Recording: 0: disabled, 1: enabled compressed, 2: enabled raw | Empty | Empty | Empty | */ + MAV_CMD_DO_LAST=240, /* NOP - This command is only used to mark the upper limit of the DO commands in the enumeration | Empty | Empty | Empty | Empty | Empty | Empty | Empty | */ + MAV_CMD_PREFLIGHT_CALIBRATION=241, /* Trigger calibration. This command will be only accepted if in pre-flight mode. | Gyro calibration: 0: no, 1: yes | Magnetometer calibration: 0: no, 1: yes | Ground pressure: 0: no, 1: yes | Radio calibration: 0: no, 1: yes | Empty | Empty | Empty | */ + MAV_CMD_PREFLIGHT_STORAGE=245, /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. | Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM | Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM | Reserved | Reserved | Empty | Empty | Empty | */ MAV_CMD_ENUM_END }; -/** @brief Data stream IDs. A data stream is not a fixed set of messages, but rather a recommendation to the autopilot software. Individual autopilots may or may not obey the recommended messages. */ +/** @brief Data stream IDs. A data stream is not a fixed set of messages, but rather a recommendation to the autopilot software. Individual autopilots may or may not obey the recommended messages. */ enum MAV_DATA_STREAM { - MAV_DATA_STREAM_ALL=0, /* Enable all data streams*/ - MAV_DATA_STREAM_RAW_SENSORS=1, /* Enable IMU_RAW, GPS_RAW, GPS_STATUS packets.*/ - MAV_DATA_STREAM_EXTENDED_STATUS=2, /* Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS*/ - MAV_DATA_STREAM_RC_CHANNELS=3, /* Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW*/ - MAV_DATA_STREAM_RAW_CONTROLLER=4, /* Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT.*/ - MAV_DATA_STREAM_POSITION=6, /* Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages.*/ - MAV_DATA_STREAM_EXTRA1=10, /* Dependent on the autopilot*/ - MAV_DATA_STREAM_EXTRA2=11, /* Dependent on the autopilot*/ - MAV_DATA_STREAM_EXTRA3=12, /* Dependent on the autopilot*/ + MAV_DATA_STREAM_ALL=0, /* Enable all data streams | */ + MAV_DATA_STREAM_RAW_SENSORS=1, /* Enable IMU_RAW, GPS_RAW, GPS_STATUS packets. | */ + MAV_DATA_STREAM_EXTENDED_STATUS=2, /* Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS | */ + MAV_DATA_STREAM_RC_CHANNELS=3, /* Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW | */ + MAV_DATA_STREAM_RAW_CONTROLLER=4, /* Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT. | */ + MAV_DATA_STREAM_POSITION=6, /* Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages. | */ + MAV_DATA_STREAM_EXTRA1=10, /* Dependent on the autopilot | */ + MAV_DATA_STREAM_EXTRA2=11, /* Dependent on the autopilot | */ + MAV_DATA_STREAM_EXTRA3=12, /* Dependent on the autopilot | */ MAV_DATA_STREAM_ENUM_END }; +/** @brief The ROI (region of interest) for the vehicle. This can be be used by the vehicle for camera/vehicle attitude alignment (see MAV_CMD_NAV_ROI). */ +enum MAV_ROI +{ + MAV_ROI_WPNEXT=0, /* Point toward next waypoint. | */ + MAV_ROI_WPINDEX=1, /* Point toward given waypoint. | */ + MAV_ROI_LOCATION=2, /* Point toward fixed location. | */ + MAV_ROI_TARGET=3, /* Point toward of given id. | */ + MAV_ROI_ENUM_END +}; + // MESSAGE DEFINITIONS @@ -143,6 +153,13 @@ enum MAV_DATA_STREAM #include "./mavlink_msg_named_value_int.h" #include "./mavlink_msg_statustext.h" #include "./mavlink_msg_debug.h" + + +// MESSAGE LENGTHS + +#undef MAVLINK_MESSAGE_LENGTHS +#define MAVLINK_MESSAGE_LENGTHS { 3, 4, 8, 14, 8, 28, 3, 32, 0, 2, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 19, 2, 23, 21, 0, 37, 26, 101, 26, 16, 32, 32, 37, 32, 11, 17, 17, 16, 18, 36, 4, 4, 2, 2, 4, 2, 2, 3, 14, 12, 18, 16, 8, 27, 25, 0, 0, 0, 0, 0, 5, 5, 26, 16, 36, 5, 6, 0, 0, 21, 0, 0, 0, 18, 20, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 14, 14, 51 } + #ifdef __cplusplus } #endif diff --git a/thirdParty/mavlink/include/common/mavlink.h b/thirdParty/mavlink/include/common/mavlink.h index fc3473e9f6d6bbde6271f602540651905a6fc23a..404b970bffead60f0b273e47333bd8f438f488db 100644 --- a/thirdParty/mavlink/include/common/mavlink.h +++ b/thirdParty/mavlink/include/common/mavlink.h @@ -1,7 +1,7 @@ /** @file * @brief MAVLink comm protocol. * @see http://pixhawk.ethz.ch/software/mavlink - * Generated on Thursday, March 31 2011, 22:06 UTC + * Generated on Wednesday, July 27 2011, 14:17 UTC */ #ifndef MAVLINK_H #define MAVLINK_H diff --git a/thirdParty/mavlink/include/mavlink_types.h b/thirdParty/mavlink/include/mavlink_types.h index 2eff48ef8fec9e045131281184b5c6c6c5c8344f..67eed17c8ef58db38206917b2867b15817141e0a 100644 --- a/thirdParty/mavlink/include/mavlink_types.h +++ b/thirdParty/mavlink/include/mavlink_types.h @@ -13,6 +13,7 @@ enum MAV_CLASS MAV_CLASS_GENERIC_MISSION_WAYPOINTS_ONLY = 5, ///< Generic autopilot only supporting simple waypoints MAV_CLASS_GENERIC_MISSION_NAVIGATION_ONLY = 6, ///< Generic autopilot supporting waypoints and other simple navigation commands MAV_CLASS_GENERIC_MISSION_FULL = 7, ///< Generic autopilot supporting the full mission command set + MAV_CLASS_NONE = 8, ///< No valid autopilot MAV_CLASS_NB ///< Number of autopilot classes }; @@ -101,7 +102,8 @@ enum MAV_NAV MAV_NAV_RETURNING, MAV_NAV_LANDING, MAV_NAV_LOST, - MAV_NAV_LOITER + MAV_NAV_LOITER, + MAV_NAV_FREE_DRIFT }; enum MAV_TYPE @@ -112,7 +114,12 @@ enum MAV_TYPE MAV_COAXIAL = 3, MAV_HELICOPTER = 4, MAV_GROUND = 5, - OCU = 6 + OCU = 6, + MAV_AIRSHIP = 7, + MAV_FREE_BALLOON = 8, + MAV_ROCKET = 9, + UGV_GROUND_ROVER = 10, + UGV_SURFACE_SHIP = 11 }; enum MAV_AUTOPILOT_TYPE @@ -120,7 +127,8 @@ enum MAV_AUTOPILOT_TYPE MAV_AUTOPILOT_GENERIC = 0, MAV_AUTOPILOT_PIXHAWK = 1, MAV_AUTOPILOT_SLUGS = 2, - MAV_AUTOPILOT_ARDUPILOTMEGA = 3 + MAV_AUTOPILOT_ARDUPILOTMEGA = 3, + MAV_AUTOPILOT_NONE = 4 }; enum MAV_COMPONENT @@ -133,6 +141,8 @@ enum MAV_COMPONENT MAV_COMP_ID_MAPPER, MAV_COMP_ID_CAMERA, MAV_COMP_ID_IMU = 200, + MAV_COMP_ID_IMU_2 = 201, + MAV_COMP_ID_IMU_3 = 202, MAV_COMP_ID_UDP_BRIDGE = 240, MAV_COMP_ID_UART_BRIDGE = 241, MAV_COMP_ID_SYSTEM_CONTROL = 250 @@ -143,7 +153,19 @@ enum MAV_FRAME MAV_FRAME_GLOBAL = 0, MAV_FRAME_LOCAL = 1, MAV_FRAME_MISSION = 2, - MAV_FRAME_GLOBAL_RELATIVE_ALT = 3 + MAV_FRAME_GLOBAL_RELATIVE_ALT = 3, + MAV_FRAME_LOCAL_ENU = 4 +}; + +enum MAVLINK_DATA_STREAM_TYPE +{ + MAVLINK_DATA_STREAM_IMG_JPEG, + MAVLINK_DATA_STREAM_IMG_BMP, + MAVLINK_DATA_STREAM_IMG_RAW8U, + MAVLINK_DATA_STREAM_IMG_RAW32U, + MAVLINK_DATA_STREAM_IMG_PGM, + MAVLINK_DATA_STREAM_IMG_PNG + }; #define MAVLINK_STX 0x55 ///< Packet start sign @@ -165,6 +187,7 @@ typedef struct __mavlink_system { uint8_t type; ///< Unused, can be used by user to store the system's type uint8_t state; ///< Unused, can be used by user to store the system's state uint8_t mode; ///< Unused, can be used by user to store the system's mode + uint8_t nav_mode; ///< Unused, can be used by user to store the system's navigation mode } mavlink_system_t; typedef struct __mavlink_message { diff --git a/thirdParty/mavlink/include/minimal/mavlink.h b/thirdParty/mavlink/include/minimal/mavlink.h new file mode 100644 index 0000000000000000000000000000000000000000..45a5e9566a8f66618fc3b88cc4469b032ebabc7b --- /dev/null +++ b/thirdParty/mavlink/include/minimal/mavlink.h @@ -0,0 +1,11 @@ +/** @file + * @brief MAVLink comm protocol. + * @see http://pixhawk.ethz.ch/software/mavlink + * Generated on Wednesday, July 27 2011, 14:17 UTC + */ +#ifndef MAVLINK_H +#define MAVLINK_H + +#include "minimal.h" + +#endif diff --git a/thirdParty/mavlink/include/minimal/mavlink_msg_heartbeat.h b/thirdParty/mavlink/include/minimal/mavlink_msg_heartbeat.h new file mode 100644 index 0000000000000000000000000000000000000000..0e5c4db5ca00fb627f2c5072cd8b2d1d7cbd02ad --- /dev/null +++ b/thirdParty/mavlink/include/minimal/mavlink_msg_heartbeat.h @@ -0,0 +1,132 @@ +// MESSAGE HEARTBEAT PACKING + +#define MAVLINK_MSG_ID_HEARTBEAT 0 + +typedef struct __mavlink_heartbeat_t +{ + uint8_t type; ///< Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) + uint8_t autopilot; ///< Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM + uint8_t mavlink_version; ///< MAVLink version + +} mavlink_heartbeat_t; + + + +/** + * @brief Pack a heartbeat message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param type Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) + * @param autopilot Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_heartbeat_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t type, uint8_t autopilot) +{ + uint16_t i = 0; + msg->msgid = MAVLINK_MSG_ID_HEARTBEAT; + + i += put_uint8_t_by_index(type, i, msg->payload); // Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) + i += put_uint8_t_by_index(autopilot, i, msg->payload); // Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM + i += put_uint8_t_by_index(2, i, msg->payload); // MAVLink version + + return mavlink_finalize_message(msg, system_id, component_id, i); +} + +/** + * @brief Pack a heartbeat message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message was sent over + * @param msg The MAVLink message to compress the data into + * @param type Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) + * @param autopilot Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_heartbeat_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t type, uint8_t autopilot) +{ + uint16_t i = 0; + msg->msgid = MAVLINK_MSG_ID_HEARTBEAT; + + i += put_uint8_t_by_index(type, i, msg->payload); // Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) + i += put_uint8_t_by_index(autopilot, i, msg->payload); // Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM + i += put_uint8_t_by_index(2, i, msg->payload); // MAVLink version + + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); +} + +/** + * @brief Encode a heartbeat struct into a message + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param heartbeat C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_heartbeat_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_heartbeat_t* heartbeat) +{ + return mavlink_msg_heartbeat_pack(system_id, component_id, msg, heartbeat->type, heartbeat->autopilot); +} + +/** + * @brief Send a heartbeat message + * @param chan MAVLink channel to send the message + * + * @param type Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) + * @param autopilot Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_heartbeat_send(mavlink_channel_t chan, uint8_t type, uint8_t autopilot) +{ + mavlink_message_t msg; + mavlink_msg_heartbeat_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, type, autopilot); + mavlink_send_uart(chan, &msg); +} + +#endif +// MESSAGE HEARTBEAT UNPACKING + +/** + * @brief Get field type from heartbeat message + * + * @return Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) + */ +static inline uint8_t mavlink_msg_heartbeat_get_type(const mavlink_message_t* msg) +{ + return (uint8_t)(msg->payload)[0]; +} + +/** + * @brief Get field autopilot from heartbeat message + * + * @return Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM + */ +static inline uint8_t mavlink_msg_heartbeat_get_autopilot(const mavlink_message_t* msg) +{ + return (uint8_t)(msg->payload+sizeof(uint8_t))[0]; +} + +/** + * @brief Get field mavlink_version from heartbeat message + * + * @return MAVLink version + */ +static inline uint8_t mavlink_msg_heartbeat_get_mavlink_version(const mavlink_message_t* msg) +{ + return (uint8_t)(msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[0]; +} + +/** + * @brief Decode a heartbeat message into a struct + * + * @param msg The message to decode + * @param heartbeat C-struct to decode the message contents into + */ +static inline void mavlink_msg_heartbeat_decode(const mavlink_message_t* msg, mavlink_heartbeat_t* heartbeat) +{ + heartbeat->type = mavlink_msg_heartbeat_get_type(msg); + heartbeat->autopilot = mavlink_msg_heartbeat_get_autopilot(msg); + heartbeat->mavlink_version = mavlink_msg_heartbeat_get_mavlink_version(msg); +} diff --git a/thirdParty/mavlink/include/minimal/minimal.h b/thirdParty/mavlink/include/minimal/minimal.h new file mode 100644 index 0000000000000000000000000000000000000000..61cd3fe22be39ed8f8bdaaf855398f3d7cce25d2 --- /dev/null +++ b/thirdParty/mavlink/include/minimal/minimal.h @@ -0,0 +1,45 @@ +/** @file + * @brief MAVLink comm protocol. + * @see http://qgroundcontrol.org/mavlink/ + * Generated on Wednesday, July 27 2011, 14:17 UTC + */ +#ifndef MINIMAL_H +#define MINIMAL_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "../protocol.h" + +#define MAVLINK_ENABLED_MINIMAL + +// MAVLINK VERSION + +#ifndef MAVLINK_VERSION +#define MAVLINK_VERSION 2 +#endif + +#if (MAVLINK_VERSION == 0) +#undef MAVLINK_VERSION +#define MAVLINK_VERSION 2 +#endif + +// ENUM DEFINITIONS + + +// MESSAGE DEFINITIONS + +#include "./mavlink_msg_heartbeat.h" + + +// MESSAGE LENGTHS + +#undef MAVLINK_MESSAGE_LENGTHS +#define MAVLINK_MESSAGE_LENGTHS { } + +#ifdef __cplusplus +} +#endif +#endif diff --git a/thirdParty/mavlink/include/pixhawk/mavlink.h b/thirdParty/mavlink/include/pixhawk/mavlink.h index 91159fccdd8c7e1034b50eb017a9c006a0a1cf41..16a37599e1fa218650bf065dbd66ec620892162c 100644 --- a/thirdParty/mavlink/include/pixhawk/mavlink.h +++ b/thirdParty/mavlink/include/pixhawk/mavlink.h @@ -1,7 +1,7 @@ /** @file * @brief MAVLink comm protocol. * @see http://pixhawk.ethz.ch/software/mavlink - * Generated on Thursday, March 31 2011, 22:06 UTC + * Generated on Wednesday, July 27 2011, 14:17 UTC */ #ifndef MAVLINK_H #define MAVLINK_H diff --git a/thirdParty/mavlink/include/pixhawk/mavlink_msg_image_available.h b/thirdParty/mavlink/include/pixhawk/mavlink_msg_image_available.h index 472449988b475b37aa28f60dc83bb0363d9c584b..b40e23df7b554477b32ea6803b25e051d3552b06 100644 --- a/thirdParty/mavlink/include/pixhawk/mavlink_msg_image_available.h +++ b/thirdParty/mavlink/include/pixhawk/mavlink_msg_image_available.h @@ -24,6 +24,9 @@ typedef struct __mavlink_image_available_t float lat; ///< GPS X coordinate float lon; ///< GPS Y coordinate float alt; ///< Global frame altitude + float ground_x; ///< Ground truth X + float ground_y; ///< Ground truth Y + float ground_z; ///< Ground truth Z } mavlink_image_available_t; @@ -55,9 +58,12 @@ typedef struct __mavlink_image_available_t * @param lat GPS X coordinate * @param lon GPS Y coordinate * @param alt Global frame altitude + * @param ground_x Ground truth X + * @param ground_y Ground truth Y + * @param ground_z Ground truth Z * @return length of the message in bytes (excluding serial stream start sign) */ -static inline uint16_t mavlink_msg_image_available_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t cam_id, uint8_t cam_no, uint64_t timestamp, uint64_t valid_until, uint32_t img_seq, uint32_t img_buf_index, uint16_t width, uint16_t height, uint16_t depth, uint8_t channels, uint32_t key, uint32_t exposure, float gain, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt) +static inline uint16_t mavlink_msg_image_available_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t cam_id, uint8_t cam_no, uint64_t timestamp, uint64_t valid_until, uint32_t img_seq, uint32_t img_buf_index, uint16_t width, uint16_t height, uint16_t depth, uint8_t channels, uint32_t key, uint32_t exposure, float gain, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt, float ground_x, float ground_y, float ground_z) { uint16_t i = 0; msg->msgid = MAVLINK_MSG_ID_IMAGE_AVAILABLE; @@ -82,6 +88,9 @@ static inline uint16_t mavlink_msg_image_available_pack(uint8_t system_id, uint8 i += put_float_by_index(lat, i, msg->payload); // GPS X coordinate i += put_float_by_index(lon, i, msg->payload); // GPS Y coordinate i += put_float_by_index(alt, i, msg->payload); // Global frame altitude + i += put_float_by_index(ground_x, i, msg->payload); // Ground truth X + i += put_float_by_index(ground_y, i, msg->payload); // Ground truth Y + i += put_float_by_index(ground_z, i, msg->payload); // Ground truth Z return mavlink_finalize_message(msg, system_id, component_id, i); } @@ -112,9 +121,12 @@ static inline uint16_t mavlink_msg_image_available_pack(uint8_t system_id, uint8 * @param lat GPS X coordinate * @param lon GPS Y coordinate * @param alt Global frame altitude + * @param ground_x Ground truth X + * @param ground_y Ground truth Y + * @param ground_z Ground truth Z * @return length of the message in bytes (excluding serial stream start sign) */ -static inline uint16_t mavlink_msg_image_available_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint64_t cam_id, uint8_t cam_no, uint64_t timestamp, uint64_t valid_until, uint32_t img_seq, uint32_t img_buf_index, uint16_t width, uint16_t height, uint16_t depth, uint8_t channels, uint32_t key, uint32_t exposure, float gain, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt) +static inline uint16_t mavlink_msg_image_available_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint64_t cam_id, uint8_t cam_no, uint64_t timestamp, uint64_t valid_until, uint32_t img_seq, uint32_t img_buf_index, uint16_t width, uint16_t height, uint16_t depth, uint8_t channels, uint32_t key, uint32_t exposure, float gain, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt, float ground_x, float ground_y, float ground_z) { uint16_t i = 0; msg->msgid = MAVLINK_MSG_ID_IMAGE_AVAILABLE; @@ -139,6 +151,9 @@ static inline uint16_t mavlink_msg_image_available_pack_chan(uint8_t system_id, i += put_float_by_index(lat, i, msg->payload); // GPS X coordinate i += put_float_by_index(lon, i, msg->payload); // GPS Y coordinate i += put_float_by_index(alt, i, msg->payload); // Global frame altitude + i += put_float_by_index(ground_x, i, msg->payload); // Ground truth X + i += put_float_by_index(ground_y, i, msg->payload); // Ground truth Y + i += put_float_by_index(ground_z, i, msg->payload); // Ground truth Z return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); } @@ -153,7 +168,7 @@ static inline uint16_t mavlink_msg_image_available_pack_chan(uint8_t system_id, */ static inline uint16_t mavlink_msg_image_available_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_image_available_t* image_available) { - return mavlink_msg_image_available_pack(system_id, component_id, msg, image_available->cam_id, image_available->cam_no, image_available->timestamp, image_available->valid_until, image_available->img_seq, image_available->img_buf_index, image_available->width, image_available->height, image_available->depth, image_available->channels, image_available->key, image_available->exposure, image_available->gain, image_available->roll, image_available->pitch, image_available->yaw, image_available->local_z, image_available->lat, image_available->lon, image_available->alt); + return mavlink_msg_image_available_pack(system_id, component_id, msg, image_available->cam_id, image_available->cam_no, image_available->timestamp, image_available->valid_until, image_available->img_seq, image_available->img_buf_index, image_available->width, image_available->height, image_available->depth, image_available->channels, image_available->key, image_available->exposure, image_available->gain, image_available->roll, image_available->pitch, image_available->yaw, image_available->local_z, image_available->lat, image_available->lon, image_available->alt, image_available->ground_x, image_available->ground_y, image_available->ground_z); } /** @@ -180,13 +195,16 @@ static inline uint16_t mavlink_msg_image_available_encode(uint8_t system_id, uin * @param lat GPS X coordinate * @param lon GPS Y coordinate * @param alt Global frame altitude + * @param ground_x Ground truth X + * @param ground_y Ground truth Y + * @param ground_z Ground truth Z */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_image_available_send(mavlink_channel_t chan, uint64_t cam_id, uint8_t cam_no, uint64_t timestamp, uint64_t valid_until, uint32_t img_seq, uint32_t img_buf_index, uint16_t width, uint16_t height, uint16_t depth, uint8_t channels, uint32_t key, uint32_t exposure, float gain, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt) +static inline void mavlink_msg_image_available_send(mavlink_channel_t chan, uint64_t cam_id, uint8_t cam_no, uint64_t timestamp, uint64_t valid_until, uint32_t img_seq, uint32_t img_buf_index, uint16_t width, uint16_t height, uint16_t depth, uint8_t channels, uint32_t key, uint32_t exposure, float gain, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt, float ground_x, float ground_y, float ground_z) { mavlink_message_t msg; - mavlink_msg_image_available_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, cam_id, cam_no, timestamp, valid_until, img_seq, img_buf_index, width, height, depth, channels, key, exposure, gain, roll, pitch, yaw, local_z, lat, lon, alt); + mavlink_msg_image_available_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, cam_id, cam_no, timestamp, valid_until, img_seq, img_buf_index, width, height, depth, channels, key, exposure, gain, roll, pitch, yaw, local_z, lat, lon, alt, ground_x, ground_y, ground_z); mavlink_send_uart(chan, &msg); } @@ -489,6 +507,51 @@ static inline float mavlink_msg_image_available_get_alt(const mavlink_message_t* return (float)r.f; } +/** + * @brief Get field ground_x from image_available message + * + * @return Ground truth X + */ +static inline float mavlink_msg_image_available_get_ground_x(const mavlink_message_t* msg) +{ + generic_32bit r; + r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0]; + r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1]; + r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2]; + r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3]; + return (float)r.f; +} + +/** + * @brief Get field ground_y from image_available message + * + * @return Ground truth Y + */ +static inline float mavlink_msg_image_available_get_ground_y(const mavlink_message_t* msg) +{ + generic_32bit r; + r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0]; + r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1]; + r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2]; + r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3]; + return (float)r.f; +} + +/** + * @brief Get field ground_z from image_available message + * + * @return Ground truth Z + */ +static inline float mavlink_msg_image_available_get_ground_z(const mavlink_message_t* msg) +{ + generic_32bit r; + r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0]; + r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1]; + r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2]; + r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(uint8_t)+sizeof(uint64_t)+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3]; + return (float)r.f; +} + /** * @brief Decode a image_available message into a struct * @@ -517,4 +580,7 @@ static inline void mavlink_msg_image_available_decode(const mavlink_message_t* m image_available->lat = mavlink_msg_image_available_get_lat(msg); image_available->lon = mavlink_msg_image_available_get_lon(msg); image_available->alt = mavlink_msg_image_available_get_alt(msg); + image_available->ground_x = mavlink_msg_image_available_get_ground_x(msg); + image_available->ground_y = mavlink_msg_image_available_get_ground_y(msg); + image_available->ground_z = mavlink_msg_image_available_get_ground_z(msg); } diff --git a/thirdParty/mavlink/include/pixhawk/mavlink_msg_image_triggered.h b/thirdParty/mavlink/include/pixhawk/mavlink_msg_image_triggered.h index 01f8a9203e2e7290bff9bfb034c4c10fcdb954cd..000003f3d73ba3239590a8701acc935877ea0dc2 100644 --- a/thirdParty/mavlink/include/pixhawk/mavlink_msg_image_triggered.h +++ b/thirdParty/mavlink/include/pixhawk/mavlink_msg_image_triggered.h @@ -13,6 +13,9 @@ typedef struct __mavlink_image_triggered_t float lat; ///< GPS X coordinate float lon; ///< GPS Y coordinate float alt; ///< Global frame altitude + float ground_x; ///< Ground truth X + float ground_y; ///< Ground truth Y + float ground_z; ///< Ground truth Z } mavlink_image_triggered_t; @@ -33,9 +36,12 @@ typedef struct __mavlink_image_triggered_t * @param lat GPS X coordinate * @param lon GPS Y coordinate * @param alt Global frame altitude + * @param ground_x Ground truth X + * @param ground_y Ground truth Y + * @param ground_z Ground truth Z * @return length of the message in bytes (excluding serial stream start sign) */ -static inline uint16_t mavlink_msg_image_triggered_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t timestamp, uint32_t seq, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt) +static inline uint16_t mavlink_msg_image_triggered_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t timestamp, uint32_t seq, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt, float ground_x, float ground_y, float ground_z) { uint16_t i = 0; msg->msgid = MAVLINK_MSG_ID_IMAGE_TRIGGERED; @@ -49,6 +55,9 @@ static inline uint16_t mavlink_msg_image_triggered_pack(uint8_t system_id, uint8 i += put_float_by_index(lat, i, msg->payload); // GPS X coordinate i += put_float_by_index(lon, i, msg->payload); // GPS Y coordinate i += put_float_by_index(alt, i, msg->payload); // Global frame altitude + i += put_float_by_index(ground_x, i, msg->payload); // Ground truth X + i += put_float_by_index(ground_y, i, msg->payload); // Ground truth Y + i += put_float_by_index(ground_z, i, msg->payload); // Ground truth Z return mavlink_finalize_message(msg, system_id, component_id, i); } @@ -68,9 +77,12 @@ static inline uint16_t mavlink_msg_image_triggered_pack(uint8_t system_id, uint8 * @param lat GPS X coordinate * @param lon GPS Y coordinate * @param alt Global frame altitude + * @param ground_x Ground truth X + * @param ground_y Ground truth Y + * @param ground_z Ground truth Z * @return length of the message in bytes (excluding serial stream start sign) */ -static inline uint16_t mavlink_msg_image_triggered_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint64_t timestamp, uint32_t seq, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt) +static inline uint16_t mavlink_msg_image_triggered_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint64_t timestamp, uint32_t seq, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt, float ground_x, float ground_y, float ground_z) { uint16_t i = 0; msg->msgid = MAVLINK_MSG_ID_IMAGE_TRIGGERED; @@ -84,6 +96,9 @@ static inline uint16_t mavlink_msg_image_triggered_pack_chan(uint8_t system_id, i += put_float_by_index(lat, i, msg->payload); // GPS X coordinate i += put_float_by_index(lon, i, msg->payload); // GPS Y coordinate i += put_float_by_index(alt, i, msg->payload); // Global frame altitude + i += put_float_by_index(ground_x, i, msg->payload); // Ground truth X + i += put_float_by_index(ground_y, i, msg->payload); // Ground truth Y + i += put_float_by_index(ground_z, i, msg->payload); // Ground truth Z return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); } @@ -98,7 +113,7 @@ static inline uint16_t mavlink_msg_image_triggered_pack_chan(uint8_t system_id, */ static inline uint16_t mavlink_msg_image_triggered_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_image_triggered_t* image_triggered) { - return mavlink_msg_image_triggered_pack(system_id, component_id, msg, image_triggered->timestamp, image_triggered->seq, image_triggered->roll, image_triggered->pitch, image_triggered->yaw, image_triggered->local_z, image_triggered->lat, image_triggered->lon, image_triggered->alt); + return mavlink_msg_image_triggered_pack(system_id, component_id, msg, image_triggered->timestamp, image_triggered->seq, image_triggered->roll, image_triggered->pitch, image_triggered->yaw, image_triggered->local_z, image_triggered->lat, image_triggered->lon, image_triggered->alt, image_triggered->ground_x, image_triggered->ground_y, image_triggered->ground_z); } /** @@ -114,13 +129,16 @@ static inline uint16_t mavlink_msg_image_triggered_encode(uint8_t system_id, uin * @param lat GPS X coordinate * @param lon GPS Y coordinate * @param alt Global frame altitude + * @param ground_x Ground truth X + * @param ground_y Ground truth Y + * @param ground_z Ground truth Z */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_image_triggered_send(mavlink_channel_t chan, uint64_t timestamp, uint32_t seq, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt) +static inline void mavlink_msg_image_triggered_send(mavlink_channel_t chan, uint64_t timestamp, uint32_t seq, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt, float ground_x, float ground_y, float ground_z) { mavlink_message_t msg; - mavlink_msg_image_triggered_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, timestamp, seq, roll, pitch, yaw, local_z, lat, lon, alt); + mavlink_msg_image_triggered_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, timestamp, seq, roll, pitch, yaw, local_z, lat, lon, alt, ground_x, ground_y, ground_z); mavlink_send_uart(chan, &msg); } @@ -266,6 +284,51 @@ static inline float mavlink_msg_image_triggered_get_alt(const mavlink_message_t* return (float)r.f; } +/** + * @brief Get field ground_x from image_triggered message + * + * @return Ground truth X + */ +static inline float mavlink_msg_image_triggered_get_ground_x(const mavlink_message_t* msg) +{ + generic_32bit r; + r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0]; + r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1]; + r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2]; + r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3]; + return (float)r.f; +} + +/** + * @brief Get field ground_y from image_triggered message + * + * @return Ground truth Y + */ +static inline float mavlink_msg_image_triggered_get_ground_y(const mavlink_message_t* msg) +{ + generic_32bit r; + r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0]; + r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1]; + r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2]; + r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3]; + return (float)r.f; +} + +/** + * @brief Get field ground_z from image_triggered message + * + * @return Ground truth Z + */ +static inline float mavlink_msg_image_triggered_get_ground_z(const mavlink_message_t* msg) +{ + generic_32bit r; + r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[0]; + r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[1]; + r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[2]; + r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(uint32_t)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float))[3]; + return (float)r.f; +} + /** * @brief Decode a image_triggered message into a struct * @@ -283,4 +346,7 @@ static inline void mavlink_msg_image_triggered_decode(const mavlink_message_t* m image_triggered->lat = mavlink_msg_image_triggered_get_lat(msg); image_triggered->lon = mavlink_msg_image_triggered_get_lon(msg); image_triggered->alt = mavlink_msg_image_triggered_get_alt(msg); + image_triggered->ground_x = mavlink_msg_image_triggered_get_ground_x(msg); + image_triggered->ground_y = mavlink_msg_image_triggered_get_ground_y(msg); + image_triggered->ground_z = mavlink_msg_image_triggered_get_ground_z(msg); } diff --git a/thirdParty/mavlink/include/pixhawk/mavlink_msg_vision_speed_estimate.h b/thirdParty/mavlink/include/pixhawk/mavlink_msg_vision_speed_estimate.h new file mode 100644 index 0000000000000000000000000000000000000000..66224c28e9e4487e3f8eb245985aefd824a3f914 --- /dev/null +++ b/thirdParty/mavlink/include/pixhawk/mavlink_msg_vision_speed_estimate.h @@ -0,0 +1,176 @@ +// MESSAGE VISION_SPEED_ESTIMATE PACKING + +#define MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE 113 + +typedef struct __mavlink_vision_speed_estimate_t +{ + uint64_t usec; ///< Timestamp (milliseconds) + float x; ///< Global X speed + float y; ///< Global Y speed + float z; ///< Global Z speed + +} mavlink_vision_speed_estimate_t; + + + +/** + * @brief Pack a vision_speed_estimate message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param usec Timestamp (milliseconds) + * @param x Global X speed + * @param y Global Y speed + * @param z Global Z speed + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_vision_speed_estimate_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t usec, float x, float y, float z) +{ + uint16_t i = 0; + msg->msgid = MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE; + + i += put_uint64_t_by_index(usec, i, msg->payload); // Timestamp (milliseconds) + i += put_float_by_index(x, i, msg->payload); // Global X speed + i += put_float_by_index(y, i, msg->payload); // Global Y speed + i += put_float_by_index(z, i, msg->payload); // Global Z speed + + return mavlink_finalize_message(msg, system_id, component_id, i); +} + +/** + * @brief Pack a vision_speed_estimate message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message was sent over + * @param msg The MAVLink message to compress the data into + * @param usec Timestamp (milliseconds) + * @param x Global X speed + * @param y Global Y speed + * @param z Global Z speed + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_vision_speed_estimate_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint64_t usec, float x, float y, float z) +{ + uint16_t i = 0; + msg->msgid = MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE; + + i += put_uint64_t_by_index(usec, i, msg->payload); // Timestamp (milliseconds) + i += put_float_by_index(x, i, msg->payload); // Global X speed + i += put_float_by_index(y, i, msg->payload); // Global Y speed + i += put_float_by_index(z, i, msg->payload); // Global Z speed + + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); +} + +/** + * @brief Encode a vision_speed_estimate struct into a message + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param vision_speed_estimate C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_vision_speed_estimate_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_vision_speed_estimate_t* vision_speed_estimate) +{ + return mavlink_msg_vision_speed_estimate_pack(system_id, component_id, msg, vision_speed_estimate->usec, vision_speed_estimate->x, vision_speed_estimate->y, vision_speed_estimate->z); +} + +/** + * @brief Send a vision_speed_estimate message + * @param chan MAVLink channel to send the message + * + * @param usec Timestamp (milliseconds) + * @param x Global X speed + * @param y Global Y speed + * @param z Global Z speed + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_vision_speed_estimate_send(mavlink_channel_t chan, uint64_t usec, float x, float y, float z) +{ + mavlink_message_t msg; + mavlink_msg_vision_speed_estimate_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, usec, x, y, z); + mavlink_send_uart(chan, &msg); +} + +#endif +// MESSAGE VISION_SPEED_ESTIMATE UNPACKING + +/** + * @brief Get field usec from vision_speed_estimate message + * + * @return Timestamp (milliseconds) + */ +static inline uint64_t mavlink_msg_vision_speed_estimate_get_usec(const mavlink_message_t* msg) +{ + generic_64bit r; + r.b[7] = (msg->payload)[0]; + r.b[6] = (msg->payload)[1]; + r.b[5] = (msg->payload)[2]; + r.b[4] = (msg->payload)[3]; + r.b[3] = (msg->payload)[4]; + r.b[2] = (msg->payload)[5]; + r.b[1] = (msg->payload)[6]; + r.b[0] = (msg->payload)[7]; + return (uint64_t)r.ll; +} + +/** + * @brief Get field x from vision_speed_estimate message + * + * @return Global X speed + */ +static inline float mavlink_msg_vision_speed_estimate_get_x(const mavlink_message_t* msg) +{ + generic_32bit r; + r.b[3] = (msg->payload+sizeof(uint64_t))[0]; + r.b[2] = (msg->payload+sizeof(uint64_t))[1]; + r.b[1] = (msg->payload+sizeof(uint64_t))[2]; + r.b[0] = (msg->payload+sizeof(uint64_t))[3]; + return (float)r.f; +} + +/** + * @brief Get field y from vision_speed_estimate message + * + * @return Global Y speed + */ +static inline float mavlink_msg_vision_speed_estimate_get_y(const mavlink_message_t* msg) +{ + generic_32bit r; + r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(float))[0]; + r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(float))[1]; + r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(float))[2]; + r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(float))[3]; + return (float)r.f; +} + +/** + * @brief Get field z from vision_speed_estimate message + * + * @return Global Z speed + */ +static inline float mavlink_msg_vision_speed_estimate_get_z(const mavlink_message_t* msg) +{ + generic_32bit r; + r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[0]; + r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[1]; + r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[2]; + r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[3]; + return (float)r.f; +} + +/** + * @brief Decode a vision_speed_estimate message into a struct + * + * @param msg The message to decode + * @param vision_speed_estimate C-struct to decode the message contents into + */ +static inline void mavlink_msg_vision_speed_estimate_decode(const mavlink_message_t* msg, mavlink_vision_speed_estimate_t* vision_speed_estimate) +{ + vision_speed_estimate->usec = mavlink_msg_vision_speed_estimate_get_usec(msg); + vision_speed_estimate->x = mavlink_msg_vision_speed_estimate_get_x(msg); + vision_speed_estimate->y = mavlink_msg_vision_speed_estimate_get_y(msg); + vision_speed_estimate->z = mavlink_msg_vision_speed_estimate_get_z(msg); +} diff --git a/thirdParty/mavlink/include/pixhawk/pixhawk.h b/thirdParty/mavlink/include/pixhawk/pixhawk.h index 92a89bee1b94caf1eb6a691904b5605e04feb0cd..30474d09cb8c1268d12d14fe373d79f0f06551a4 100644 --- a/thirdParty/mavlink/include/pixhawk/pixhawk.h +++ b/thirdParty/mavlink/include/pixhawk/pixhawk.h @@ -1,7 +1,7 @@ /** @file * @brief MAVLink comm protocol. - * @see http://pixhawk.ethz.ch/software/mavlink - * Generated on Thursday, March 31 2011, 22:06 UTC + * @see http://qgroundcontrol.org/mavlink/ + * Generated on Wednesday, July 27 2011, 14:17 UTC */ #ifndef PIXHAWK_H #define PIXHAWK_H @@ -30,16 +30,7 @@ extern "C" { // ENUM DEFINITIONS -/** @brief Slugs parameter interface subsets */ -enum SLUGS_PID_INDX_IDS -{ - PID_YAW_DAMPER=2, - PID_PITCH=3, /* With comment: PID Pitch parameter*/ - PID_ALT_HOLD=50, - SLUGS_PID_INDX_IDS_ENUM_END -}; - -/** @brief Content Types for data transmission handshake */ +/** @brief Content Types for data transmission handshake */ enum DATA_TYPES { DATA_TYPE_JPEG_IMAGE=1, @@ -58,6 +49,7 @@ enum DATA_TYPES #include "./mavlink_msg_image_available.h" #include "./mavlink_msg_vision_position_estimate.h" #include "./mavlink_msg_vicon_position_estimate.h" +#include "./mavlink_msg_vision_speed_estimate.h" #include "./mavlink_msg_position_control_setpoint_set.h" #include "./mavlink_msg_position_control_offset_set.h" #include "./mavlink_msg_position_control_setpoint.h" @@ -74,6 +66,13 @@ enum DATA_TYPES #include "./mavlink_msg_data_transmission_handshake.h" #include "./mavlink_msg_encapsulated_data.h" #include "./mavlink_msg_brief_feature.h" + + +// MESSAGE LENGTHS + +#undef MAVLINK_MESSAGE_LENGTHS +#define MAVLINK_MESSAGE_LENGTHS { 3, 4, 8, 14, 8, 28, 3, 32, 0, 2, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 19, 2, 23, 21, 0, 37, 26, 101, 26, 16, 32, 32, 37, 32, 11, 17, 17, 16, 18, 36, 4, 4, 2, 2, 4, 2, 2, 3, 14, 12, 18, 16, 8, 27, 25, 0, 0, 0, 0, 0, 5, 5, 26, 16, 36, 5, 6, 0, 0, 21, 0, 0, 0, 18, 20, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 52, 1, 92, 0, 0, 0, 0, 0, 0, 0, 32, 32, 20, 0, 0, 0, 0, 0, 0, 20, 18, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 12, 0, 0, 0, 0, 0, 0, 0, 4, 255, 12, 6, 18, 0, 0, 0, 0, 0, 106, 42, 54, 0, 0, 0, 0, 0, 0, 0, 8, 255, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 14, 14, 51 } + #ifdef __cplusplus } #endif diff --git a/thirdParty/mavlink/include/slugs/mavlink.h b/thirdParty/mavlink/include/slugs/mavlink.h index 2a1fb06684bbc14eb75745ec146085305dda21ac..bf0e146b4c4ac71ac936d8deb85044d42555ee1c 100644 --- a/thirdParty/mavlink/include/slugs/mavlink.h +++ b/thirdParty/mavlink/include/slugs/mavlink.h @@ -1,7 +1,7 @@ /** @file * @brief MAVLink comm protocol. * @see http://pixhawk.ethz.ch/software/mavlink - * Generated on Thursday, March 31 2011, 22:06 UTC + * Generated on Wednesday, July 27 2011, 14:17 UTC */ #ifndef MAVLINK_H #define MAVLINK_H diff --git a/thirdParty/mavlink/include/slugs/slugs.h b/thirdParty/mavlink/include/slugs/slugs.h index fe792c6800ebb1824a504fa0b516f423e3c27112..b8a6ff330ac6767501f59b0c042cd7b9966b3ab3 100644 --- a/thirdParty/mavlink/include/slugs/slugs.h +++ b/thirdParty/mavlink/include/slugs/slugs.h @@ -1,7 +1,7 @@ /** @file * @brief MAVLink comm protocol. - * @see http://pixhawk.ethz.ch/software/mavlink - * Generated on Thursday, March 31 2011, 22:06 UTC + * @see http://qgroundcontrol.org/mavlink/ + * Generated on Wednesday, July 27 2011, 14:17 UTC */ #ifndef SLUGS_H #define SLUGS_H @@ -43,6 +43,13 @@ extern "C" { #include "./mavlink_msg_mid_lvl_cmds.h" #include "./mavlink_msg_ctrl_srfc_pt.h" #include "./mavlink_msg_slugs_action.h" + + +// MESSAGE LENGTHS + +#undef MAVLINK_MESSAGE_LENGTHS +#define MAVLINK_MESSAGE_LENGTHS { 3, 4, 8, 14, 8, 28, 3, 32, 0, 2, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 19, 2, 23, 21, 0, 37, 26, 101, 26, 16, 32, 32, 37, 32, 11, 17, 17, 16, 18, 36, 4, 4, 2, 2, 4, 2, 2, 3, 14, 12, 18, 16, 8, 27, 25, 0, 0, 0, 0, 0, 5, 5, 26, 16, 36, 5, 6, 0, 0, 21, 0, 0, 0, 18, 20, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 10, 24, 18, 0, 0, 30, 24, 0, 7, 13, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 14, 14, 51 } + #ifdef __cplusplus } #endif diff --git a/thirdParty/mavlink/include/ualberta/mavlink.h b/thirdParty/mavlink/include/ualberta/mavlink.h index 8d850dff6eb9cf029cb3bafbd2014f5ee82b1df4..30b060f630050f4b68a710e97ca0c3eed2ca0e9b 100644 --- a/thirdParty/mavlink/include/ualberta/mavlink.h +++ b/thirdParty/mavlink/include/ualberta/mavlink.h @@ -1,7 +1,7 @@ /** @file * @brief MAVLink comm protocol. * @see http://pixhawk.ethz.ch/software/mavlink - * Generated on Thursday, March 31 2011, 22:06 UTC + * Generated on Wednesday, July 27 2011, 14:17 UTC */ #ifndef MAVLINK_H #define MAVLINK_H diff --git a/thirdParty/mavlink/include/ualberta/mavlink_msg_radio_calibration.h b/thirdParty/mavlink/include/ualberta/mavlink_msg_radio_calibration.h index 7a599ac714bdedbf6f7846aac42663724bfa756e..5907aba95bce713210549cfd6e452da1346c20fc 100644 --- a/thirdParty/mavlink/include/ualberta/mavlink_msg_radio_calibration.h +++ b/thirdParty/mavlink/include/ualberta/mavlink_msg_radio_calibration.h @@ -1,15 +1,15 @@ // MESSAGE RADIO_CALIBRATION PACKING -#define MAVLINK_MSG_ID_RADIO_CALIBRATION 222 +#define MAVLINK_MSG_ID_RADIO_CALIBRATION 221 typedef struct __mavlink_radio_calibration_t { - float aileron[3]; ///< Aileron setpoints: high, center, low - float elevator[3]; ///< Elevator setpoints: high, center, low - float rudder[3]; ///< Rudder setpoints: high, center, low - float gyro[2]; ///< Tail gyro mode/gain setpoints: heading hold, rate mode - float pitch[5]; ///< Pitch curve setpoints (every 25%) - float throttle[5]; ///< Throttle curve setpoints (every 25%) + uint16_t aileron[3]; ///< Aileron setpoints: left, center, right + uint16_t elevator[3]; ///< Elevator setpoints: nose down, center, nose up + uint16_t rudder[3]; ///< Rudder setpoints: nose left, center, nose right + uint16_t gyro[2]; ///< Tail gyro mode/gain setpoints: heading hold, rate mode + uint16_t pitch[5]; ///< Pitch curve setpoints (every 25%) + uint16_t throttle[5]; ///< Throttle curve setpoints (every 25%) } mavlink_radio_calibration_t; @@ -27,25 +27,25 @@ typedef struct __mavlink_radio_calibration_t * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * - * @param aileron Aileron setpoints: high, center, low - * @param elevator Elevator setpoints: high, center, low - * @param rudder Rudder setpoints: high, center, low + * @param aileron Aileron setpoints: left, center, right + * @param elevator Elevator setpoints: nose down, center, nose up + * @param rudder Rudder setpoints: nose left, center, nose right * @param gyro Tail gyro mode/gain setpoints: heading hold, rate mode * @param pitch Pitch curve setpoints (every 25%) * @param throttle Throttle curve setpoints (every 25%) * @return length of the message in bytes (excluding serial stream start sign) */ -static inline uint16_t mavlink_msg_radio_calibration_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const float* aileron, const float* elevator, const float* rudder, const float* gyro, const float* pitch, const float* throttle) +static inline uint16_t mavlink_msg_radio_calibration_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const uint16_t* aileron, const uint16_t* elevator, const uint16_t* rudder, const uint16_t* gyro, const uint16_t* pitch, const uint16_t* throttle) { uint16_t i = 0; msg->msgid = MAVLINK_MSG_ID_RADIO_CALIBRATION; - i += put_array_by_index((const int8_t*)aileron, sizeof(float)*3, i, msg->payload); // Aileron setpoints: high, center, low - i += put_array_by_index((const int8_t*)elevator, sizeof(float)*3, i, msg->payload); // Elevator setpoints: high, center, low - i += put_array_by_index((const int8_t*)rudder, sizeof(float)*3, i, msg->payload); // Rudder setpoints: high, center, low - i += put_array_by_index((const int8_t*)gyro, sizeof(float)*2, i, msg->payload); // Tail gyro mode/gain setpoints: heading hold, rate mode - i += put_array_by_index((const int8_t*)pitch, sizeof(float)*5, i, msg->payload); // Pitch curve setpoints (every 25%) - i += put_array_by_index((const int8_t*)throttle, sizeof(float)*5, i, msg->payload); // Throttle curve setpoints (every 25%) + i += put_array_by_index((const int8_t*)aileron, sizeof(uint16_t)*3, i, msg->payload); // Aileron setpoints: left, center, right + i += put_array_by_index((const int8_t*)elevator, sizeof(uint16_t)*3, i, msg->payload); // Elevator setpoints: nose down, center, nose up + i += put_array_by_index((const int8_t*)rudder, sizeof(uint16_t)*3, i, msg->payload); // Rudder setpoints: nose left, center, nose right + i += put_array_by_index((const int8_t*)gyro, sizeof(uint16_t)*2, i, msg->payload); // Tail gyro mode/gain setpoints: heading hold, rate mode + i += put_array_by_index((const int8_t*)pitch, sizeof(uint16_t)*5, i, msg->payload); // Pitch curve setpoints (every 25%) + i += put_array_by_index((const int8_t*)throttle, sizeof(uint16_t)*5, i, msg->payload); // Throttle curve setpoints (every 25%) return mavlink_finalize_message(msg, system_id, component_id, i); } @@ -56,25 +56,25 @@ static inline uint16_t mavlink_msg_radio_calibration_pack(uint8_t system_id, uin * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message was sent over * @param msg The MAVLink message to compress the data into - * @param aileron Aileron setpoints: high, center, low - * @param elevator Elevator setpoints: high, center, low - * @param rudder Rudder setpoints: high, center, low + * @param aileron Aileron setpoints: left, center, right + * @param elevator Elevator setpoints: nose down, center, nose up + * @param rudder Rudder setpoints: nose left, center, nose right * @param gyro Tail gyro mode/gain setpoints: heading hold, rate mode * @param pitch Pitch curve setpoints (every 25%) * @param throttle Throttle curve setpoints (every 25%) * @return length of the message in bytes (excluding serial stream start sign) */ -static inline uint16_t mavlink_msg_radio_calibration_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const float* aileron, const float* elevator, const float* rudder, const float* gyro, const float* pitch, const float* throttle) +static inline uint16_t mavlink_msg_radio_calibration_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const uint16_t* aileron, const uint16_t* elevator, const uint16_t* rudder, const uint16_t* gyro, const uint16_t* pitch, const uint16_t* throttle) { uint16_t i = 0; msg->msgid = MAVLINK_MSG_ID_RADIO_CALIBRATION; - i += put_array_by_index((const int8_t*)aileron, sizeof(float)*3, i, msg->payload); // Aileron setpoints: high, center, low - i += put_array_by_index((const int8_t*)elevator, sizeof(float)*3, i, msg->payload); // Elevator setpoints: high, center, low - i += put_array_by_index((const int8_t*)rudder, sizeof(float)*3, i, msg->payload); // Rudder setpoints: high, center, low - i += put_array_by_index((const int8_t*)gyro, sizeof(float)*2, i, msg->payload); // Tail gyro mode/gain setpoints: heading hold, rate mode - i += put_array_by_index((const int8_t*)pitch, sizeof(float)*5, i, msg->payload); // Pitch curve setpoints (every 25%) - i += put_array_by_index((const int8_t*)throttle, sizeof(float)*5, i, msg->payload); // Throttle curve setpoints (every 25%) + i += put_array_by_index((const int8_t*)aileron, sizeof(uint16_t)*3, i, msg->payload); // Aileron setpoints: left, center, right + i += put_array_by_index((const int8_t*)elevator, sizeof(uint16_t)*3, i, msg->payload); // Elevator setpoints: nose down, center, nose up + i += put_array_by_index((const int8_t*)rudder, sizeof(uint16_t)*3, i, msg->payload); // Rudder setpoints: nose left, center, nose right + i += put_array_by_index((const int8_t*)gyro, sizeof(uint16_t)*2, i, msg->payload); // Tail gyro mode/gain setpoints: heading hold, rate mode + i += put_array_by_index((const int8_t*)pitch, sizeof(uint16_t)*5, i, msg->payload); // Pitch curve setpoints (every 25%) + i += put_array_by_index((const int8_t*)throttle, sizeof(uint16_t)*5, i, msg->payload); // Throttle curve setpoints (every 25%) return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); } @@ -96,16 +96,16 @@ static inline uint16_t mavlink_msg_radio_calibration_encode(uint8_t system_id, u * @brief Send a radio_calibration message * @param chan MAVLink channel to send the message * - * @param aileron Aileron setpoints: high, center, low - * @param elevator Elevator setpoints: high, center, low - * @param rudder Rudder setpoints: high, center, low + * @param aileron Aileron setpoints: left, center, right + * @param elevator Elevator setpoints: nose down, center, nose up + * @param rudder Rudder setpoints: nose left, center, nose right * @param gyro Tail gyro mode/gain setpoints: heading hold, rate mode * @param pitch Pitch curve setpoints (every 25%) * @param throttle Throttle curve setpoints (every 25%) */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_radio_calibration_send(mavlink_channel_t chan, const float* aileron, const float* elevator, const float* rudder, const float* gyro, const float* pitch, const float* throttle) +static inline void mavlink_msg_radio_calibration_send(mavlink_channel_t chan, const uint16_t* aileron, const uint16_t* elevator, const uint16_t* rudder, const uint16_t* gyro, const uint16_t* pitch, const uint16_t* throttle) { mavlink_message_t msg; mavlink_msg_radio_calibration_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, aileron, elevator, rudder, gyro, pitch, throttle); @@ -118,37 +118,37 @@ static inline void mavlink_msg_radio_calibration_send(mavlink_channel_t chan, co /** * @brief Get field aileron from radio_calibration message * - * @return Aileron setpoints: high, center, low + * @return Aileron setpoints: left, center, right */ -static inline uint16_t mavlink_msg_radio_calibration_get_aileron(const mavlink_message_t* msg, float* r_data) +static inline uint16_t mavlink_msg_radio_calibration_get_aileron(const mavlink_message_t* msg, uint16_t* r_data) { - memcpy(r_data, msg->payload, sizeof(float)*3); - return sizeof(float)*3; + memcpy(r_data, msg->payload, sizeof(uint16_t)*3); + return sizeof(uint16_t)*3; } /** * @brief Get field elevator from radio_calibration message * - * @return Elevator setpoints: high, center, low + * @return Elevator setpoints: nose down, center, nose up */ -static inline uint16_t mavlink_msg_radio_calibration_get_elevator(const mavlink_message_t* msg, float* r_data) +static inline uint16_t mavlink_msg_radio_calibration_get_elevator(const mavlink_message_t* msg, uint16_t* r_data) { - memcpy(r_data, msg->payload+sizeof(float)*3, sizeof(float)*3); - return sizeof(float)*3; + memcpy(r_data, msg->payload+sizeof(uint16_t)*3, sizeof(uint16_t)*3); + return sizeof(uint16_t)*3; } /** * @brief Get field rudder from radio_calibration message * - * @return Rudder setpoints: high, center, low + * @return Rudder setpoints: nose left, center, nose right */ -static inline uint16_t mavlink_msg_radio_calibration_get_rudder(const mavlink_message_t* msg, float* r_data) +static inline uint16_t mavlink_msg_radio_calibration_get_rudder(const mavlink_message_t* msg, uint16_t* r_data) { - memcpy(r_data, msg->payload+sizeof(float)*3+sizeof(float)*3, sizeof(float)*3); - return sizeof(float)*3; + memcpy(r_data, msg->payload+sizeof(uint16_t)*3+sizeof(uint16_t)*3, sizeof(uint16_t)*3); + return sizeof(uint16_t)*3; } /** @@ -156,11 +156,11 @@ static inline uint16_t mavlink_msg_radio_calibration_get_rudder(const mavlink_me * * @return Tail gyro mode/gain setpoints: heading hold, rate mode */ -static inline uint16_t mavlink_msg_radio_calibration_get_gyro(const mavlink_message_t* msg, float* r_data) +static inline uint16_t mavlink_msg_radio_calibration_get_gyro(const mavlink_message_t* msg, uint16_t* r_data) { - memcpy(r_data, msg->payload+sizeof(float)*3+sizeof(float)*3+sizeof(float)*3, sizeof(float)*2); - return sizeof(float)*2; + memcpy(r_data, msg->payload+sizeof(uint16_t)*3+sizeof(uint16_t)*3+sizeof(uint16_t)*3, sizeof(uint16_t)*2); + return sizeof(uint16_t)*2; } /** @@ -168,11 +168,11 @@ static inline uint16_t mavlink_msg_radio_calibration_get_gyro(const mavlink_mess * * @return Pitch curve setpoints (every 25%) */ -static inline uint16_t mavlink_msg_radio_calibration_get_pitch(const mavlink_message_t* msg, float* r_data) +static inline uint16_t mavlink_msg_radio_calibration_get_pitch(const mavlink_message_t* msg, uint16_t* r_data) { - memcpy(r_data, msg->payload+sizeof(float)*3+sizeof(float)*3+sizeof(float)*3+sizeof(float)*2, sizeof(float)*5); - return sizeof(float)*5; + memcpy(r_data, msg->payload+sizeof(uint16_t)*3+sizeof(uint16_t)*3+sizeof(uint16_t)*3+sizeof(uint16_t)*2, sizeof(uint16_t)*5); + return sizeof(uint16_t)*5; } /** @@ -180,11 +180,11 @@ static inline uint16_t mavlink_msg_radio_calibration_get_pitch(const mavlink_mes * * @return Throttle curve setpoints (every 25%) */ -static inline uint16_t mavlink_msg_radio_calibration_get_throttle(const mavlink_message_t* msg, float* r_data) +static inline uint16_t mavlink_msg_radio_calibration_get_throttle(const mavlink_message_t* msg, uint16_t* r_data) { - memcpy(r_data, msg->payload+sizeof(float)*3+sizeof(float)*3+sizeof(float)*3+sizeof(float)*2+sizeof(float)*5, sizeof(float)*5); - return sizeof(float)*5; + memcpy(r_data, msg->payload+sizeof(uint16_t)*3+sizeof(uint16_t)*3+sizeof(uint16_t)*3+sizeof(uint16_t)*2+sizeof(uint16_t)*5, sizeof(uint16_t)*5); + return sizeof(uint16_t)*5; } /** diff --git a/thirdParty/mavlink/include/ualberta/mavlink_msg_ualberta_sys_status.h b/thirdParty/mavlink/include/ualberta/mavlink_msg_ualberta_sys_status.h new file mode 100644 index 0000000000000000000000000000000000000000..50e8f7d02ca58dccec28614af2fed7d4fe0c1466 --- /dev/null +++ b/thirdParty/mavlink/include/ualberta/mavlink_msg_ualberta_sys_status.h @@ -0,0 +1,135 @@ +// MESSAGE UALBERTA_SYS_STATUS PACKING + +#define MAVLINK_MSG_ID_UALBERTA_SYS_STATUS 222 + +typedef struct __mavlink_ualberta_sys_status_t +{ + uint8_t mode; ///< System mode, see UALBERTA_AUTOPILOT_MODE ENUM + uint8_t nav_mode; ///< Navigation mode, see UALBERTA_NAV_MODE ENUM + uint8_t pilot; ///< Pilot mode, see UALBERTA_PILOT_MODE + +} mavlink_ualberta_sys_status_t; + + + +/** + * @brief Pack a ualberta_sys_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param mode System mode, see UALBERTA_AUTOPILOT_MODE ENUM + * @param nav_mode Navigation mode, see UALBERTA_NAV_MODE ENUM + * @param pilot Pilot mode, see UALBERTA_PILOT_MODE + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_ualberta_sys_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t mode, uint8_t nav_mode, uint8_t pilot) +{ + uint16_t i = 0; + msg->msgid = MAVLINK_MSG_ID_UALBERTA_SYS_STATUS; + + i += put_uint8_t_by_index(mode, i, msg->payload); // System mode, see UALBERTA_AUTOPILOT_MODE ENUM + i += put_uint8_t_by_index(nav_mode, i, msg->payload); // Navigation mode, see UALBERTA_NAV_MODE ENUM + i += put_uint8_t_by_index(pilot, i, msg->payload); // Pilot mode, see UALBERTA_PILOT_MODE + + return mavlink_finalize_message(msg, system_id, component_id, i); +} + +/** + * @brief Pack a ualberta_sys_status message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message was sent over + * @param msg The MAVLink message to compress the data into + * @param mode System mode, see UALBERTA_AUTOPILOT_MODE ENUM + * @param nav_mode Navigation mode, see UALBERTA_NAV_MODE ENUM + * @param pilot Pilot mode, see UALBERTA_PILOT_MODE + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_ualberta_sys_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t mode, uint8_t nav_mode, uint8_t pilot) +{ + uint16_t i = 0; + msg->msgid = MAVLINK_MSG_ID_UALBERTA_SYS_STATUS; + + i += put_uint8_t_by_index(mode, i, msg->payload); // System mode, see UALBERTA_AUTOPILOT_MODE ENUM + i += put_uint8_t_by_index(nav_mode, i, msg->payload); // Navigation mode, see UALBERTA_NAV_MODE ENUM + i += put_uint8_t_by_index(pilot, i, msg->payload); // Pilot mode, see UALBERTA_PILOT_MODE + + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); +} + +/** + * @brief Encode a ualberta_sys_status struct into a message + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param ualberta_sys_status C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_ualberta_sys_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ualberta_sys_status_t* ualberta_sys_status) +{ + return mavlink_msg_ualberta_sys_status_pack(system_id, component_id, msg, ualberta_sys_status->mode, ualberta_sys_status->nav_mode, ualberta_sys_status->pilot); +} + +/** + * @brief Send a ualberta_sys_status message + * @param chan MAVLink channel to send the message + * + * @param mode System mode, see UALBERTA_AUTOPILOT_MODE ENUM + * @param nav_mode Navigation mode, see UALBERTA_NAV_MODE ENUM + * @param pilot Pilot mode, see UALBERTA_PILOT_MODE + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_ualberta_sys_status_send(mavlink_channel_t chan, uint8_t mode, uint8_t nav_mode, uint8_t pilot) +{ + mavlink_message_t msg; + mavlink_msg_ualberta_sys_status_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, mode, nav_mode, pilot); + mavlink_send_uart(chan, &msg); +} + +#endif +// MESSAGE UALBERTA_SYS_STATUS UNPACKING + +/** + * @brief Get field mode from ualberta_sys_status message + * + * @return System mode, see UALBERTA_AUTOPILOT_MODE ENUM + */ +static inline uint8_t mavlink_msg_ualberta_sys_status_get_mode(const mavlink_message_t* msg) +{ + return (uint8_t)(msg->payload)[0]; +} + +/** + * @brief Get field nav_mode from ualberta_sys_status message + * + * @return Navigation mode, see UALBERTA_NAV_MODE ENUM + */ +static inline uint8_t mavlink_msg_ualberta_sys_status_get_nav_mode(const mavlink_message_t* msg) +{ + return (uint8_t)(msg->payload+sizeof(uint8_t))[0]; +} + +/** + * @brief Get field pilot from ualberta_sys_status message + * + * @return Pilot mode, see UALBERTA_PILOT_MODE + */ +static inline uint8_t mavlink_msg_ualberta_sys_status_get_pilot(const mavlink_message_t* msg) +{ + return (uint8_t)(msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[0]; +} + +/** + * @brief Decode a ualberta_sys_status message into a struct + * + * @param msg The message to decode + * @param ualberta_sys_status C-struct to decode the message contents into + */ +static inline void mavlink_msg_ualberta_sys_status_decode(const mavlink_message_t* msg, mavlink_ualberta_sys_status_t* ualberta_sys_status) +{ + ualberta_sys_status->mode = mavlink_msg_ualberta_sys_status_get_mode(msg); + ualberta_sys_status->nav_mode = mavlink_msg_ualberta_sys_status_get_nav_mode(msg); + ualberta_sys_status->pilot = mavlink_msg_ualberta_sys_status_get_pilot(msg); +} diff --git a/thirdParty/mavlink/include/ualberta/ualberta.h b/thirdParty/mavlink/include/ualberta/ualberta.h index e9f238b802f0d3dd10f91c65d0e28b17f34e4013..b492ff62d65eead6b12bd73363dcbb4b22791ae2 100644 --- a/thirdParty/mavlink/include/ualberta/ualberta.h +++ b/thirdParty/mavlink/include/ualberta/ualberta.h @@ -1,7 +1,7 @@ /** @file * @brief MAVLink comm protocol. - * @see http://pixhawk.ethz.ch/software/mavlink - * Generated on Thursday, March 31 2011, 22:06 UTC + * @see http://qgroundcontrol.org/mavlink/ + * Generated on Wednesday, July 27 2011, 14:17 UTC */ #ifndef UALBERTA_H #define UALBERTA_H @@ -30,12 +30,49 @@ extern "C" { // ENUM DEFINITIONS +/** @brief Available autopilot modes for ualberta uav */ +enum UALBERTA_AUTOPILOT_MODE +{ + MODE_MANUAL_DIRECT=0, /* */ + MODE_MANUAL_SCALED=1, /* */ + MODE_AUTO_PID_ATT=2, /* */ + MODE_AUTO_PID_VEL=3, /* */ + MODE_AUTO_PID_POS=4, /* */ + UALBERTA_AUTOPILOT_MODE_ENUM_END +}; + +/** @brief Navigation filter mode */ +enum UALBERTA_NAV_MODE +{ + NAV_AHRS_INIT=0, + NAV_AHRS=1, /* */ + NAV_INS_GPS_INIT=2, /* */ + NAV_INS_GPS=3, /* */ + UALBERTA_NAV_MODE_ENUM_END +}; + +/** @brief Mode currently commanded by pilot */ +enum UALBERTA_PILOT_MODE +{ + PILOT_MANUAL=0, /* */ + PILOT_AUTO=1, /* */ + PILOT_ROTO=2, /* */ + UALBERTA_PILOT_MODE_ENUM_END +}; + // MESSAGE DEFINITIONS #include "./mavlink_msg_nav_filter_bias.h" -#include "./mavlink_msg_request_rc_channels.h" #include "./mavlink_msg_radio_calibration.h" +#include "./mavlink_msg_ualberta_sys_status.h" + + +// MESSAGE LENGTHS + +#undef MAVLINK_MESSAGE_LENGTHS +#define MAVLINK_MESSAGE_LENGTHS { 3, 4, 8, 14, 8, 28, 3, 32, 0, 2, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 19, 2, 23, 21, 0, 37, 26, 101, 26, 16, 32, 32, 37, 32, 11, 17, 17, 16, 18, 36, 4, 4, 2, 2, 4, 2, 2, 3, 14, 12, 18, 16, 8, 27, 25, 0, 0, 0, 0, 0, 5, 5, 26, 16, 36, 5, 6, 0, 0, 21, 0, 0, 0, 18, 20, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 14, 14, 51 } + #ifdef __cplusplus } #endif diff --git a/thirdParty/mavlink/message_definitions/common.xml b/thirdParty/mavlink/message_definitions/common.xml index 85e0df66e340bd8447dd4432c0d8edd47d715262..5df9ba827ee9112b0755dd4ece6918f48a71bbb7 100644 --- a/thirdParty/mavlink/message_definitions/common.xml +++ b/thirdParty/mavlink/message_definitions/common.xml @@ -79,17 +79,21 @@ Longitude Altitude - - Set the location the system should be heading towards (camera heads or - rotary wing aircraft). - Empty - Empty - Empty + + + Sets the region of interest (ROI) for a sensor set or the + vehicle itself. This can then be used by the vehicles control + system to control the vehicle attitude and the attitude of various + sensors such as cameras. + Region of intereset mode. (see MAV_ROI enum) + Waypoint index/ target ID. (see MAV_ROI enum) + ROI index (allows a vehicle to manage multiple ROI's) Empty - Latitude - Longitude - Altitude + x the location of the fixed ROI (see MAV_FRAME) + y + z + Control autonomous path planning on the MAV. 0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning @@ -306,6 +310,18 @@ Dependent on the autopilot Dependent on the autopilot + + + The ROI (region of interest) for the vehicle. This can be + be used by the vehicle for camera/vehicle attitude alignment (see + MAV_CMD_NAV_ROI). + + Point toward next waypoint. + Point toward given waypoint. + Point toward fixed location. + Point toward of given id. + + diff --git a/thirdParty/mavlink/message_definitions/minimal.xml b/thirdParty/mavlink/message_definitions/minimal.xml new file mode 100644 index 0000000000000000000000000000000000000000..16d26831e165d7c8ff3410cbab22accfd34311ca --- /dev/null +++ b/thirdParty/mavlink/message_definitions/minimal.xml @@ -0,0 +1,13 @@ + + + 2 + + + + The heartbeat message shows that a system is present and responding. The type of the MAV and Autopilot hardware allow the receiving system to treat further messages from this system appropriate (e.g. by laying out the user interface based on the autopilot). + Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) + Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM + MAVLink version + + + diff --git a/thirdParty/mavlink/message_definitions/pixhawk.xml b/thirdParty/mavlink/message_definitions/pixhawk.xml index 55e53205aa084fa8c7d1dd7292e5360b4687db48..e2a99a738b666758d65670e47de52f181422b5ac 100644 --- a/thirdParty/mavlink/message_definitions/pixhawk.xml +++ b/thirdParty/mavlink/message_definitions/pixhawk.xml @@ -3,18 +3,14 @@ common.xml - - Slugs parameter interface subsets - - With comment: PID Pitch parameter - - - Content Types for data transmission handshake - - - + + + + + + @@ -50,6 +46,9 @@ GPS X coordinate GPS Y coordinate Global frame altitude + Ground truth X + Ground truth Y + Ground truth Z @@ -77,6 +76,9 @@ GPS X coordinate GPS Y coordinate Global frame altitude + Ground truth X + Ground truth Y + Ground truth Z @@ -99,6 +101,13 @@ Yaw angle in rad + + Timestamp (milliseconds) + Global X speed + Global Y speed + Global Z speed + + Message sent to the MAV to set a new position as reference for the controller System ID diff --git a/thirdParty/mavlink/message_definitions/ualberta.xml b/thirdParty/mavlink/message_definitions/ualberta.xml index ef28d6e9149516ce156916f0559db5c8ed0c464e..eaa9d99844835df716665ef893d0bbcac5d47445 100644 --- a/thirdParty/mavlink/message_definitions/ualberta.xml +++ b/thirdParty/mavlink/message_definitions/ualberta.xml @@ -1,29 +1,54 @@ - + - common.xml - - - Accelerometer and Gyro biases from the navigation filter - Timestamp (microseconds) - b_f[0] - b_f[1] - b_f[2] - b_f[0] - b_f[1] - b_f[2] - - - Request raw and normalized rc data from the UAV - True: start sending data; False: stop sending data - - - Complete set of calibration parameters for the radio - Aileron setpoints: high, center, low - Elevator setpoints: high, center, low - Rudder setpoints: high, center, low - Tail gyro mode/gain setpoints: heading hold, rate mode - Pitch curve setpoints (every 25%) - Throttle curve setpoints (every 25%) - - + common.xml + + + Available autopilot modes for ualberta uav + Raw input pulse widts sent to output + Inputs are normalized using calibration, the converted back to raw pulse widths for output + dfsdfs + dfsfds + dfsdfsdfs + + + Navigation filter mode + + AHRS mode + INS/GPS initialization mode + INS/GPS mode + + + Mode currently commanded by pilot + sdf + dfs + Rotomotion mode + + + + + Accelerometer and Gyro biases from the navigation filter + Timestamp (microseconds) + b_f[0] + b_f[1] + b_f[2] + b_f[0] + b_f[1] + b_f[2] + + + Complete set of calibration parameters for the radio + Aileron setpoints: left, center, right + Elevator setpoints: nose down, center, nose up + Rudder setpoints: nose left, center, nose right + Tail gyro mode/gain setpoints: heading hold, rate mode + Pitch curve setpoints (every 25%) + Throttle curve setpoints (every 25%) + + + System status specific to ualberta uav + System mode, see UALBERTA_AUTOPILOT_MODE ENUM + Navigation mode, see UALBERTA_NAV_MODE ENUM + Pilot mode, see UALBERTA_PILOT_MODE + + diff --git a/thirdParty/qserialport/qgroundcontrol-qserialport.pri b/thirdParty/qserialport/qgroundcontrol-qserialport.pri index e7106cb3d70e33811330e99bfb5eb77f7f3fe173..268e57e6dc21a77b657fe119ed2001f6bf7b54d2 100644 --- a/thirdParty/qserialport/qgroundcontrol-qserialport.pri +++ b/thirdParty/qserialport/qgroundcontrol-qserialport.pri @@ -24,7 +24,7 @@ macx|linux-g++|linux-g++-64 { HEADERS += src/posix/termioshelper.h } -win32-msvc2008|win32-g++ { +win32-msvc2008|win32-msvc2010|win32-g++ { HEADERS += src/win32/commdcbhelper.h \ src/win32/qwincommevtnotifier.h \ src/win32/wincommevtbreaker.h \ @@ -41,7 +41,7 @@ SOURCES += src/posix/qserialportnative_posix.cpp \ src/posix/termioshelper.cpp } -win32-msvc2008|win32-g++ { +win32-msvc2008|win32-msvc2010|win32-g++ { SOURCES += src/win32/commdcbhelper.cpp \ src/win32/qserialportnative_win32.cpp \ src/win32/qwincommevtnotifier.cpp \