summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/protocol/nokia/mbus2.c
Side-by-side diff
Diffstat (limited to 'gammu/emb/common/protocol/nokia/mbus2.c') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/protocol/nokia/mbus2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gammu/emb/common/protocol/nokia/mbus2.c b/gammu/emb/common/protocol/nokia/mbus2.c
index f07d6c5..8353b46 100644
--- a/gammu/emb/common/protocol/nokia/mbus2.c
+++ b/gammu/emb/common/protocol/nokia/mbus2.c
@@ -1,50 +1,50 @@
/* (c) 2001-2003 by Marcin Wiacek */
-/* based on some work from MyGnokii */
+/* based on some work from MyGnokii (www.mwiacek.com) */
#include "../../gsmstate.h"
#ifdef GSM_ENABLE_MBUS2
#include <stdio.h>
#include <string.h>
#include "../../gsmcomon.h"
#include "mbus2.h"
static GSM_Error MBUS2_WriteMessage (GSM_StateMachine *s,
unsigned char *MsgBuffer,
int MsgLength,
unsigned char MsgType)
{
unsigned char *buffer2, checksum = 0;
GSM_Protocol_MBUS2Data *d = &s->Protocol.Data.MBUS2;
int i, sent, len;
GSM_DumpMessageLevel3(s, MsgBuffer, MsgLength, MsgType);
buffer2 = (unsigned char *)malloc(MsgLength + 8);
buffer2[0] = MBUS2_FRAME_ID;
buffer2[1] = MBUS2_DEVICE_PHONE; // destination
buffer2[2] = MBUS2_DEVICE_PC; // source
buffer2[3] = MsgType;
buffer2[4] = MsgLength / 256;
buffer2[5] = MsgLength % 256;
memcpy(buffer2 + 6, MsgBuffer, MsgLength);
len = 6 + MsgLength;
/* According to http://www.flosys.com/tdma/n5160.html some phones
* can have problems with checksum equal 0x1F. Phones can recognize
* received frame, but won't send ACK for it. When checksum is 0x1F,
* we increment the sequence number
*/
do {
d->MsgSequenceNumber++;
buffer2[len] = d->MsgSequenceNumber;
/* Calculating checksum */
checksum = 0;
for (i = 0; i < len + 1; i++) checksum ^= buffer2[i];
} while (checksum == 0x1f);