COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
devicestruc Struct Reference

Device structure. More...

#include <jsondef.h>

Inheritance diagram for devicestruc:
Collaboration diagram for devicestruc:

Public Member Functions

json11::Json to_json () const
 Convert class contents to JSON object. More...
 
void from_json (const string &js)
 Set class contents from JSON string. More...
 
- Public Member Functions inherited from allstruc
json11::Json to_json () const
 Convert class contents to JSON object. More...
 
void from_json (const string &s)
 Set class contents from JSON string. More...
 

Public Attributes

allstruc all
 
antstruc ant
 
battstruc batt
 
bcregstruc bcreg
 
busstruc bus
 
camstruc cam
 
cpustruc cpu
 
diskstruc disk
 
gpsstruc gps
 
htrstruc htr
 
imustruc imu
 
mccstruc mcc
 
motrstruc motr
 
mtrstruc mtr
 
ploadstruc pload
 
propstruc prop
 
psenstruc psen
 
pvstrgstruc pvstrg
 
rotstruc rot
 
rwstruc rw
 
rxrstruc rxr
 
ssenstruc ssen
 
sttstruc stt
 
suchistruc suchi
 
swchstruc swch
 
tcustruc tcu
 
tcvstruc tcv
 
telemstruc telem
 
thststruc thst
 
tncstruc tnc
 
tsenstruc tsen
 
txrstruc txr
 
- Public Attributes inherited from allstruc
bool enabled = true
 Enabled? More...
 
uint16_t type = 0
 Component Type. More...
 
uint16_t model = 0
 Device Model. More...
 
uint32_t flag = 0
 Device flag - catch all for any small piece of information that might be device specific. More...
 
uint16_t addr = 0
 Device specific address. More...
 
uint16_t cidx = 0
 Component Index. More...
 
uint16_t didx = 0
 Device specific index. More...
 
uint16_t pidx = 0
 Piece index. More...
 
uint16_t bidx = 0
 Power Bus index. More...
 
uint16_t portidx = 0
 Connection information for device. More...
 
float namp = 0.f
 Nominal Amperage. More...
 
float nvolt = 0.f
 Nominal Voltage. More...
 
float amp = 0.f
 Current Amperage. More...
 
float volt = 0.f
 Current Voltage. More...
 
float power = 0.f
 Current Power. More...
 
float energy = 0.f
 Total energy usage. More...
 
float drate = 0.f
 Current data rate. More...
 
float temp = 0.f
 Current Temperature. More...
 
double utc = 0.
 Device information time stamp. More...
 

Detailed Description

Device structure.

Complete details of each Device. It is a union of all the possible device types, with a generic type for looking up basic information.

Member Function Documentation

json11::Json devicestruc::to_json ( ) const
inline

Convert class contents to JSON object.

Returns a json11 JSON object of the class

