public async Task <bool> SelectStorage(IPortPlug port, Constants.MessageStorage readStore = Constants.MessageStorage.MobileEquipment, Constants.MessageStorage writeStore = Constants.MessageStorage.Unspecified, Constants.MessageStorage receivedStore = Constants.MessageStorage.Unspecified) { if (readStore == Constants.MessageStorage.Unspecified) { return(false); } var storageParam = new CommandParameter(getStorageParam(readStore, writeStore, receivedStore), Constants.BasicSuccessfulResponse); var storageCmd = new ParamATCommand(ATCommand.MessageStorage.Command(), storageParam); await storageCmd.ExecuteAsync(port); return(storageCmd.Succeeded()); }
public async Task <bool> Authenticate(IPortPlug port, int pin) { if (pin < 0) { return(false); } var pinParam = new CommandParameter(pin.ToString(), Constants.BasicSuccessfulResponse); var pinCmd = new ParamATCommand(ATCommand.PinAuthenticate.Command(), pinParam); await pinCmd.ExecuteAsync(port); return(pinCmd.Succeeded()); }
public async Task <bool> SetAddress(IPortPlug port, long address, bool international) { if (address < 0) { return(false); } var sign = international ? "+" : string.Empty; var tosca = international ? Constants.InternationalAddressType : Constants.DomesticAddressType; var scaParam = new CommandParameter($"\"{sign}{address}\",{tosca}", Constants.BasicSuccessfulResponse); var scaCmd = new ParamATCommand(ATCommand.ServiceCenterAddress.Command(), scaParam); await scaCmd.ExecuteAsync(port); return(scaCmd.Succeeded()); }
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); }
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); }