|
@@ -3098,6 +3098,43 @@ int main(int argc, char *argv[]) {
|
|
|
printf("%s\n", json_object_to_json_string(jobj4));
|
|
|
json_object_put(jobj4);
|
|
|
}
|
|
|
+
|
|
|
+ // get status code
|
|
|
+ if(strcmp(argv[1], "StatusCode") == 0)
|
|
|
+ {
|
|
|
+ int type = atoi(argv[2]);
|
|
|
+ int bytes = atoi(argv[3]);
|
|
|
+ int bits = atoi(argv[4]);
|
|
|
+ struct json_object *jobj1;
|
|
|
+
|
|
|
+ //FaultCode
|
|
|
+ struct json_object *FaultCode;
|
|
|
+ //AlarmCode
|
|
|
+ struct json_object *AlarmCode;
|
|
|
+ //InfoCode
|
|
|
+ struct json_object *InfoCode;
|
|
|
+
|
|
|
+ jobj1=json_object_new_object();
|
|
|
+
|
|
|
+ //FaultCode
|
|
|
+ if(type==1){
|
|
|
+ FaultCode = json_object_new_int(((ShmStatusCodeData->FaultCode.FaultEvents.FaultVal[bytes]) >> bits) & 1);//(num >> n) & 1
|
|
|
+ json_object_object_add(jobj1,"FaultCode",FaultCode);
|
|
|
+ }
|
|
|
+ //AlarmCode
|
|
|
+ if(type==2){
|
|
|
+ AlarmCode = json_object_new_int(((ShmStatusCodeData->AlarmCode.AlarmEvents.AlarmVal[bytes]) >> bits) & 1);//(num >> n) & 1
|
|
|
+ json_object_object_add(jobj1,"AlarmCode",AlarmCode);
|
|
|
+ }
|
|
|
+ //InfoCode
|
|
|
+ if(type==3){
|
|
|
+ InfoCode = json_object_new_int(((ShmStatusCodeData->InfoCode.InfoEvents.InfoVal[bytes]) >> bits) & 1);//(num >> n) & 1
|
|
|
+ json_object_object_add(jobj1,"InfoCode",InfoCode);
|
|
|
+ }
|
|
|
+ printf("%s\n", json_object_to_json_string(jobj1));
|
|
|
+ json_object_put(jobj1);
|
|
|
+
|
|
|
+ }
|
|
|
// for(;;)
|
|
|
// {
|
|
|
|