Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
gseEncode.c
00001 /** 00002 * Rapid-prototyping protection schemes with IEC 61850 00003 * 00004 * Copyright (c) 2011 Steven Blair 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include "gseEncodeBasic.h" 00022 #include "ied.h" 00023 #include "gseEncode.h" 00024 00025 00026 00027 int ber_get_length_myAnalogValue(struct myAnalogValue *myAnalogValue) { 00028 int total = 0; 00029 int len = 0; 00030 00031 len = BER_GET_LENGTH_CTYPE_FLOAT32(&myAnalogValue->f); 00032 total += len + getLengthBytes(len) + 1; 00033 00034 return total; 00035 } 00036 int ber_encode_myAnalogValue(unsigned char *buf, struct myAnalogValue *myAnalogValue) { 00037 int offset = 0; 00038 00039 buf[offset++] = 0xA2; 00040 offset += encodeLength(&buf[offset], ber_get_length_myAnalogValue(myAnalogValue)); 00041 00042 offset += BER_ENCODE_CTYPE_FLOAT32(&buf[offset], &myAnalogValue->f); 00043 00044 return offset; 00045 } 00046 int ber_get_length_ScaledValueConfig(struct ScaledValueConfig *ScaledValueConfig) { 00047 int total = 0; 00048 int len = 0; 00049 00050 len = BER_GET_LENGTH_CTYPE_FLOAT32(&ScaledValueConfig->scaleFactor); 00051 total += len + getLengthBytes(len) + 1; 00052 len = BER_GET_LENGTH_CTYPE_FLOAT32(&ScaledValueConfig->offset); 00053 total += len + getLengthBytes(len) + 1; 00054 00055 return total; 00056 } 00057 int ber_encode_ScaledValueConfig(unsigned char *buf, struct ScaledValueConfig *ScaledValueConfig) { 00058 int offset = 0; 00059 00060 buf[offset++] = 0xA2; 00061 offset += encodeLength(&buf[offset], ber_get_length_ScaledValueConfig(ScaledValueConfig)); 00062 00063 offset += BER_ENCODE_CTYPE_FLOAT32(&buf[offset], &ScaledValueConfig->scaleFactor); 00064 offset += BER_ENCODE_CTYPE_FLOAT32(&buf[offset], &ScaledValueConfig->offset); 00065 00066 return offset; 00067 } 00068 int ber_get_length_myVector(struct myVector *myVector) { 00069 int total = 0; 00070 int len = 0; 00071 00072 len = ber_get_length_myAnalogValue(&myVector->mag); 00073 total += len + getLengthBytes(len) + 1; 00074 len = ber_get_length_myAnalogValue(&myVector->ang); 00075 total += len + getLengthBytes(len) + 1; 00076 00077 return total; 00078 } 00079 int ber_encode_myVector(unsigned char *buf, struct myVector *myVector) { 00080 int offset = 0; 00081 00082 buf[offset++] = 0xA2; 00083 offset += encodeLength(&buf[offset], ber_get_length_myVector(myVector)); 00084 00085 offset += ber_encode_myAnalogValue(&buf[offset], &myVector->mag); 00086 offset += ber_encode_myAnalogValue(&buf[offset], &myVector->ang); 00087 00088 return offset; 00089 } 00090 int ber_get_length_simpleVector(struct simpleVector *simpleVector) { 00091 int total = 0; 00092 int len = 0; 00093 00094 len = ber_get_length_myAnalogValue(&simpleVector->mag); 00095 total += len + getLengthBytes(len) + 1; 00096 len = ber_get_length_myAnalogValue(&simpleVector->ang); 00097 total += len + getLengthBytes(len) + 1; 00098 00099 return total; 00100 } 00101 int ber_encode_simpleVector(unsigned char *buf, struct simpleVector *simpleVector) { 00102 int offset = 0; 00103 00104 buf[offset++] = 0xA2; 00105 offset += encodeLength(&buf[offset], ber_get_length_simpleVector(simpleVector)); 00106 00107 offset += ber_encode_myAnalogValue(&buf[offset], &simpleVector->mag); 00108 offset += ber_encode_myAnalogValue(&buf[offset], &simpleVector->ang); 00109 00110 return offset; 00111 } 00112 int ber_get_length_myMod(struct myMod *myMod) { 00113 int total = 0; 00114 int len = 0; 00115 00116 len = BER_GET_LENGTH_CTYPE_ENUM((CTYPE_ENUM *) &myMod->ctlVal); 00117 total += len + getLengthBytes(len) + 1; 00118 len = BER_GET_LENGTH_CTYPE_ENUM((CTYPE_ENUM *) &myMod->stVal); 00119 total += len + getLengthBytes(len) + 1; 00120 len = BER_GET_LENGTH_CTYPE_QUALITY(&myMod->q); 00121 total += len + getLengthBytes(len) + 1; 00122 len = BER_GET_LENGTH_CTYPE_TIMESTAMP(&myMod->t); 00123 total += len + getLengthBytes(len) + 1; 00124 00125 return total; 00126 } 00127 int ber_encode_myMod(unsigned char *buf, struct myMod *myMod) { 00128 int offset = 0; 00129 00130 buf[offset++] = 0xA2; 00131 offset += encodeLength(&buf[offset], ber_get_length_myMod(myMod)); 00132 00133 offset += BER_ENCODE_CTYPE_ENUM(&buf[offset], (CTYPE_ENUM *) &myMod->ctlVal); 00134 offset += BER_ENCODE_CTYPE_ENUM(&buf[offset], (CTYPE_ENUM *) &myMod->stVal); 00135 offset += BER_ENCODE_CTYPE_QUALITY(&buf[offset], &myMod->q); 00136 offset += BER_ENCODE_CTYPE_TIMESTAMP(&buf[offset], &myMod->t); 00137 00138 return offset; 00139 } 00140 int ber_get_length_myHealth(struct myHealth *myHealth) { 00141 int total = 0; 00142 int len = 0; 00143 00144 len = BER_GET_LENGTH_CTYPE_ENUM((CTYPE_ENUM *) &myHealth->stVal); 00145 total += len + getLengthBytes(len) + 1; 00146 00147 return total; 00148 } 00149 int ber_encode_myHealth(unsigned char *buf, struct myHealth *myHealth) { 00150 int offset = 0; 00151 00152 buf[offset++] = 0xA2; 00153 offset += encodeLength(&buf[offset], ber_get_length_myHealth(myHealth)); 00154 00155 offset += BER_ENCODE_CTYPE_ENUM(&buf[offset], (CTYPE_ENUM *) &myHealth->stVal); 00156 00157 return offset; 00158 } 00159 int ber_get_length_myBeh(struct myBeh *myBeh) { 00160 int total = 0; 00161 int len = 0; 00162 00163 len = BER_GET_LENGTH_CTYPE_ENUM((CTYPE_ENUM *) &myBeh->stVal); 00164 total += len + getLengthBytes(len) + 1; 00165 00166 return total; 00167 } 00168 int ber_encode_myBeh(unsigned char *buf, struct myBeh *myBeh) { 00169 int offset = 0; 00170 00171 buf[offset++] = 0xA2; 00172 offset += encodeLength(&buf[offset], ber_get_length_myBeh(myBeh)); 00173 00174 offset += BER_ENCODE_CTYPE_ENUM(&buf[offset], (CTYPE_ENUM *) &myBeh->stVal); 00175 00176 return offset; 00177 } 00178 int ber_get_length_myINS(struct myINS *myINS) { 00179 int total = 0; 00180 int len = 0; 00181 00182 len = BER_GET_LENGTH_CTYPE_INT32(&myINS->stVal); 00183 total += len + getLengthBytes(len) + 1; 00184 00185 return total; 00186 } 00187 int ber_encode_myINS(unsigned char *buf, struct myINS *myINS) { 00188 int offset = 0; 00189 00190 buf[offset++] = 0xA2; 00191 offset += encodeLength(&buf[offset], ber_get_length_myINS(myINS)); 00192 00193 offset += BER_ENCODE_CTYPE_INT32(&buf[offset], &myINS->stVal); 00194 00195 return offset; 00196 } 00197 int ber_get_length_myLPL(struct myLPL *myLPL) { 00198 int total = 0; 00199 int len = 0; 00200 00201 len = BER_GET_LENGTH_CTYPE_VISSTRING255(&myLPL->ldNs); 00202 total += len + getLengthBytes(len) + 1; 00203 len = BER_GET_LENGTH_CTYPE_VISSTRING255(&myLPL->configRev); 00204 total += len + getLengthBytes(len) + 1; 00205 00206 return total; 00207 } 00208 int ber_encode_myLPL(unsigned char *buf, struct myLPL *myLPL) { 00209 int offset = 0; 00210 00211 buf[offset++] = 0xA2; 00212 offset += encodeLength(&buf[offset], ber_get_length_myLPL(myLPL)); 00213 00214 offset += BER_ENCODE_CTYPE_VISSTRING255(&buf[offset], &myLPL->ldNs); 00215 offset += BER_ENCODE_CTYPE_VISSTRING255(&buf[offset], &myLPL->configRev); 00216 00217 return offset; 00218 } 00219 int ber_get_length_myDPL(struct myDPL *myDPL) { 00220 int total = 0; 00221 int len = 0; 00222 00223 len = BER_GET_LENGTH_CTYPE_VISSTRING255(&myDPL->vendor); 00224 total += len + getLengthBytes(len) + 1; 00225 len = BER_GET_LENGTH_CTYPE_VISSTRING255(&myDPL->hwRev); 00226 total += len + getLengthBytes(len) + 1; 00227 00228 return total; 00229 } 00230 int ber_encode_myDPL(unsigned char *buf, struct myDPL *myDPL) { 00231 int offset = 0; 00232 00233 buf[offset++] = 0xA2; 00234 offset += encodeLength(&buf[offset], ber_get_length_myDPL(myDPL)); 00235 00236 offset += BER_ENCODE_CTYPE_VISSTRING255(&buf[offset], &myDPL->vendor); 00237 offset += BER_ENCODE_CTYPE_VISSTRING255(&buf[offset], &myDPL->hwRev); 00238 00239 return offset; 00240 } 00241 int ber_get_length_myPos(struct myPos *myPos) { 00242 int total = 0; 00243 int len = 0; 00244 00245 len = BER_GET_LENGTH_CTYPE_DBPOS(&myPos->stVal); 00246 total += len + getLengthBytes(len) + 1; 00247 len = BER_GET_LENGTH_CTYPE_QUALITY(&myPos->q); 00248 total += len + getLengthBytes(len) + 1; 00249 len = BER_GET_LENGTH_CTYPE_TIMESTAMP(&myPos->t); 00250 total += len + getLengthBytes(len) + 1; 00251 len = BER_GET_LENGTH_CTYPE_BOOLEAN(&myPos->ctlVal); 00252 total += len + getLengthBytes(len) + 1; 00253 00254 return total; 00255 } 00256 int ber_encode_myPos(unsigned char *buf, struct myPos *myPos) { 00257 int offset = 0; 00258 00259 buf[offset++] = 0xA2; 00260 offset += encodeLength(&buf[offset], ber_get_length_myPos(myPos)); 00261 00262 offset += BER_ENCODE_CTYPE_DBPOS(&buf[offset], &myPos->stVal); 00263 offset += BER_ENCODE_CTYPE_QUALITY(&buf[offset], &myPos->q); 00264 offset += BER_ENCODE_CTYPE_TIMESTAMP(&buf[offset], &myPos->t); 00265 offset += BER_ENCODE_CTYPE_BOOLEAN(&buf[offset], &myPos->ctlVal); 00266 00267 return offset; 00268 } 00269 int ber_get_length_mySPS(struct mySPS *mySPS) { 00270 int total = 0; 00271 int len = 0; 00272 00273 len = BER_GET_LENGTH_CTYPE_INT32(&mySPS->stVal); 00274 total += len + getLengthBytes(len) + 1; 00275 len = BER_GET_LENGTH_CTYPE_QUALITY(&mySPS->q); 00276 total += len + getLengthBytes(len) + 1; 00277 len = BER_GET_LENGTH_CTYPE_TIMESTAMP(&mySPS->t); 00278 total += len + getLengthBytes(len) + 1; 00279 00280 return total; 00281 } 00282 int ber_encode_mySPS(unsigned char *buf, struct mySPS *mySPS) { 00283 int offset = 0; 00284 00285 buf[offset++] = 0xA2; 00286 offset += encodeLength(&buf[offset], ber_get_length_mySPS(mySPS)); 00287 00288 offset += BER_ENCODE_CTYPE_INT32(&buf[offset], &mySPS->stVal); 00289 offset += BER_ENCODE_CTYPE_QUALITY(&buf[offset], &mySPS->q); 00290 offset += BER_ENCODE_CTYPE_TIMESTAMP(&buf[offset], &mySPS->t); 00291 00292 return offset; 00293 } 00294 int ber_get_length_myMV(struct myMV *myMV) { 00295 int total = 0; 00296 int len = 0; 00297 00298 len = ber_get_length_myAnalogValue(&myMV->mag); 00299 total += len + getLengthBytes(len) + 1; 00300 len = BER_GET_LENGTH_CTYPE_QUALITY(&myMV->q); 00301 total += len + getLengthBytes(len) + 1; 00302 len = BER_GET_LENGTH_CTYPE_TIMESTAMP(&myMV->t); 00303 total += len + getLengthBytes(len) + 1; 00304 len = ber_get_length_ScaledValueConfig(&myMV->sVC); 00305 total += len + getLengthBytes(len) + 1; 00306 00307 return total; 00308 } 00309 int ber_encode_myMV(unsigned char *buf, struct myMV *myMV) { 00310 int offset = 0; 00311 00312 buf[offset++] = 0xA2; 00313 offset += encodeLength(&buf[offset], ber_get_length_myMV(myMV)); 00314 00315 offset += ber_encode_myAnalogValue(&buf[offset], &myMV->mag); 00316 offset += BER_ENCODE_CTYPE_QUALITY(&buf[offset], &myMV->q); 00317 offset += BER_ENCODE_CTYPE_TIMESTAMP(&buf[offset], &myMV->t); 00318 offset += ber_encode_ScaledValueConfig(&buf[offset], &myMV->sVC); 00319 00320 return offset; 00321 } 00322 int ber_get_length_simpleMV(struct simpleMV *simpleMV) { 00323 int total = 0; 00324 int len = 0; 00325 00326 len = BER_GET_LENGTH_CTYPE_FLOAT32(&simpleMV->mag); 00327 total += len + getLengthBytes(len) + 1; 00328 len = BER_GET_LENGTH_CTYPE_QUALITY(&simpleMV->q); 00329 total += len + getLengthBytes(len) + 1; 00330 len = BER_GET_LENGTH_CTYPE_TIMESTAMP(&simpleMV->t); 00331 total += len + getLengthBytes(len) + 1; 00332 len = ber_get_length_ScaledValueConfig(&simpleMV->sVC); 00333 total += len + getLengthBytes(len) + 1; 00334 00335 return total; 00336 } 00337 int ber_encode_simpleMV(unsigned char *buf, struct simpleMV *simpleMV) { 00338 int offset = 0; 00339 00340 buf[offset++] = 0xA2; 00341 offset += encodeLength(&buf[offset], ber_get_length_simpleMV(simpleMV)); 00342 00343 offset += BER_ENCODE_CTYPE_FLOAT32(&buf[offset], &simpleMV->mag); 00344 offset += BER_ENCODE_CTYPE_QUALITY(&buf[offset], &simpleMV->q); 00345 offset += BER_ENCODE_CTYPE_TIMESTAMP(&buf[offset], &simpleMV->t); 00346 offset += ber_encode_ScaledValueConfig(&buf[offset], &simpleMV->sVC); 00347 00348 return offset; 00349 } 00350 int ber_get_length_simpleCMV(struct simpleCMV *simpleCMV) { 00351 int total = 0; 00352 int len = 0; 00353 00354 len = ber_get_length_simpleVector(&simpleCMV->cVal); 00355 total += len + getLengthBytes(len) + 1; 00356 len = BER_GET_LENGTH_CTYPE_QUALITY(&simpleCMV->q); 00357 total += len + getLengthBytes(len) + 1; 00358 len = BER_GET_LENGTH_CTYPE_TIMESTAMP(&simpleCMV->t); 00359 total += len + getLengthBytes(len) + 1; 00360 00361 return total; 00362 } 00363 int ber_encode_simpleCMV(unsigned char *buf, struct simpleCMV *simpleCMV) { 00364 int offset = 0; 00365 00366 buf[offset++] = 0xA2; 00367 offset += encodeLength(&buf[offset], ber_get_length_simpleCMV(simpleCMV)); 00368 00369 offset += ber_encode_simpleVector(&buf[offset], &simpleCMV->cVal); 00370 offset += BER_ENCODE_CTYPE_QUALITY(&buf[offset], &simpleCMV->q); 00371 offset += BER_ENCODE_CTYPE_TIMESTAMP(&buf[offset], &simpleCMV->t); 00372 00373 return offset; 00374 } 00375 int ber_get_length_simpleWYE(struct simpleWYE *simpleWYE) { 00376 int total = 0; 00377 int len = 0; 00378 00379 len = ber_get_length_simpleCMV(&simpleWYE->phsA); 00380 total += len + getLengthBytes(len) + 1; 00381 len = ber_get_length_simpleCMV(&simpleWYE->phsB); 00382 total += len + getLengthBytes(len) + 1; 00383 len = ber_get_length_simpleCMV(&simpleWYE->phsC); 00384 total += len + getLengthBytes(len) + 1; 00385 00386 return total; 00387 } 00388 int ber_encode_simpleWYE(unsigned char *buf, struct simpleWYE *simpleWYE) { 00389 int offset = 0; 00390 00391 buf[offset++] = 0xA2; 00392 offset += encodeLength(&buf[offset], ber_get_length_simpleWYE(simpleWYE)); 00393 00394 offset += ber_encode_simpleCMV(&buf[offset], &simpleWYE->phsA); 00395 offset += ber_encode_simpleCMV(&buf[offset], &simpleWYE->phsB); 00396 offset += ber_encode_simpleCMV(&buf[offset], &simpleWYE->phsC); 00397 00398 return offset; 00399 } 00400 int ber_get_length_myCMV(struct myCMV *myCMV) { 00401 int total = 0; 00402 int len = 0; 00403 00404 len = ber_get_length_myVector(&myCMV->cVal); 00405 total += len + getLengthBytes(len) + 1; 00406 len = BER_GET_LENGTH_CTYPE_QUALITY(&myCMV->q); 00407 total += len + getLengthBytes(len) + 1; 00408 len = BER_GET_LENGTH_CTYPE_TIMESTAMP(&myCMV->t); 00409 total += len + getLengthBytes(len) + 1; 00410 00411 return total; 00412 } 00413 int ber_encode_myCMV(unsigned char *buf, struct myCMV *myCMV) { 00414 int offset = 0; 00415 00416 buf[offset++] = 0xA2; 00417 offset += encodeLength(&buf[offset], ber_get_length_myCMV(myCMV)); 00418 00419 offset += ber_encode_myVector(&buf[offset], &myCMV->cVal); 00420 offset += BER_ENCODE_CTYPE_QUALITY(&buf[offset], &myCMV->q); 00421 offset += BER_ENCODE_CTYPE_TIMESTAMP(&buf[offset], &myCMV->t); 00422 00423 return offset; 00424 } 00425 int ber_get_length_mySEQ(struct mySEQ *mySEQ) { 00426 int total = 0; 00427 int len = 0; 00428 00429 len = ber_get_length_myCMV(&mySEQ->c1); 00430 total += len + getLengthBytes(len) + 1; 00431 len = ber_get_length_myCMV(&mySEQ->c2); 00432 total += len + getLengthBytes(len) + 1; 00433 len = ber_get_length_myCMV(&mySEQ->c3); 00434 total += len + getLengthBytes(len) + 1; 00435 len = BER_GET_LENGTH_CTYPE_ENUM((CTYPE_ENUM *) &mySEQ->seqT); 00436 total += len + getLengthBytes(len) + 1; 00437 00438 return total; 00439 } 00440 int ber_encode_mySEQ(unsigned char *buf, struct mySEQ *mySEQ) { 00441 int offset = 0; 00442 00443 buf[offset++] = 0xA2; 00444 offset += encodeLength(&buf[offset], ber_get_length_mySEQ(mySEQ)); 00445 00446 offset += ber_encode_myCMV(&buf[offset], &mySEQ->c1); 00447 offset += ber_encode_myCMV(&buf[offset], &mySEQ->c2); 00448 offset += ber_encode_myCMV(&buf[offset], &mySEQ->c3); 00449 offset += BER_ENCODE_CTYPE_ENUM(&buf[offset], (CTYPE_ENUM *) &mySEQ->seqT); 00450 00451 return offset; 00452 } 00453 int ber_get_length_mySAV(struct mySAV *mySAV) { 00454 int total = 0; 00455 int len = 0; 00456 00457 len = ber_get_length_myAnalogValue(&mySAV->instMag); 00458 total += len + getLengthBytes(len) + 1; 00459 len = BER_GET_LENGTH_CTYPE_QUALITY(&mySAV->q); 00460 total += len + getLengthBytes(len) + 1; 00461 00462 return total; 00463 } 00464 int ber_encode_mySAV(unsigned char *buf, struct mySAV *mySAV) { 00465 int offset = 0; 00466 00467 buf[offset++] = 0xA2; 00468 offset += encodeLength(&buf[offset], ber_get_length_mySAV(mySAV)); 00469 00470 offset += ber_encode_myAnalogValue(&buf[offset], &mySAV->instMag); 00471 offset += BER_ENCODE_CTYPE_QUALITY(&buf[offset], &mySAV->q); 00472 00473 return offset; 00474 } 00475 int ber_get_length_simpleSAV(struct simpleSAV *simpleSAV) { 00476 int total = 0; 00477 int len = 0; 00478 00479 len = ber_get_length_myAnalogValue(&simpleSAV->instMag); 00480 total += len + getLengthBytes(len) + 1; 00481 len = BER_GET_LENGTH_CTYPE_QUALITY(&simpleSAV->q); 00482 total += len + getLengthBytes(len) + 1; 00483 00484 return total; 00485 } 00486 int ber_encode_simpleSAV(unsigned char *buf, struct simpleSAV *simpleSAV) { 00487 int offset = 0; 00488 00489 buf[offset++] = 0xA2; 00490 offset += encodeLength(&buf[offset], ber_get_length_simpleSAV(simpleSAV)); 00491 00492 offset += ber_encode_myAnalogValue(&buf[offset], &simpleSAV->instMag); 00493 offset += BER_ENCODE_CTYPE_QUALITY(&buf[offset], &simpleSAV->q); 00494 00495 return offset; 00496 } 00497 int ber_get_length_Itl() { 00498 int total = 0; 00499 int len = 0; 00500 00501 len = ber_get_length_myAnalogValue(&E1Q1SB1.S1.C1.TVTR_1.Vol.instMag); 00502 total += len + getLengthBytes(len) + 1; 00503 len = ber_get_length_myPos(&E1Q1SB1.S1.C1.CSWI_1.Pos); 00504 total += len + getLengthBytes(len) + 1; 00505 len = ber_get_length_myPos(&E1Q1SB1.S1.C1.CSWI_2.Pos); 00506 total += len + getLengthBytes(len) + 1; 00507 len = BER_GET_LENGTH_CTYPE_ENUM((CTYPE_ENUM *) &E1Q1SB1.S1.C1.MMXU_1.Mod.stVal); 00508 total += len + getLengthBytes(len) + 1; 00509 len = ber_get_length_myMV(&E1Q1SB1.S1.C1.MMXU_1.Amps); 00510 total += len + getLengthBytes(len) + 1; 00511 len = ber_get_length_myMV(&E1Q1SB1.S1.C1.MMXU_1.Volts); 00512 total += len + getLengthBytes(len) + 1; 00513 00514 return total; 00515 } 00516 int ber_encode_Itl(unsigned char *buf) { 00517 int offset = 0; 00518 00519 offset += ber_encode_myAnalogValue(&buf[offset], &E1Q1SB1.S1.C1.TVTR_1.Vol.instMag); 00520 offset += ber_encode_myPos(&buf[offset], &E1Q1SB1.S1.C1.CSWI_1.Pos); 00521 offset += ber_encode_myPos(&buf[offset], &E1Q1SB1.S1.C1.CSWI_2.Pos); 00522 offset += BER_ENCODE_CTYPE_ENUM(&buf[offset], (CTYPE_ENUM *) &E1Q1SB1.S1.C1.MMXU_1.Mod.stVal); 00523 offset += ber_encode_myMV(&buf[offset], &E1Q1SB1.S1.C1.MMXU_1.Amps); 00524 offset += ber_encode_myMV(&buf[offset], &E1Q1SB1.S1.C1.MMXU_1.Volts); 00525 00526 return offset; 00527 } 00528 int ber_get_length_SynChk() { 00529 int total = 0; 00530 int len = 0; 00531 00532 len = ber_get_length_mySPS(&D1Q1SB4.S1.C1.RSYN_1.Rel); 00533 total += len + getLengthBytes(len) + 1; 00534 00535 return total; 00536 } 00537 int ber_encode_SynChk(unsigned char *buf) { 00538 int offset = 0; 00539 00540 offset += ber_encode_mySPS(&buf[offset], &D1Q1SB4.S1.C1.RSYN_1.Rel); 00541 00542 return offset; 00543 } 00544 int ber_get_length_MMXUResult() { 00545 int total = 0; 00546 int len = 0; 00547 00548 len = ber_get_length_simpleWYE(&D1Q1SB4.S1.C1.MMXU_1.A); 00549 total += len + getLengthBytes(len) + 1; 00550 00551 return total; 00552 } 00553 int ber_encode_MMXUResult(unsigned char *buf) { 00554 int offset = 0; 00555 00556 offset += ber_encode_simpleWYE(&buf[offset], &D1Q1SB4.S1.C1.MMXU_1.A); 00557 00558 return offset; 00559 } 00560 00561
Generated on Mon Jul 18 2022 18:17:52 by
1.7.2