The Common Header
The common header contains generic information about the message such as the protocol version number and the type of request. The ASN.1 format of the common header is shown in Figure 8.
CommonHeader ::= IMPLICIT SEQUENCE {
link IMPLICIT INTEGER,
messageType IMPLICIT INTEGER,
messageId IMPLICIT INTEGER,
resourceId ANY
}
Figure 8: ASN.1 Format of Common Header
The link indicates which version of HEMS is in use.
The messageType is a value indicating whether the message is a request (0), reply (1), event (2), protocol error (3) or application error (4) message.
The messageId is a unique bit identifier, which is set in the request message, and echoed in the response. It allows applications to match responses to their corresponding request. Applications should choose messageIds such that a substantial period of time elapses before a messageId is re-used by a particular application (even across machine crashes).
Event messages also use the messageId field to indicate the number of the current event message. By comparing messageId fields from events lost, event values may be detected. The event messageId should be reset to 0 on every reboot, and by convention, the event message with messageId of 0 should always be a "reboot" event. (Facilities should be provided in the event message definition to allow entities which are capable of storing messageIds across reboots to send the highest messageId reached before the reboot.)
The resourceId is defined for ISO compatibility and corresponds to the resource ID used by the Common Management Information Protocol to identify the relevant ISO resource.