interface.c
Go to the documentation of this file.
00001 /*------------------------------------------------------------------------
00002  *---------------------           RT-WMP              --------------------
00003  *------------------------------------------------------------------------
00004  *                                                         V7.0B  11/05/10
00005  *
00006  *
00007  *  File: ./src/core/interface.c
00008  *  Authors: Danilo Tardioli
00009  *  ----------------------------------------------------------------------
00010  *  Copyright (C) 2000-2010, Universidad de Zaragoza, SPAIN
00011  *
00012  *  Contact Addresses: Danilo Tardioli                   dantard@unizar.es
00013  *
00014  *  RT-WMP is free software; you can  redistribute it and/or  modify it
00015  *  under the terms of the GNU General Public License  as published by the
00016  *  Free Software Foundation;  either  version 2, or (at  your option) any
00017  *  later version.
00018  *
00019  *  RT-WMP  is distributed  in the  hope  that  it will be   useful, but
00020  *  WITHOUT  ANY  WARRANTY;     without  even the   implied   warranty  of
00021  *  MERCHANTABILITY  or  FITNESS FOR A  PARTICULAR PURPOSE.    See the GNU
00022  *  General Public License for more details.
00023  *
00024  *  You should have received  a  copy of  the  GNU General Public  License
00025  *  distributed with RT-WMP;  see file COPYING.   If not,  write to the
00026  *  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
00027  *  02111-1307, USA.
00028  *
00029  *  As a  special exception, if you  link this  unit  with other  files to
00030  *  produce an   executable,   this unit  does  not  by  itself cause  the
00031  *  resulting executable to be covered by the  GNU General Public License.
00032  *  This exception does  not however invalidate  any other reasons why the
00033  *  executable file might be covered by the GNU Public License.
00034  *
00035  *----------------------------------------------------------------------*/
00036 
00037 #include <stdarg.h>
00038 #include "include/global.h"
00039 #include "include/lqm.h"
00040 #include "interface/wmp_interface.h"
00041 
00042 char wmpGetNodeId(void){
00043         return status.id;
00044 }
00045 
00046 char wmpGetNumOfNodes(void){
00047         return status.N_NODES;
00048 }
00049 
00050 int wmpGetLatestLQM(char * lqm){
00051         int k=0,i=0,j=0;
00052         for (i=0;i<status.N_NODES;i++){
00053                 for (j=0;j<status.N_NODES;j++){
00054                         lqm[k]=lqm_get_val(i,j);
00055                         k++;
00056                 }
00057         }
00058         return k;
00059 }
00060 
00061 
00062 int wmpGetLatestDistances(char * lqm){
00063         int k=0,i=0,j=0;
00064         for (i=0;i<status.N_NODES;i++){
00065                 for (j=0;j<status.N_NODES;j++){
00066                         lqm[k]=lqm_get_distance(i,j);
00067                         k++;
00068                 }
00069         }
00070         return k;
00071 }
00072 
00073 
00074 char wmpGetMaxRssi(void){
00075         return status.max_rssi;
00076 }
00077 
00078 void wmpSetCpuDelay(int val){
00079         status.cpu_delay = val;
00080 }
00081 
00082 int wmpGetCpuDelay(void){
00083    return status.cpu_delay;
00084 }
00085 
00086 void wmpSetTimeout(int val){
00087         status.TIMEOUT = val;
00088 }
00089 
00090 int wmpGetTimeout(void){
00091    return status.TIMEOUT;
00092 }
00093 
00094 void wmpSetWCMult(int val){
00095         status.multiplier = val;
00096 }
00097 
00098 int wmpGetWCMult(void){
00099    return status.multiplier;
00100 }
00101 
00102 void wmpSetRate(int val){
00103         status.rate = val;
00104 }
00105 
00106 int wmpGetRate(void){
00107    return status.rate;
00108 }
00109 
00110 int wmpGetNetIT(void){
00111         return status.net_inactivity_timeout;
00112 }
00113 
00114 void wmpSetInstanceId(short iid){
00115         status.instance_id = iid;
00116 }
00117 
00118 short wmpGetInstanceId(void){
00119    return status.instance_id;
00120 }
00121 
00122 
00123 void wmp_set_levels(int w100, int w3, int w2, int w1){
00124         status.w100 = w100;
00125         status.w3 = w3;
00126         status.w2 = w2;
00127         status.w1 = w1;
00128 }
00129 
00130 void wmpSetMessageReschedule(int val){
00131         status.enable_message_reschedule = val;
00132 }
00133 int wmpGetMessageReschedule(void){
00134    return status.enable_message_reschedule;
00135 }
00136 
00137 void wmpSetFlowControl(int val){
00138         status.enable_flow_control = val;
00139 }
00140 
00141 int wmpGetFlowControl(void){
00142    return status.enable_flow_control;
00143 }
00144 
00145 unsigned int wmpGetSerial(void){
00146         return status.serial;
00147 }
00148 
00149 unsigned int wmpGetLoopId(void){
00150         return status.loop_id;
00151 }


ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Mon Oct 6 2014 08:27:10