Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

setuptankvalues(websocket:).json 8.3 KiB

1
  1. {"variants":[{"paths":["\/documentation\/fueling\/scanview2\/setuptankvalues(websocket:)"],"traits":[{"interfaceLanguage":"swift"}]}],"identifier":{"url":"doc:\/\/rpm.com.production.Scanner\/documentation\/Fueling\/ScanView2\/setupTankValues(webSocket:)","interfaceLanguage":"swift"},"metadata":{"role":"symbol","externalID":"s:7Fueling9ScanView2V15setupTankValues9webSocketyAA03WebH9ViewModelC_tF","symbolKind":"method","modules":[{"name":"Fueling"}],"title":"setupTankValues(webSocket:)","fragments":[{"text":"func","kind":"keyword"},{"kind":"text","text":" "},{"text":"setupTankValues","kind":"identifier"},{"kind":"text","text":"("},{"text":"webSocket","kind":"externalParam"},{"text":": ","kind":"text"},{"text":"WebSocketViewModel","preciseIdentifier":"s:7Fueling18WebSocketViewModelC","kind":"typeIdentifier"},{"kind":"text","text":")"}],"roleHeading":"Instance Method"},"abstract":[{"type":"text","text":"Sets up the tank values for the given WebSocket view model."}],"kind":"symbol","sections":[],"primaryContentSections":[{"kind":"declarations","declarations":[{"platforms":["iOS"],"languages":["swift"],"tokens":[{"kind":"attribute","text":"@"},{"text":"MainActor","kind":"attribute","preciseIdentifier":"s:ScM"},{"kind":"text","text":" "},{"kind":"keyword","text":"func"},{"text":" ","kind":"text"},{"kind":"identifier","text":"setupTankValues"},{"kind":"text","text":"("},{"text":"webSocket","kind":"externalParam"},{"text":": ","kind":"text"},{"preciseIdentifier":"s:7Fueling18WebSocketViewModelC","identifier":"doc:\/\/rpm.com.production.Scanner\/documentation\/Fueling\/WebSocketViewModel","kind":"typeIdentifier","text":"WebSocketViewModel"},{"kind":"text","text":")"}]}]},{"kind":"parameters","parameters":[{"content":[{"inlineContent":[{"type":"text","text":"The WebSocket view model to update with the tank information."}],"type":"paragraph"}],"name":"webSocket"}]},{"kind":"content","content":[{"type":"heading","text":"Discussion","level":2,"anchor":"discussion"},{"type":"codeListing","syntax":"swift","code":["func setupTankValues(webSocket: WebSocketViewModel) {"," switch webSocket.assetType {"," case \"NOTAG\":"," webSocket.asset = coreDataManager.pilotTankArray.first?.asset ?? \"Unknown\""," webSocket.make = coreDataManager.pilotTankArray.first?.make ?? \"Unknown\""," webSocket.model = coreDataManager.pilotTankArray.first?.model ?? \"Unknown\""," webSocket.product = coreDataManager.pilotTankArray.first?.product ?? \"Unknown\""," webSocket.serialNumber = coreDataManager.pilotTankArray.first?.serial ?? \"Uknkown\""," webSocket.tankNumber = coreDataManager.pilotTankArray.first?.tankId ?? \"Unknown\""," webSocket.tankCapacity = Double(coreDataManager.pilotTankArray.first?.tankCapacity ?? \"70.0\") ?? 10.0"," webSocket.fuelType = coreDataManager.pilotTankArray.first?.fuelType ?? \"OFF\""," webSocket.scan = coreDataManager.pilotTankArray.first?.tagText?.components(separatedBy: \"|\") ?? []"," "," case \"RERENT\":"," let selectedRentalEquipment = rentalEquipment[Int(assetId) ?? 1]"," webSocket.asset = \"Unknown\""," webSocket.make = \"Unknown\""," webSocket.model = \"Unknown\""," webSocket.product = selectedRentalEquipment.product"," webSocket.serialNumber = \"Uknkown\""," webSocket.tankNumber = \"Unknown\""," webSocket.tankCapacity = 70.0"," webSocket.fuelType = selectedRentalEquipment.fuelType"," webSocket.scan = [webSocket.asset,webSocket.make,webSocket.model,webSocket.product,webSocket.serialNumber,webSocket.tankNumber,String(webSocket.tankCapacity),webSocket.fuelType]"," default:"," break"," }"," webSocket.scannedTank = webSocket.tankNumber"," if webSocket.fuelType == dispenseTankFuelType {"," if webSocket.informationMessage.informationMessageVersion != \"2\"{"," webSocket.socket.write(string: \">MODE;4;\")"," webSocket.socket.write(string: \">RUN;0;\\(webSocket.tankCapacity);\")"," } else {"," if webSocket.refillStatusMessage.dyedFuelPump == \"0\" {"," usleep(10000)"," webSocket.socket.write(string: \">RUN;\\(webSocket.tankCapacity);\")"," }"," }"," } else if webSocket.fuelType == \"OFF\" {"," DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {"," webSocket.alertTitle = \"Fuel Type Mismatch\""," webSocket.alertMessage = \"You are trying to pump OTR fuel into an OFF ROAD tank. This will be marked as an override exception for tax purposes.\""," webSocket.isShowingAlert = true"," }"," webSocket.isOverride = true"," if webSocket.informationMessage.informationMessageVersion != \"2\"{"," webSocket.socket.write(string: \">MODE;4;\")"," webSocket.socket.write(string: \">RUN;0;\\(webSocket.tankCapacity);\")"," } else {"," if webSocket.refillStatusMessage.dyedFuelPump == \"0\" {"," usleep(10000)"," webSocket.socket.write(string: \">RUN;\\(webSocket.tankCapacity);\")"," }"," }"," } else {"," DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {"," webSocket.alertTitle = \"Fuel Type Mismatch\""," webSocket.alertMessage = \"You can't put dyed fuel in this tank.\""," webSocket.isShowingAlert = true"," }"," }","}"]}]}],"schemaVersion":{"minor":3,"patch":0,"major":0},"hierarchy":{"paths":[["doc:\/\/rpm.com.production.Scanner\/documentation\/Fueling","doc:\/\/rpm.com.production.Scanner\/documentation\/Fueling\/ScanView2"]]},"references":{"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/WebSocketViewModel":{"kind":"symbol","role":"symbol","fragments":[{"kind":"keyword","text":"class"},{"text":" ","kind":"text"},{"kind":"identifier","text":"WebSocketViewModel"}],"navigatorTitle":[{"kind":"identifier","text":"WebSocketViewModel"}],"abstract":[{"text":"The ","type":"text"},{"type":"codeVoice","code":"WebSocketViewModel"},{"type":"text","text":" class is responsible for managing WebSocket connections, handling messages, and updating application state based on WebSocket events."}],"url":"\/documentation\/fueling\/websocketviewmodel","type":"topic","identifier":"doc:\/\/rpm.com.production.Scanner\/documentation\/Fueling\/WebSocketViewModel","title":"WebSocketViewModel"},"doc://rpm.com.production.Scanner/documentation/Fueling/ScanView2":{"kind":"symbol","abstract":[{"type":"codeVoice","code":"ScanView2"},{"text":" is a SwiftUI view that manages the UI for scanning and displaying tank information.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"ScanView2"}],"fragments":[{"text":"struct","kind":"keyword"},{"kind":"text","text":" "},{"kind":"identifier","text":"ScanView2"}],"identifier":"doc:\/\/rpm.com.production.Scanner\/documentation\/Fueling\/ScanView2","role":"symbol","type":"topic","title":"ScanView2","url":"\/documentation\/fueling\/scanview2"},"doc://rpm.com.production.Scanner/documentation/Fueling/ScanView2/setupTankValues(webSocket:)":{"type":"topic","abstract":[{"text":"Sets up the tank values for the given WebSocket view model.","type":"text"}],"fragments":[{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"kind":"identifier","text":"setupTankValues"},{"text":"(","kind":"text"},{"kind":"externalParam","text":"webSocket"},{"kind":"text","text":": "},{"kind":"typeIdentifier","preciseIdentifier":"s:7Fueling18WebSocketViewModelC","text":"WebSocketViewModel"},{"kind":"text","text":")"}],"url":"\/documentation\/fueling\/scanview2\/setuptankvalues(websocket:)","identifier":"doc:\/\/rpm.com.production.Scanner\/documentation\/Fueling\/ScanView2\/setupTankValues(webSocket:)","kind":"symbol","title":"setupTankValues(webSocket:)","role":"symbol"}}}