SmsEncoderDecoder/Inc/SmsEncoderDecoder.h

120 lines
1.8 KiB
C

/*
* SMS.h
*
* Created on: Dec 4, 2020
* Author: FICOM-IT LTD
*/
//gitfix
#ifndef SMS_INC_SMS_H_
#define SMS_INC_SMS_H_
#include <string.h>
#include "stdint.h"
#include "stdbool.h"
#include "SmsUtfUtils.h"
#include "MemoryAllocationInterface.h"
#define MAX_SMS_NR 32
typedef enum {
BIT7 = 0, // GSM
BIT8 = 1, // ASCII
UCS2 = 2, // Unicode
BIT8_HEX = 3,
} tEnumDCS;
enum EnumUDL {
BIT7UDL = 160,
BIT8UDL = 140,
BIT8_HEX_UDL = 280,
UCS2UDL = 70
};
enum EnumCSMIEI {
BIT8MIEI = 0,
BIT16MIEI = 8
};
typedef struct {
unsigned int count;
char IEI;
char *IED;
} tPDUUDH;
typedef struct {
int count;
tPDUUDH *UDH;
} tUDHS;
typedef struct {
unsigned int total;
char **Data;
} tUDS;
typedef struct {
unsigned int Length;
char *Data;
} tUserRawDataSinglePackage;
typedef struct {
unsigned int total;
char *Packages;
} tUserRawDataPackages;
typedef struct {
unsigned int count;
unsigned int opacity;
char **PDU;
} tPDUS;
typedef struct {
char *array;
unsigned int len;
} tByteArray;
typedef struct {
char *SCA;
char *OA;
char *SCTS;
tUDHS *UDH;
char *UD;
int UDL;
bool RP;
bool UDHI;
bool SRI;
bool MMS;
int MTI;
char PID;
tEnumDCS DCS;
bool TC;
int MC;
} tSMS_Struct;
#define SUB_STR_SIZE 512
typedef struct {
enum EnumCSMIEI mCSMIEI;
char *mSCA;
bool mSRR;
bool mRD;
char *mVP;
int mCSMMR;
char temp[SUB_STR_SIZE];
tMemAllocInterface *mem;
} tSmsPdu;
void tSmsPdu_Init(tSmsPdu *env, tMemAllocInterface *mem);
tSMS_Struct SmsPdu_Decode(tSmsPdu *env, const char *data, uint16_t len);
tPDUS *SmsPdu_Encode(tSmsPdu *env, char *DA, char *UDC, tUDHS *udhs, tEnumDCS DCS);
#endif /* SMS_INC_SMS_H_ */