Rev 883 | Rev 967 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 883 | Rev 955 | ||
|---|---|---|---|
| Line 56... | Line 56... | ||
| 56 | } |
56 | } |
| 57 | break; |
57 | break; |
| 58 | 58 | ||
| 59 | case SNS_SIMPLEDTMF_STATE_SEND: |
59 | case SNS_SIMPLEDTMF_STATE_SEND: |
| 60 | //if ((rxbuffer[0] == 0xa || rxbuffer[0] == 0xb) && rxbuffer[rxlen-1] == 0xc) { |
60 | //if ((rxbuffer[0] == 0xa || rxbuffer[0] == 0xb) && rxbuffer[rxlen-1] == 0xc) { |
| 61 | StdCan_Set_class(txMsg.Header, |
61 | StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_SNS); |
| 62 | StdCan_Set_direction(txMsg.Header, |
62 | StdCan_Set_direction(txMsg.Header, DIRECTIONFLAG_FROM_OWNER); |
| 63 | txMsg.Header.ModuleType = |
63 | txMsg.Header.ModuleType = CAN_MODULE_TYPE_SNS_SIMPLEDTMF; |
| 64 | txMsg.Header.ModuleId = sns_SimpleDTMF_ID; |
64 | txMsg.Header.ModuleId = sns_SimpleDTMF_ID; |
| 65 | txMsg.Header.Command = |
65 | txMsg.Header.Command = CAN_MODULE_CMD_PHYSICAL_PHONENUMBER; |
| 66 | 66 | ||
| 67 | for (uint8_t i = 0; i < 16; i=i+2) { |
67 | for (uint8_t i = 0; i < 16; i=i+2) { |
| 68 | txMsg.Data[i>>1] = rxbuffer[i]<<4; |
68 | txMsg.Data[i>>1] = rxbuffer[i]<<4; |
| 69 | 69 | ||
| 70 | if (i+1 < rxlen) |
70 | if (i+1 < rxlen) |
| Line 80... | Line 80... | ||
| 80 | } |
80 | } |
| 81 | } |
81 | } |
| 82 | 82 | ||
| 83 | void sns_SimpleDTMF_HandleMessage(StdCan_Msg_t *rxMsg) |
83 | void sns_SimpleDTMF_HandleMessage(StdCan_Msg_t *rxMsg) |
| 84 | { |
84 | { |
| 85 | /*if ( StdCan_Ret_class(rxMsg->Header) == |
85 | /*if ( StdCan_Ret_class(rxMsg->Header) == CAN_MODULE_CLASS_SNS && ///TODO: Change this to the actual class type |
| 86 | StdCan_Ret_direction(rxMsg->Header) == DIR_TO_OWNER && |
86 | StdCan_Ret_direction(rxMsg->Header) == DIR_TO_OWNER && |
| 87 | rxMsg->Header.ModuleType == |
87 | rxMsg->Header.ModuleType == CAN_MODULE_TYPE_SNS_SIMPLEDTMF && ///TODO: Change this to the actual module type |
| 88 | rxMsg->Header.ModuleId == sns_SimpleDTMF_ID) |
88 | rxMsg->Header.ModuleId == sns_SimpleDTMF_ID) |
| 89 | { |
89 | { |
| 90 | switch (rxMsg->Header.Command) |
90 | switch (rxMsg->Header.Command) |
| 91 | { |
91 | { |
| 92 | case CAN_CMD_MODULE_DUMMY: |
92 | case CAN_CMD_MODULE_DUMMY: |
| Line 98... | Line 98... | ||
| 98 | 98 | ||
| 99 | void sns_SimpleDTMF_List(uint8_t ModuleSequenceNumber) |
99 | void sns_SimpleDTMF_List(uint8_t ModuleSequenceNumber) |
| 100 | { |
100 | { |
| 101 | StdCan_Msg_t txMsg; |
101 | StdCan_Msg_t txMsg; |
| 102 | 102 | ||
| 103 | StdCan_Set_class(txMsg.Header, |
103 | StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_SNS); |
| 104 | StdCan_Set_direction(txMsg.Header, |
104 | StdCan_Set_direction(txMsg.Header, DIRECTIONFLAG_FROM_OWNER); |
| 105 | txMsg.Header.ModuleType = |
105 | txMsg.Header.ModuleType = CAN_MODULE_TYPE_SNS_SIMPLEDTMF; |
| 106 | txMsg.Header.ModuleId = sns_SimpleDTMF_ID; |
106 | txMsg.Header.ModuleId = sns_SimpleDTMF_ID; |
| 107 | txMsg.Header.Command = |
107 | txMsg.Header.Command = CAN_MODULE_CMD_GLOBAL_LIST; |
| 108 | txMsg.Length = 6; |
108 | txMsg.Length = 6; |
| 109 | 109 | ||
| 110 | txMsg.Data[0] = NODE_HW_ID_BYTE0; |
110 | txMsg.Data[0] = NODE_HW_ID_BYTE0; |
| 111 | txMsg.Data[1] = NODE_HW_ID_BYTE1; |
111 | txMsg.Data[1] = NODE_HW_ID_BYTE1; |
| 112 | txMsg.Data[2] = NODE_HW_ID_BYTE2; |
112 | txMsg.Data[2] = NODE_HW_ID_BYTE2; |