Returns
A json11 JSON object containing every member variable within the class
3731  {
3732  return json11::Json::object {
3733  { "enabled" , enabled },
3734  { "type" , type },
3735  { "model" , model },
3736  { "flag" , static_cast<int>(flag) },
3737  { "addr" , addr },
3738  { "cidx" , cidx },
3739  { "didx" , didx },
3740  { "pidx" , pidx },
3741  { "bidx" , bidx },
3742  { "portidx" , portidx },
3743  { "namp" , namp},
3744  { "nvolt" , nvolt },
3745  { "amp" , amp },
3746  { "volt" , volt },
3747  { "power" , power },
3748  { "energy" , energy },
3749  { "drate" , drate },
3750  { "temp" , temp },
3751  { "utc" , utc },
3752 
3753  { "all" , all },
3754  { "ant" , ant },
3755  { "batt" , batt },
3756  { "bcreg" , bcreg },
3757  { "bus" , bus },
3758  { "cam" , cam },
3759  { "cpu" , cpu },
3760  { "disk" , disk },
3761  { "gps" , gps },
3762  { "htr" , htr },
3763  { "imu" , imu },
3764  { "mcc" , mcc },
3765  { "motr" , motr },
3766  { "mtr" , mtr },
3767  { "pload" , pload },
3768  { "prop" , prop },
3769  { "psen" , psen },
3770  { "pvstrg" , pvstrg },
3771  { "rot" , rot },
3772  { "rw" , rw },
3773  { "rxr" , rxr },
3774  { "ssen" , ssen },
3775  { "stt" , stt },
3776  { "suchi" , suchi },
3777  { "swch" , swch },
3778  { "tcu" , tcu },
3779  { "tcv" , tcv },
3780  { "telem" , telem },
3781  { "thst" , thst },
3782  { "tnc" , tnc },
3783  { "tsen" , tsen },
3784  { "txr" , txr }
3785  };
3786  }
uint16_t model
Device Model.
Definition: jsondef.h:1589
rwstruc rw
Definition: jsondef.h:3713
uint16_t portidx
Connection information for device.
Definition: jsondef.h:1603
std::map< std::string, Json > object
Definition: json11.hpp:88
float power
Current Power.
Definition: jsondef.h:1613
float volt
Current Voltage.
Definition: jsondef.h:1611
uint16_t pidx
Piece index.
Definition: jsondef.h:1599
tcustruc tcu
Definition: jsondef.h:3719
float energy
Total energy usage.
Definition: jsondef.h:1615
diskstruc disk
Definition: jsondef.h:3701
float drate
Current data rate.
Definition: jsondef.h:1617
txrstruc txr
Definition: jsondef.h:3725
uint16_t didx
Device specific index.
Definition: jsondef.h:1597
allstruc all
Definition: jsondef.h:3694
uint16_t type
Component Type.
Definition: jsondef.h:1587
uint16_t bidx
Power Bus index.
Definition: jsondef.h:1601
suchistruc suchi
Definition: jsondef.h:3717
float amp
Current Amperage.
Definition: jsondef.h:1609
rotstruc rot
Definition: jsondef.h:3712
motrstruc motr
Definition: jsondef.h:3706
tncstruc tnc
Definition: jsondef.h:3723
float namp
Nominal Amperage.
Definition: jsondef.h:1605
mtrstruc mtr
Definition: jsondef.h:3707
double utc
Device information time stamp.
Definition: jsondef.h:1621
rxrstruc rxr
Definition: jsondef.h:3714
bool enabled
Enabled?
Definition: jsondef.h:1585
htrstruc htr
Definition: jsondef.h:3703
gpsstruc gps
Definition: jsondef.h:3702
pvstrgstruc pvstrg
Definition: jsondef.h:3711
uint32_t flag
Device flag - catch all for any small piece of information that might be device specific.
Definition: jsondef.h:1591
sttstruc stt
Definition: jsondef.h:3716
mccstruc mcc
Definition: jsondef.h:3705
uint16_t addr
Device specific address.
Definition: jsondef.h:1593
float temp
Current Temperature.
Definition: jsondef.h:1619
imustruc imu
Definition: jsondef.h:3704
swchstruc swch
Definition: jsondef.h:3718
uint16_t cidx
Component Index.
Definition: jsondef.h:1595
psenstruc psen
Definition: jsondef.h:3710
ploadstruc pload
Definition: jsondef.h:3708
tcvstruc tcv
Definition: jsondef.h:3720
bcregstruc bcreg
Definition: jsondef.h:3697
propstruc prop
Definition: jsondef.h:3709
busstruc bus
Definition: jsondef.h:3698
telemstruc telem
Definition: jsondef.h:3721
battstruc batt
Definition: jsondef.h:3696
antstruc ant
Definition: jsondef.h:3695
float nvolt
Nominal Voltage.
Definition: jsondef.h:1607
cpustruc cpu
Definition: jsondef.h:3700
ssenstruc ssen
Definition: jsondef.h:3715
tsenstruc tsen
Definition: jsondef.h:3724
camstruc cam
Definition: jsondef.h:3699
thststruc thst
Definition: jsondef.h:3722
void devicestruc::from_json ( const string &  js)
inline

Set class contents from JSON string.

Parses the provided JSON-formatted string and sets the class data. String should be formatted like the string returned from to_json()

