Module Gammu.SMS

SMS messages manipulation.

type state =
| Sent
| Unsent
| Read
| Unread

Status of SMS message.

type udh =
| No_udh

(** Simple message, content in SMS.text *)

| ConcatenatedMessages

(** Linked SMS. *)

| ConcatenatedMessages16bit

(** Linked SMS with 16 bit reference. *)

| DisableVoice
| DisableFax
| DisableEmail
| EnableVoice
| EnableFax
| EnableEmail
| VoidSMS
| NokiaRingtone
| NokiaRingtoneLong
| NokiaOperatorLogoLong
| NokiaWAP
| NokiaWAPLong
| NokiaCalendarLong
| NokiaProfileLong
| NokiaPhonebookLong
| UserUDH
| MMSIndicatorLong

Types of UDH (User Data Header).

type udh_header = {
udh : udh;

(** UDH type. *)

udh_text : string;

(** UDH text. *)

id8bit : int;

(** 8-bit ID, when required (<= 0 otherwise). *)

id16bit : int;

(** 16-bit ID, when required (<= 0 otherwise). *)

part_number : int;

(** Number of current part. *)

all_parts : int;

(** Total number of parts. *)

}

Structure for User Data Header.

type format =
| Pager
| Fax
| Email
| Text

Format of SMS messages. See GSM 03.40 section 9.2.3.9.

type validity =
| Not_available
| Relative of char

(** Validity lengths for SMS messages. See GSM 03.40 section 9.2.3.12.1 for meanings. *)

type smsc = {
smsc_location : int;

(** Number of the SMSC on SIM *)

smsc_name : string;

(** Name of the SMSC *)

smsc_number : string;

(** SMSC phone number *)

validity : validity;

(** Validity of SMS messges. *)

format : format;

(** Format of sent SMS messages. *)

default_number : string;

(** Default recipient number. In old DCT3 ignored. *)

}

SMSC (SMS Center)

type message_type =
| Deliver

(** SMS in Inbox. *)

| Status_Report

(** Delivery Report *)

| Submit

(** SMS for sending or in Outbox *)

type coding =
| Unicode_No_Compression

(** Unicode *)

| Unicode_Compression
| Default_No_Compression

(** Default GSM alphabet. *)

| Default_Compression
| Eight_bit

(** 8-bit. *)

