Changeset 11067
- Timestamp:
- 06/18/11 18:24:17 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fscctrl.cc
r11057 r11067 95 95 Out() << kBold << "Received:" << endl; 96 96 97 /* 98 "status: 00000538 \n" 99 "time_s: 764.755 \n" 100 "VOLTAGES \n" 101 " \n" 102 "enable:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 00001111 \n" 103 " done:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 00001111 \n" 104 "values:0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 \n" 105 "RESISTANCES \n" 106 " \n" 107 "enable:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 \n" 108 " done:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 \n" 109 "values: \n" 110 "1000.16 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 111 "3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 112 "1197.07 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 113 " 558.59 677.92 817.26 989.39 1200.35 1503.06 1799.90 2204.18 \n" 114 "3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 115 "3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 116 "3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 117 "3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 118 "end.\n"; 119 */ 120 /* 121 const unsigned int TIME_OFF = 3; 122 const unsigned int VOLT_OFF = 30; 123 const unsigned int CURR_OFF = 70; 124 const unsigned int HUMI_OFF = 110; 125 const unsigned int TEMP_OFF = 134; 126 */ 97 127 istream is(&fBuffer); 98 128 99 129 int state = 0; 100 130 bool values = false; 101 int offset = 0; 102 /* 131 132 vector<int> volt; 133 vector<float> resist; 134 int status=-1; 135 float time=0; 136 103 137 string buffer; 104 138 while (getline(is, buffer, '\n')) … … 117 151 if (buffer.substr(0, 8)=="status: ") 118 152 { 153 status = atoi(buffer.c_str()+8); 154 continue; 119 155 } 120 156 121 157 if (buffer.substr(0, 8)=="time_s: ") 122 158 { 159 time = atof(buffer.c_str()+8); 160 continue; 123 161 } 124 162 125 163 if (buffer.substr(0, 8)=="VOLTAGES") 164 { 126 165 state = 1; 166 continue; 167 } 127 168 128 169 if (buffer.substr(0, 11)=="RESISTANCES") 170 { 129 171 state = 2; 172 continue; 173 } 130 174 131 175 if (state==1 && buffer.substr(0, 7)=="values:") 132 176 { 177 istringstream in(buffer.substr(7)); 178 while (1) 179 { 180 int v; 181 in >> v; 182 if (!in) 183 break; 184 185 volt.push_back(v); 186 } 187 continue; 133 188 } 134 189 … … 139 194 } 140 195 141 istringtream str(buffer); 142 for (int i=0; i<8; i++) 196 if (state==2 && !values) 197 continue; 198 199 istringstream in(buffer); 200 while (1) 143 201 { 144 202 float f; 145 str >> f; 146 offset += 8; 203 in >> f; 204 if (!in) 205 break; 206 207 resist.push_back(f); 147 208 } 148 209 } 149 */ 150 /* 151 "status: 00000538 \n" 152 "time_s: 764.755 \n" 153 "VOLTAGES \n" 154 " \n" 155 "enable:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 00001111 \n" 156 " done:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 00001111 \n" 157 "values:0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 \n" 158 "RESISTANCES \n" 159 " \n" 160 "enable:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 \n" 161 " done:11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 \n" 162 "values: \n" 163 "1000.16 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 164 "3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 165 "1197.07 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 166 " 558.59 677.92 817.26 989.39 1200.35 1503.06 1799.90 2204.18 \n" 167 "3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 168 "3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 169 "3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 170 "3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 3199.99 \n" 171 "end.\n"; 172 173 */ 210 174 211 StartRead(); 175 212 }
Note:
See TracChangeset
for help on using the changeset viewer.