Parameters
sJSON-formatted string to set class contents to
Returns
n/a
3794  {
3795  string error;
3796  json11::Json p = json11::Json::parse(js,error);
3797  if(error.empty()) {
3798  if(!p["enabled"].is_null()) { enabled = p["enabled"].bool_value(); }
3799  if(!p["type"].is_null()) { type = p["type"].int_value(); }
3800  if(!p["model"].is_null()) { model = p["model"].int_value(); }
3801  if(!p["flag"].is_null()) { flag = p["flag"].int_value(); }
3802  if(!p["addr"].is_null()) { addr = p["addr"].int_value(); }
3803  if(!p["cidx"].is_null()) { cidx = p["cidx"].int_value(); }
3804  if(!p["didx"].is_null()) { didx = p["didx"].int_value(); }
3805  if(!p["pidx"].is_null()) { pidx = p["pidx"].int_value(); }
3806  if(!p["bidx"].is_null()) { bidx = p["bidx"].int_value(); }
3807  if(!p["portidx"].is_null()) { portidx = p["portidx"].int_value(); }
3808  if(!p["namp"].is_null()) { namp = p["namp"].number_value(); }
3809  if(!p["nvolt"].is_null()) { nvolt = p["nvolt"].number_value(); }
3810  if(!p["amp"].is_null()) { amp = p["amp"].number_value(); }
3811  if(!p["volt"].is_null()) { volt = p["volt"].number_value(); }
3812  if(!p["power"].is_null()) { power = p["power"].number_value(); }
3813  if(!p["energy"].is_null()) { energy = p["energy"].number_value(); }
3814  if(!p["drate"].is_null()) { drate = p["drate"].number_value(); }
3815  if(!p["temp"].is_null()) { temp = p["temp"].number_value(); }
3816  if(!p["utc"].is_null()) { utc = p["utc"].number_value(); }
3817 
3818  if(!p["all"].is_null()) { all.from_json(p["all"].dump()); }
3819  if(!p["ant"].is_null()) { ant.from_json(p["ant"].dump()); }
3820  if(!p["batt"].is_null()) { batt.from_json(p["batt"].dump()); }
3821  if(!p["bcreg"].is_null()) { bcreg.from_json(p["bcreg"].dump()); }
3822  if(!p["bus"].is_null()) { bus.from_json(p["bus"].dump()); }
3823  if(!p["cam"].is_null()) { cam.from_json(p["cam"].dump()); }
3824  if(!p["cpu"].is_null()) { cpu.from_json(p["cpu"].dump()); }
3825  if(!p["disk"].is_null()) { disk.from_json(p["disk"].dump()); }
3826  if(!p["gps"].is_null()) { gps.from_json(p["gps"].dump()); }
3827  if(!p["htr"].is_null()) { htr.from_json(p["htr"].dump()); }
3828  if(!p["imu"].is_null()) { imu.from_json(p["imu"].dump()); }
3829  if(!p["mcc"].is_null()) { mcc.from_json(p["mcc"].dump()); }
3830  if(!p["motr"].is_null()) { motr.from_json(p["motr"].dump()); }
3831  if(!p["mtr"].is_null()) { mtr.from_json(p["mtr"].dump()); }
3832  if(!p["pload"].is_null()) { pload.from_json(p["pload"].dump()); }
3833  if(!p["prop"].is_null()) { prop.from_json(p["prop"].dump()); }
3834  if(!p["psen"].is_null()) { psen.from_json(p["psen"].dump()); }
3835  if(!p["pvstrg"].is_null()) { pvstrg.from_json(p["pvstrg"].dump()); }
3836  if(!p["rot"].is_null()) { rot.from_json(p["rot"].dump()); }
3837  if(!p["rw"].is_null()) { rw.from_json(p["rw"].dump()); }
3838  if(!p["rxr"].is_null()) { rxr.from_json(p["rxr"].dump()); }
3839  if(!p["ssen"].is_null()) { ssen.from_json(p["ssen"].dump()); }
3840  if(!p["stt"].is_null()) { stt.from_json(p["stt"].dump()); }
3841  if(!p["suchi"].is_null()) { suchi.from_json(p["suchi"].dump()); }
3842  if(!p["swch"].is_null()) { swch.from_json(p["swch"].dump()); }
3843  if(!p["tcu"].is_null()) { tcu.from_json(p["tcu"].dump()); }
3844  if(!p["tcv"].is_null()) { tcv.from_json(p["tcv"].dump()); }
3845  if(!p["telem"].is_null()) { telem.from_json(p["telem"].dump()); }
3846  if(!p["thst"].is_null()) { thst.from_json(p["thst"].dump()); }
3847  if(!p["tnc"].is_null()) { tnc.from_json(p["tnc"].dump()); }
3848  if(!p["tsen"].is_null()) { tsen.from_json(p["tsen"].dump()); }
3849  if(!p["txr"].is_null()) { txr.from_json(p["txr"].dump()); }
3850  } else {
3851  cerr<<"ERROR: <"<<error<<">"<<endl;
3852  }
3853  return;
3854  }
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:1781
uint16_t model
Device Model.
Definition: jsondef.h:1589
rwstruc rw
Definition: jsondef.h:3713
uint16_t portidx
Connection information for device.
Definition: jsondef.h:1603
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2794
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2684
Definition: json11.hpp:79
float power
Current Power.
Definition: jsondef.h:1613
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2027
float volt
Current Voltage.
Definition: jsondef.h:1611
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2893
uint16_t pidx
Piece index.
Definition: jsondef.h:1599
tcustruc tcu
Definition: jsondef.h:3719
float energy
Total energy usage.
Definition: jsondef.h:1615
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2565
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2767
diskstruc disk
Definition: jsondef.h:3701
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2728
float drate
Current data rate.
Definition: jsondef.h:1617
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:3167
txrstruc txr
Definition: jsondef.h:3725
uint16_t didx
Device specific index.
Definition: jsondef.h:1597
allstruc all
Definition: jsondef.h:3694
uint16_t type
Component Type.
Definition: jsondef.h:1587
uint16_t bidx
Power Bus index.
Definition: jsondef.h:1601
suchistruc suchi
Definition: jsondef.h:3717
float amp
Current Amperage.
Definition: jsondef.h:1609
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:3054
rotstruc rot
Definition: jsondef.h:3712
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:3093
motrstruc motr
Definition: jsondef.h:3706
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:1839
tncstruc tnc
Definition: jsondef.h:3723
static double * p
Definition: gauss_jackson_test.cpp:42
float namp
Nominal Amperage.
Definition: jsondef.h:1605
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2967
mtrstruc mtr
Definition: jsondef.h:3707
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:3126
double utc
Device information time stamp.
Definition: jsondef.h:1621
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2825
rxrstruc rxr
Definition: jsondef.h:3714
bool enabled
Enabled?
Definition: jsondef.h:1585
static void dump(NullStruct, string &out)
Definition: json11.cpp:53
htrstruc htr
Definition: jsondef.h:3703
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2628
gpsstruc gps
Definition: jsondef.h:3702
bool bool_value() const
Definition: json11.cpp:282
pvstrgstruc pvstrg
Definition: jsondef.h:3711
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2096
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:3215
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2470
uint32_t flag
Device flag - catch all for any small piece of information that might be device specific.
Definition: jsondef.h:1591
sttstruc stt
Definition: jsondef.h:3716
mccstruc mcc
Definition: jsondef.h:3705
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2293
uint16_t addr
Device specific address.
Definition: jsondef.h:1593
float temp
Current Temperature.
Definition: jsondef.h:1619
imustruc imu
Definition: jsondef.h:3704
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:1965
swchstruc swch
Definition: jsondef.h:3718
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:3247
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:1734
uint16_t cidx
Component Index.
Definition: jsondef.h:1595
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:1657
psenstruc psen
Definition: jsondef.h:3710
ploadstruc pload
Definition: jsondef.h:3708
tcvstruc tcv
Definition: jsondef.h:3720
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:3013
bcregstruc bcreg
Definition: jsondef.h:3697
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2378
propstruc prop
Definition: jsondef.h:3709
busstruc bus
Definition: jsondef.h:3698
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:3267
telemstruc telem
Definition: jsondef.h:3721
battstruc batt
Definition: jsondef.h:3696
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2920
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2864
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:1900
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2142
antstruc ant
Definition: jsondef.h:3695
float nvolt
Nominal Voltage.
Definition: jsondef.h:1607
int int_value() const
Definition: json11.cpp:281
cpustruc cpu
Definition: jsondef.h:3700
ssenstruc ssen
Definition: jsondef.h:3715
void from_json(const string &s)
Set class contents from JSON string.
Definition: jsondef.h:2222
tsenstruc tsen
Definition: jsondef.h:3724
camstruc cam
Definition: jsondef.h:3699
double number_value() const
Definition: json11.cpp:280
thststruc thst
Definition: jsondef.h:3722

Member Data Documentation

allstruc devicestruc::all
antstruc devicestruc::ant
battstruc devicestruc::batt
bcregstruc devicestruc::bcreg
busstruc devicestruc::bus
camstruc devicestruc::cam
cpustruc devicestruc::cpu
diskstruc devicestruc::disk
gpsstruc devicestruc::gps
htrstruc devicestruc::htr
imustruc devicestruc::imu
mccstruc devicestruc::mcc
motrstruc devicestruc::motr
mtrstruc devicestruc::mtr
ploadstruc devicestruc::pload
propstruc devicestruc::prop
psenstruc devicestruc::psen
pvstrgstruc devicestruc::pvstrg
rotstruc devicestruc::rot
rwstruc devicestruc::rw
rxrstruc devicestruc::rxr
ssenstruc devicestruc::ssen
sttstruc devicestruc::stt
suchistruc devicestruc::suchi
swchstruc devicestruc::swch
tcustruc devicestruc::tcu
tcvstruc devicestruc::tcv
telemstruc devicestruc::telem
thststruc devicestruc::thst
tncstruc devicestruc::tnc
tsenstruc devicestruc::tsen
txrstruc devicestruc::txr

The documentation for this struct was generated from the following file: