import {ZiGateMessageCode} from "./constants"; export interface ZiGateMessageParameter { name: string; parameterType: string; options?: object; } export interface ZiGateMessageType { response: ZiGateMessageParameter[]; } export const ZiGateMessage: { [k: number]: ZiGateMessageType } = { [ZiGateMessageCode.GetTimeServer]: { response: [ {name: 'timestampUTC', parameterType:'UINT32'}, // from 2000-01-01 00:00:00 ] }, [ZiGateMessageCode.DeviceAnnounce]: { response: [ {name: 'shortAddress', parameterType:'UINT16BE'}, {name: 'ieee', parameterType:'IEEEADDR'}, {name: 'MACcapability', parameterType:'MACCAPABILITY'}, // MAC capability // Bit 0 – Alternate PAN Coordinator // Bit 1 – Device Type // Bit 2 – Power source // Bit 3 – Receiver On when Idle // Bit 4,5 – Reserved // Bit 6 – Security capability // Bit 7 – Allocate Address {name: 'rejoin', parameterType:'UINT8'}, ] }, [ZiGateMessageCode.Status]: { response: [ {name: 'status', parameterType:'UINT8'}, // // 0 = Success // 1 = Incorrect parameters // 2 = Unhandled command // 3 = Command failed // eslint-disable-next-line max-len // 4 = Busy (Node is carrying out a lengthy operation and is currently unable to handle the incoming command) // 5 = Stack already started (no new configuration accepted) // 128 – 244 = Failed (ZigBee event codes) // Packet Type: The value of the initiating command request. {name: 'sequence', parameterType: 'UINT8'}, // {name: 'packetType', parameterType: 'UINT16BE'}, // {name: 'rawError', parameterType: 'BUFFER'}, // ] }, [ZiGateMessageCode.PermitJoinStatus]: { response: [ {name: 'status', parameterType:'UINT8'}, // ] }, [ZiGateMessageCode.DataIndication]: { response: [ {name: 'status', parameterType:'UINT8'}, // {name: 'profileID', parameterType:'UINT16BE'}, // {name: 'clusterID', parameterType: 'UINT16BE'}, // {name: 'sourceEndpoint', parameterType: 'UINT8'}, // {name: 'destinationEndpoint', parameterType: 'UINT8'}, // {name: 'sourceAddressMode', parameterType: 'UINT8'}, // {name: 'sourceAddress', parameterType: 'ADDRESS_WITH_TYPE_DEPENDENCY'}, // {name: 'destinationAddressMode', parameterType: 'UINT8'}, // {name: 'destinationAddress', parameterType: 'ADDRESS_WITH_TYPE_DEPENDENCY'}, // // {name: 'payloadSize', parameterType:'UINT8'}, // {name: 'payload', parameterType: 'BUFFER_RAW'}, // ] }, [ZiGateMessageCode.APSDataConfirm]: { response: [ {name: 'status', parameterType:'UINT8'}, // // {name: 'sourceEndpoint', parameterType:'UINT8'}, // // {name: 'destinationAddressMode', parameterType:'UINT8'}, // // {name: 'destinationAddress', parameterType:'UINT16BE'}, {name: 'destinationEndpoint', parameterType:'UINT8'}, // {name: 'clusterID', parameterType:'UINT16BE'}, // // {name: 'seqNumber', parameterType:'UINT8'}, // ] }, [ZiGateMessageCode.NetworkState]: { response: [ {name: 'shortAddress', parameterType:'UINT16BE'}, // {name: 'extendedAddress', parameterType:'IEEEADDR'}, // {name: 'PANID', parameterType:'UINT16BE'}, // {name: 'ExtPANID', parameterType:'IEEEADDR'}, // {name: 'Channel', parameterType:'UINT8'}, // ] }, [ZiGateMessageCode.VersionList]: { response: [ {name: 'majorVersion', parameterType: 'UINT16BE'}, // {name: 'installerVersion', parameterType: 'UINT16BE'}, // ] }, [ZiGateMessageCode.NetworkJoined]: { response: [ {name: 'status', parameterType:'UINT8'}, // // Status: // 0 = Joined existing network // 1 = Formed new network // 128 – 244 = Failed (ZigBee event codes) {name: 'shortAddress', parameterType:'UINT16BE'}, // {name: 'extendedAddress', parameterType:'IEEEADDR'}, // {name: 'channel', parameterType:'UINT8'}, // ] }, [ZiGateMessageCode.LeaveIndication]: { response: [ {name: 'extendedAddress', parameterType:'IEEEADDR'}, // {name: 'rejoin', parameterType:'UINT8'}, // ] }, [ZiGateMessageCode.RouterDiscoveryConfirm]: { response: [ {name: 'status', parameterType:'UINT8'}, // {name: 'nwkStatus', parameterType:'UINT8'}, // ] }, [ZiGateMessageCode.APSDataConfirmFail]: { response: [ {name: 'status', parameterType:'UINT8'}, // {name: 'sourceEndpoint', parameterType:'UINT8'}, // {name: 'destinationEndpoint', parameterType:'UINT8'}, // {name: 'destinationAddressMode', parameterType:'UINT8'}, // {name: 'destinationAddress', parameterType:'ADDRESS_WITH_TYPE_DEPENDENCY'}, // {name: 'seqNumber', parameterType:'UINT8'}, // ] }, [ZiGateMessageCode.ActiveEndpointResponse]: { response: [ {name: 'sequence', parameterType:'UINT8'}, // {name: 'status', parameterType:'UINT8'}, // {name: 'nwkAddr', parameterType:'UINT16'}, {name: 'endpointCount', parameterType:'UINT8'}, {name: 'endpoints', parameterType: 'LIST_UINT8'}, ] }, [ZiGateMessageCode.SimpleDescriptorResponse]: { response: [ {name: 'sourceEndpoint', parameterType:'UINT8'}, // {name: 'profile ID', parameterType:'UINT8'}, // {name: 'clusterID', parameterType:'UINT16'}, // {name: 'attributeList', parameterType:'LIST_UINT16BE'}, // ] }, };