type message = {
replace : char;

(** Message to be replaced. *)

reject_duplicates : bool;

(** Whether to reject duplicates. *)

udh_header : udh_header;

(** UDH (User Data Header) *)

number : string;

(** Sender or recipient number. *)

other_numbers : string array;
smsc : smsc;

(** SMS Center *)

memory : memory_type;

(** For saved SMS: where exactly it's saved (SIM/phone). *)

message_number : int;

(** For saved SMS: location of SMS in memory. *)

folder : int;

(** For saved SMS: number of folder, where SMS is saved. *)

inbox_folder : bool;

(** For saved SMS: whether SMS is really in Inbox. *)

state : state;

(** Status (read, unread,...) of SMS message. *)

nokia_name : string;

(** Name in Nokia with SMS memory (6210/7110, etc.) Ignored in other. *)

text : string;

(** Text for SMS. May be encoded as plain 8bit ASCII or as UTF8 according to the coding field. *)

pdu : message_type;

(** Type of message. *)

coding : coding;

(** Type of coding. *)

date_time : DateTime.t;

(** Date and time, when SMS was saved or sent. *)

smsc_time : DateTime.t;

(** Date of SMSC response in DeliveryReport messages. *)

delivery_status : char;

(** In delivery reports: status. *)

reply_via_same_smsc : bool;

(** Indicates whether "Reply via same center" is set. *)

sms_class : char;

(** SMS class (0 is flash SMS, 1 is normal one). *)

message_reference : char;

(** Message reference. *)

}
type multi_sms = message array

Multiple SMS messages, used for Smart Messaging 3.0/EMS.

val default_received : message

Empty message with default values needed for saving a received SMS.

val get : t ‑> folder:int ‑> message_number:int ‑> multi_sms

Read a SMS message.

val fold : t ‑> ?⁠folder:int ‑> ?⁠n:int ‑> ?⁠retries:int ‑> ?⁠on_err:(int ‑> error ‑> unit) ‑> ('a ‑> multi_sms ‑> 'a) ‑> 'a ‑> 'a

fold s f a fold SMS messages through the function f with a as initial value, iterating trough SMS' *and* folders).

This function uses the GSM_GetNextSMS function from libGammu. This might be faster for some phones than using Gammu.SMS.get for each message.

Please note that this command may not mark the messages as read in the phone. To make sure they are, call Gammu.SMS.get.

val set : t ‑> message ‑> int * int

set s sms sets sms at the specified location and folder (given in SMS.message representation). And returns a couple for folder and location really set (after transformation).

val add : t ‑> message ‑> int * int

add s sms adds sms to the folder specified in the folder field of sms and returns the couple folder and location where the message was stored (folder may be transformed). The location fields of sms are ignored when adding SMS, put whatever you want there.

val send : t ‑> message ‑> unit

send s sms sends the sms.

type folder = {
box : folder_box;

(** Whether it is inbox or outbox. *)

folder_memory : memory_type;

(** Where exactly it's saved. *)

name : string;

(** Name of the folder. *)

}
type folder_box =
| Inbox
| Outbox
val folders : t ‑> folder array
type memory_status = {
sim_unread : int;

(** Number of unread messages on SIM. *)

sim_used : int;

(** Number of saved messages (including unread) on SIM. *)

sim_size : int;

(** Number of possible messages on SIM. *)

templates_used : int;

(** Number of used templates (62xx/63xx/7110/etc.). *)

phone_unread : int;

(** Number of unread messages in phone. *)

phone_used : int;

(** Number of saved messages in phone. *)

phone_size : int;

(** Number of possible messages on phone. *)

}

Status of SMS memory.

val get_status : t ‑> memory_status

Get information about SMS memory (read/unread/size of memory for both SIM and phone).

val set_incoming_sms : t ‑> bool ‑> unit

Enable/disable notification on incoming SMS.

val delete : t ‑> folder:int ‑> message_number:int ‑> unit

Deletes SMS (SMS location and folder must be set).

type encode_part_type_id =
| Text

(** 1 text SMS. *)

| ConcatenatedTextLong

(** Contacenated SMS, when longer than 1 SMS. *)

| ConcatenatedAutoTextLong

(** Contacenated SMS, auto Default/Unicode coding. *)

| ConcatenatedTextLong16bit
| ConcatenatedAutoTextLong16bit
| NokiaProfileLong

(** Nokia profile = Name, Ringtone, ScreenSaver *)

| NokiaPictureImageLong

(** Nokia Picture Image + (text) *)

| NokiaScreenSaverLong

(** Nokia screen saver + (text) *)

| NokiaRingtone

(** Nokia ringtone - old SM2.0 format, 1 SMS *)

| NokiaRingtoneLong

(** Nokia ringtone contacenated, when very long *)

| NokiaOperatorLogoLong

(** Nokia 72x14 op logo or 78x21 in 2 SMS *)

| NokiaWAPBookmarkLong

(** Nokia WAP bookmark in 1 or 2 SMS *)

| NokiaWAPSettingsLong

(** Nokia WAP settings in 2 SMS *)

| NokiaMMSSettingsLong

(** Nokia MMS settings in 2 SMS *)

| NokiaVCARD10Long

(** Nokia VCARD 1.0 (only name and default number) *)

| NokiaVCARD21Long

(** Nokia VCARD 2.1 (all numbers + text) *)

| NokiaVCALENDAR10Long

(** Nokia VCALENDAR 1.0 (can be in few sms) *)

| NokiaVTODOLong
| VCARD10Long
| VCARD21Long
| DisableVoice
| DisableFax
| DisableEmail
| EnableVoice
| EnableFax
| EnableEmail
| VoidSMS
| EMSSound10

(** IMelody 1.0 *)

| EMSSound12

(** IMelody 1.2 *)

| EMSSonyEricssonSound

(** IMelody without header, SonyEricsson extension *)

| EMSSound10Long

(** IMelody 1.0 with UPI. *)

| EMSSound12Long

(** IMelody 1.2 with UPI. *)

| EMSSonyEricssonSoundLong

(** IMelody without header with UPI. *)

| EMSPredefinedSound
| EMSPredefinedAnimation
| EMSAnimation
| EMSFixedBitmap

(** Fixed bitmap of size 16x16 or 32x32. *)

| EMSVariableBitmap
| EMSVariableBitmapLong
| MMSIndicatorLong

(** MMS message indicator. *)

| WAPIndicatorLong
| AlcatelMonoBitmapLong

(** Variable bitmap with black and white colors *)

| AlcatelMonoAnimationLong

(** Variable animation with black and white colors *)

| AlcatelSMSTemplateName
| SiemensFile

(** Siemens OTA *)

ID during packing SMS for Smart Messaging 3.0, EMS and other

type info = {
id : encode_part_type_id;
nbr : int;
protected : bool;
buffer : string;
left : bool;
right : bool;
center : bool;
large : bool;
small : bool;
bold : bool;
italic : bool;
underlined : bool;
strikethrough : bool;
ringtone_notes : int;
}

SMS information, like type, text, text properties, etc...

type multipart_info = {
unicode_coding : bool;
info_class : int;
replace_message : char;
unknown : bool;
entries : info array;
}

Multipart SMS Information

val decode_multipart : ?⁠debug:Debug.info ‑> ?⁠ems:bool ‑> multi_sms ‑> multipart_info

decode_multipart sms Decode the multi part SMS sms to "readable" format. sms is modified. Return a Gammu.SMS.multipart_info associated.