//
// Node Messages basic message and message signature definitions
//

// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Define ENUM TStateChangeStage before including this file
// Define ENUM ActivityId before including this file
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

CONST KNodeMessagesImplementationUid = 0x10285F38


ENUM ActivityId : UINT8
	ActivityTimer = 1
	ActivityTrafficLight = 2
	ActivityController = 3
END ENUM

ENUM NM_SignatureId : UINT32
    ESignalBase                          =0
    ENodeSignal                          =1
    ESignatureBase                       =2
    ESignatureNumber                     =3
    ESignatureUid                        =4
    ESignatureErrContext                 =5
    ESignatureErrResponse                =6
	
    ESignatureNodeId                     =8
    ESignatureNodeIdNumber               =9
    ESignatureNodeIdNumberNumber         =10
    ESignatureMessageIdNumber            =11
    ESignatureAnyNumber                  =12
    ESignatureMetaDataPtr                =13
    ESignatureNumberNumberNumber         =14
    ESignatureRMessage2                  =15
    ESignatureNumberRMessage2            =16
    ESignatureAny                        =17
    ESignatureNumberNumber               =18
    ESignatureNodeIdAny                  =19
    ESignatureNodeIdNodeId               =20
    ESignatureNodeIdNodeIdNumber         =21
    ESignatureNumberNumberNumberNumber   =22
    ESignatureUidNumber                  =23
    ESignatureNumberUidNumber            =24
    ESignatureNodeIdClientType           =25
    ESignatureClientTypeUidClientType    =26
    ESignatureClientType                 =27
    ESignatureClientTypeUid              =28
    ESignatureMessageId                  =29
    ESignatureNodeIdNumberNumberNumber   =30
    ESignatureTypeId                     =31
END ENUM


CONTEXT Context_RuntimeCtxId
//    UINT8 iSize
//    UINT8 iSalt
//    UINT16 iThread
//    UINT32 iScope
      PAD 8
END CONTEXT

CONTEXT Context_NodeId : Context_RuntimeCtxId 
    UINT32 iPtr
END CONTEXT

CONTEXT Context_NodeCtxId : Context_NodeId 
    ActivityId iNodeCtx		// low byte of activity id
    PAD 1			// high byte of activity id
    PAD 2 // 2-byte padding
END CONTEXT

ALIAS CONTEXT TCommsId = Context_NodeId

STRUCT STypeId
    UINT32 iUid
    UINT32 iTypeId
END STRUCT
	
SIGNATURE TSignalBase
    TYPEID = KNodeMessagesImplementationUid:ESignalBase
END SIGNATURE

SIGNATURE TNodeSignal : TSignalBase
    TYPEID = KNodeMessagesImplementationUid:ENodeSignal
    TMessageId iMessageId
END SIGNATURE

// Synonymous with TSigVoid
SIGNATURE TSignatureBase : TNodeSignal
    TYPEID = KNodeMessagesImplementationUid:ESignatureBase
END SIGNATURE

SIGNATURE TSigNumber : TSignatureBase
    TYPEID = KNodeMessagesImplementationUid:ESignatureNumber
    UINT32 iValue
END SIGNATURE 

ALIAS SIGNATURE TSigVoid = TSignatureBase


CONST KExampleRealmId = 0x2002D4B3

ENUM Base_MessageId : UINT16
     EGoGreen  = 1
     EGoneRed = 2
     EWait = 3
     EGo = 4
END ENUM

MESSAGE GoGreen
    SIGNATURE = TSignatureBase
    MESSAGEID = KExampleRealmId:EGoGreen
END MESSAGE

MESSAGE GoneRed
    SIGNATURE = TSignatureBase
    MESSAGEID = KExampleRealmId:EGoneRed
END MESSAGE

MESSAGE Wait
    SIGNATURE = TSigNumber
    MESSAGEID = KExampleRealmId:EWait
END MESSAGE

MESSAGE Go
    SIGNATURE = TSignatureBase
    MESSAGEID = KExampleRealmId:EGo
END MESSAGE




