Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1 строка
5.8 KiB

  1. {"kind":"symbol","schemaVersion":{"major":0,"minor":3,"patch":0},"hierarchy":{"paths":[["doc:\/\/rpm.com.production.Scanner\/documentation\/Fueling","doc:\/\/rpm.com.production.Scanner\/documentation\/Fueling\/FuelingAPIVIew"]]},"sections":[],"metadata":{"externalID":"s:7Fueling0A7APIVIewV8sendDatayyF","fragments":[{"kind":"keyword","text":"func"},{"text":" ","kind":"text"},{"text":"sendData","kind":"identifier"},{"kind":"text","text":"()"}],"title":"sendData()","role":"symbol","roleHeading":"Instance Method","symbolKind":"method","modules":[{"name":"Fueling"}]},"abstract":[{"text":"Sends data to the server after connecting to the specified WiFi network.","type":"text"}],"identifier":{"url":"doc:\/\/rpm.com.production.Scanner\/documentation\/Fueling\/FuelingAPIVIew\/sendData()","interfaceLanguage":"swift"},"primaryContentSections":[{"declarations":[{"tokens":[{"text":"@","kind":"attribute"},{"preciseIdentifier":"s:ScM","text":"MainActor","kind":"attribute"},{"kind":"text","text":" "},{"text":"func","kind":"keyword"},{"kind":"text","text":" "},{"kind":"identifier","text":"sendData"},{"kind":"text","text":"()"}],"platforms":["iOS"],"languages":["swift"]}],"kind":"declarations"},{"kind":"content","content":[{"level":2,"type":"heading","text":"Details:","anchor":"details"},{"inlineContent":[{"type":"text","text":"This function first disconnects from the current WiFi network, then connects to the specified WiFi network with the provided SSID and password. Once connected, it attempts to send data to the server."}],"type":"paragraph"},{"code":["func sendData() {"," CoreDataManager().closeControllerWiFi(ssid: configuration2.controllerSSID)"," print(\"WiFi Credentials: SSID - \\(userOTASSID), PWD - \\(userOTAPwd)\")"," networkMonitor.joinWiFiWithSSIDAndPwd(ssid: userOTASSID, pwd: userOTAPwd) { wifiSuccess in"," if wifiSuccess {"," print(\"Connected to WiFi\")"," isSendingData = true"," DispatchQueue.main.asyncAfter(deadline: .now() + 10, execute: {"," Task {"," do {"," if coreDataManager.isDataSendToServerTestVariable {"," print(\"Data sent successfully over wifi\")"," \/\/ Handle success, e.g., show a success message or update the UI"," } else {"," print(\"Failed to send data over WiFi\")"," \/\/ Handle failure, e.g., show an error message or retry"," DispatchQueue.main.async {"," isShowingAlert = true"," alertTitle = \"Send Data Error\""," alertMessage = \"Failed to send data to the server\""," }"," }"," } catch {"," print(\"Error sending JSON: \\(error.localizedDescription)\")"," \/\/ Handle error, e.g., show an error message"," DispatchQueue.main.async {"," isShowingAlert = true"," alertTitle = \"Send Data Error\""," alertMessage = \"An error occurred while sending data\""," }"," }"," DispatchQueue.main.async {"," isSendingData = false"," }"," }"," })"," } else {"," DispatchQueue.main.async {"," \/\/ Show connection failure alert"," isSendingData = false"," isShowingAlert = true"," alertTitle = \"Connection Error\""," alertMessage = \"Failed to join WiFi network\""," }"," }"," }"," \/\/ Reconnect to the controller after send data attempt"," \/\/ connectToController()","}",""],"syntax":"swift","type":"codeListing"}]}],"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/fueling\/fuelingapiview\/senddata()"]}],"references":{"doc://rpm.com.production.Scanner/documentation/Fueling/FuelingAPIVIew/sendData()":{"type":"topic","identifier":"doc:\/\/rpm.com.production.Scanner\/documentation\/Fueling\/FuelingAPIVIew\/sendData()","kind":"symbol","abstract":[{"type":"text","text":"Sends data to the server after connecting to the specified WiFi network."}],"url":"\/documentation\/fueling\/fuelingapiview\/senddata()","role":"symbol","title":"sendData()","fragments":[{"kind":"keyword","text":"func"},{"text":" ","kind":"text"},{"kind":"identifier","text":"sendData"},{"kind":"text","text":"()"}]},"doc://rpm.com.production.Scanner/documentation/Fueling":{"kind":"symbol","url":"\/documentation\/fueling","title":"Fueling","identifier":"doc:\/\/rpm.com.production.Scanner\/documentation\/Fueling","abstract":[{"type":"text","text":"The Scanner app is designed to facilitate secure and efficient fuel management operations, primarily focusing on user authentication, fuel data collection, and network communication. The app includes several key features to ensure seamless and reliable interactions between users and the backend systems, leveraging technologies like WebSockets, Core Data, and biometric authentication."}],"type":"topic","role":"collection"},"doc://rpm.com.production.Scanner/documentation/Fueling/FuelingAPIVIew":{"identifier":"doc:\/\/rpm.com.production.Scanner\/documentation\/Fueling\/FuelingAPIVIew","kind":"symbol","title":"FuelingAPIVIew","role":"symbol","fragments":[{"kind":"keyword","text":"struct"},{"kind":"text","text":" "},{"kind":"identifier","text":"FuelingAPIVIew"}],"navigatorTitle":[{"kind":"identifier","text":"FuelingAPIVIew"}],"abstract":[{"type":"text","text":"A view that displays and manages fueling data, allowing the user to send data to the server."}],"url":"\/documentation\/fueling\/fuelingapiview","type":"topic"}}}