Wednesday 11 April 2018

ASN.1: BOOLEAN type: Represent TRUE/FALSE states

Type: BOOLEAN
Description: Boolean is used to represent TRUE, FALSE states. It is similar to boolean type in programming languages. 

Example
isPassedInExam BOOLEAN ::= TRUE
canIReadTheFile BOOLEAN ::= FALSE

Example schema
Employee ::= SEQUENCE {
 firstName VisibleString,
 lastName VisibleString,
 isPermanentEmployee BOOLEAN
}

Data can be represented like below.

employee1 Employee ::= {
 firstName "Hari Krishna",
 lastName "Gurram",
 isPermanentEmployee FALSE
}


employee2 Employee ::= {
 firstName "Venkata",
 lastName "Madala",
 isPermanentEmployee TRUE
}

XML encoding of the above data looks like below.

<?xml version="1.0" encoding="UTF-8"?>
<Employee>
  <firstName>Hari Krishna</firstName>
  <lastName>Gurram</lastName>
  <isPermanentEmployee><false/></isPermanentEmployee>
</Employee>


<?xml version="1.0" encoding="UTF-8"?>
<Employee>
  <firstName>Venkata</firstName>
  <lastName>Madala</lastName>
  <isPermanentEmployee><true/></isPermanentEmployee>
</Employee>




Previous                                                 Next                                                 Home

No comments:

Post a Comment