Beispiel #1
0
        public async Task <bool> Delete(IPortPlug port, MessageStorageItem item, DeleteFlag deleteFlag = DeleteFlag.SpecifiedByIndex)
        {
            bool result = false;

            if (item == null || !item.IsValid)
            {
                return(result);
            }

            if (await setFormat(port))
            {
                var deleteParam = new CommandParameter($"{item.Index},{deleteFlag.ToValueString()}", Constants.BasicSuccessfulResponse);
                var deleteCmd   = new ParamATCommand(ATCommand.MessageDelete.Command(), deleteParam);

                await deleteCmd.ExecuteAsync(port);

                result = deleteCmd.Succeeded();
            }

            return(result);
        }
Beispiel #2
0
        public async Task <MessageDetails> Read(IPortPlug port, MessageStorageItem item)
        {
            MessageDetails result = new MessageDetails();

            if (item == null || !item.IsValid || !_manager.ContainsProfile("default-receive"))
            {
                return(result);
            }

            if (await setFormat(port))
            {
                var readParam = new CommandParameter(item.Index.ToString(), Constants.BasicSuccessfulResponse);
                var readCmd   = new ParamATCommand(ATCommand.MessageRead.Command(), readParam);

                await readCmd.ExecuteAsync(port);

                if (readCmd.Succeeded())
                {
                    result = getMessage(readCmd.Response);
                }
            }

            return(result);
        }