Commit 9c00f333 authored by shigemi miura's avatar shigemi miura

タスク登録・削除(削除出来ない不具合あり)

Push履歴取得 その他
parent 06371738
......@@ -96,6 +96,9 @@
D592D5252B0F16CA00B91A1C /* ReqMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D592D5242B0F16CA00B91A1C /* ReqMessage.swift */; };
D592D5272B0F182C00B91A1C /* ReqAckMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D592D5262B0F182C00B91A1C /* ReqAckMessage.swift */; };
D592D5292B0F198100B91A1C /* ReqChatModeMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D592D5282B0F198100B91A1C /* ReqChatModeMessage.swift */; };
D59908C62B19EA70000E13DD /* ResPushHistory.swift in Sources */ = {isa = PBXBuildFile; fileRef = D59908C52B19EA70000E13DD /* ResPushHistory.swift */; };
D59908C82B1ABD43000E13DD /* SessionPushHistory.swift in Sources */ = {isa = PBXBuildFile; fileRef = D59908C72B1ABD43000E13DD /* SessionPushHistory.swift */; };
D59908CA2B1AC381000E13DD /* GetPushHistory.swift in Sources */ = {isa = PBXBuildFile; fileRef = D59908C92B1AC381000E13DD /* GetPushHistory.swift */; };
D5AE351A2AEBA66A00059889 /* ReqLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AE35182AEBA66A00059889 /* ReqLogin.swift */; };
D5AE351B2AEBA66A00059889 /* ResLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AE35192AEBA66A00059889 /* ResLogin.swift */; };
D5AE351D2AEBA6FC00059889 /* SessionLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AE351C2AEBA6FC00059889 /* SessionLogin.swift */; };
......@@ -239,6 +242,9 @@
D592D5242B0F16CA00B91A1C /* ReqMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ReqMessage.swift; path = Sailassist/Json/ReqMessage.swift; sourceTree = SOURCE_ROOT; };
D592D5262B0F182C00B91A1C /* ReqAckMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ReqAckMessage.swift; path = Sailassist/Json/ReqAckMessage.swift; sourceTree = SOURCE_ROOT; };
D592D5282B0F198100B91A1C /* ReqChatModeMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ReqChatModeMessage.swift; path = Sailassist/Json/ReqChatModeMessage.swift; sourceTree = SOURCE_ROOT; };
D59908C52B19EA70000E13DD /* ResPushHistory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ResPushHistory.swift; path = Sailassist/Json/ResPushHistory.swift; sourceTree = SOURCE_ROOT; };
D59908C72B1ABD43000E13DD /* SessionPushHistory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SessionPushHistory.swift; path = Sailassist/ServerSession/SessionPushHistory.swift; sourceTree = SOURCE_ROOT; };
D59908C92B1AC381000E13DD /* GetPushHistory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = GetPushHistory.swift; path = Sailassist/Alert/GetPushHistory.swift; sourceTree = SOURCE_ROOT; };
D5AE35182AEBA66A00059889 /* ReqLogin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ReqLogin.swift; path = Sailassist/Json/ReqLogin.swift; sourceTree = SOURCE_ROOT; };
D5AE35192AEBA66A00059889 /* ResLogin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ResLogin.swift; path = Sailassist/Json/ResLogin.swift; sourceTree = SOURCE_ROOT; };
D5AE351C2AEBA6FC00059889 /* SessionLogin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SessionLogin.swift; path = Sailassist/ServerSession/SessionLogin.swift; sourceTree = SOURCE_ROOT; };
......@@ -450,6 +456,7 @@
children = (
023DB8262B1429CE00B351CF /* View */,
020B98642ADD14F60029DE4C /* NotificationView.swift */,
D59908C92B1AC381000E13DD /* GetPushHistory.swift */,
);
path = Alert;
sourceTree = "<group>";
......@@ -520,6 +527,7 @@
D5258CA22B036CC500365276 /* SessionGetMessage.swift */,
D5E03A662B04484D00D65FCE /* SessionTaskList.swift */,
D592D5222B0F14FE00B91A1C /* SessionUploadImage.swift */,
D59908C72B1ABD43000E13DD /* SessionPushHistory.swift */,
);
path = ServerSession;
sourceTree = "<group>";
......@@ -675,6 +683,7 @@
D592D5242B0F16CA00B91A1C /* ReqMessage.swift */,
D592D5262B0F182C00B91A1C /* ReqAckMessage.swift */,
D592D5282B0F198100B91A1C /* ReqChatModeMessage.swift */,
D59908C52B19EA70000E13DD /* ResPushHistory.swift */,
);
path = Json;
sourceTree = "<group>";
......@@ -934,6 +943,7 @@
02A1DE312AFB61D8005BCF55 /* MyChatContentView.swift in Sources */,
D58E1F522B142A3F0092D8FE /* ResEcaArea.swift in Sources */,
025C27FE2B0206D700BADC49 /* PDFDownloadManager.swift in Sources */,
D59908CA2B1AC381000E13DD /* GetPushHistory.swift in Sources */,
025C27FC2AFE191A00BADC49 /* MenuManualView.swift in Sources */,
D58E1F502B142A260092D8FE /* EcaArea.swift in Sources */,
020B98592AD92A4C0029DE4C /* MainTabView.swift in Sources */,
......@@ -948,6 +958,7 @@
020B98672ADD15050029DE4C /* MenuView.swift in Sources */,
020B98572AD924F50029DE4C /* CameraPreview.swift in Sources */,
D5CB6FA12B023F7F00EC2010 /* EcaTask.swift in Sources */,
D59908C82B1ABD43000E13DD /* SessionPushHistory.swift in Sources */,
02CD068F2AE6535F005F8D8F /* MapSource.swift in Sources */,
02C3E5CE2AFCA04700AF7837 /* OtherChatContentView.swift in Sources */,
020B98442AD8E4910029DE4C /* FontStyle.swift in Sources */,
......@@ -960,6 +971,7 @@
D5258CA32B036CC500365276 /* SessionGetMessage.swift in Sources */,
D5258C992B0334BF00365276 /* SessionShipStatus.swift in Sources */,
02CE4D872ADF62A7002E79BC /* EcaListView.swift in Sources */,
D59908C62B19EA70000E13DD /* ResPushHistory.swift in Sources */,
020B986C2ADD3E810029DE4C /* InTextLib.swift in Sources */,
02C3E5D12AFCC16800AF7837 /* ChatTitleView.swift in Sources */,
024EDE1D2B0C42F70013BAC8 /* MenuGpsSelectView.swift in Sources */,
......
//
// GetPushHistory.swift
// Sailassist
//
// Created by 三浦薫巳 on 2023/12/02.
//
import Foundation
class GetPushHistory {
var sessionPushHistory = SessionPushHistory()
func start() {
print(debug: "called")
sessionPushHistory.RequestPushHistory(responsePushHistory)
}
private func responsePushHistory(result: Result<Data, APIError>) {
print(debug: "called")
switch result {
case .success(let resultData):
let serverSession = ServerSession()
let resjson = serverSession.fromJSON(resultData: resultData, resltType: [ResPushHistory].self)
if let res = resjson {
for push in res {
if let id = push.id {
SharingData.pushHistory.setPushHistory(key: id, value: push)
}
}
}
case .failure(let errorCode):
print(debug: errorCode)
break
}
}
}
......@@ -12,7 +12,7 @@ class DeleteEcaArea {
func start(ecaId : Int) {
print(debug: "called")
// sessionTaskList.RequestDeleteTaskList(ecaId, completion: responseDeleteTaskList)
sessionTaskList.RequestDeleteTaskList(ecaId, completion: responseDeleteTaskList)
}
private func responseDeleteTaskList(result: Result<Data, APIError>) {
......
......@@ -3718,53 +3718,53 @@ var iceland:[CLLocationCoordinate2D] = [
//ECA Coordinates IMO
var northAmericanPacificCoasts:[CLLocationCoordinate2D] = [
CLLocationCoordinate2D(latitude: 32.53361111, longitude: -117.1030556),
CLLocationCoordinate2D(latitude: 32.53444444, longitude: -117.1247222),
CLLocationCoordinate2D(latitude: 32.52750000, longitude: -117.2338889),
CLLocationCoordinate2D(latitude: 32.55361111, longitude: -117.2513889),
CLLocationCoordinate2D(latitude: 32.57250000, longitude: -117.3669444),
CLLocationCoordinate2D(latitude: 32.58972222, longitude: -117.4647222),
CLLocationCoordinate2D(latitude: 32.62722222, longitude: -117.8261111),
CLLocationCoordinate2D(latitude: 31.13305556, longitude: -118.6058333),
CLLocationCoordinate2D(latitude: 30.55694444, longitude: -121.7913889),
CLLocationCoordinate2D(latitude: 31.76972222, longitude: -123.2894444),
CLLocationCoordinate2D(latitude: 32.36611111, longitude: -123.8455556),
CLLocationCoordinate2D(latitude: 32.94416667, longitude: -124.1963889),
CLLocationCoordinate2D(latitude: 33.67000000, longitude: -124.4541667),
CLLocationCoordinate2D(latitude: 34.52444444, longitude: -125.2811111),
CLLocationCoordinate2D(latitude: 35.24388889, longitude: -125.7230556),
CLLocationCoordinate2D(latitude: 35.71833333, longitude: -126.3147222),
CLLocationCoordinate2D(latitude: 36.27361111, longitude: -126.7508333),
CLLocationCoordinate2D(latitude: 37.02638889, longitude: -127.1216667),
CLLocationCoordinate2D(latitude: 37.76083333, longitude: -127.6338889),
CLLocationCoordinate2D(latitude: 38.41888889, longitude: -127.8683333),
CLLocationCoordinate2D(latitude: 39.41805556, longitude: -128.5230556),
CLLocationCoordinate2D(latitude: 40.31305556, longitude: -128.7627778),
CLLocationCoordinate2D(latitude: 41.22750000, longitude: -128.6727778),
CLLocationCoordinate2D(latitude: 42.21361111, longitude: -129.0105556),
CLLocationCoordinate2D(latitude: 42.79277778, longitude: -129.0950000),
CLLocationCoordinate2D(latitude: 43.43944444, longitude: -129.0238889),
CLLocationCoordinate2D(latitude: 44.41194444, longitude: -128.6897222),
CLLocationCoordinate2D(latitude: 45.51194444, longitude: -128.6672222),
CLLocationCoordinate2D(latitude: 46.18361111, longitude: -128.8169444),
CLLocationCoordinate2D(latitude: 46.56527778, longitude: -129.0747222),
CLLocationCoordinate2D(latitude: 47.66527778, longitude: -131.2613889),
CLLocationCoordinate2D(latitude: 48.54222222, longitude: -132.6833333),
CLLocationCoordinate2D(latitude: 48.96305556, longitude: -133.2463889),
CLLocationCoordinate2D(latitude: 49.37750000, longitude: -134.2641667),
CLLocationCoordinate2D(latitude: 50.03111111, longitude: -135.3169444),
CLLocationCoordinate2D(latitude: 51.05500000, longitude: -136.7625000),
CLLocationCoordinate2D(latitude: 51.90111111, longitude: -137.6983333),
CLLocationCoordinate2D(latitude: 52.75333333, longitude: -138.3372222),
CLLocationCoordinate2D(latitude: 53.48388889, longitude: -138.6766667),
CLLocationCoordinate2D(latitude: 53.67750000, longitude: -138.8147222),
CLLocationCoordinate2D(latitude: 54.22916667, longitude: -139.5438889),
CLLocationCoordinate2D(latitude: 54.65694444, longitude: -139.9386111),
CLLocationCoordinate2D(latitude: 55.33833333, longitude: -140.9291667),
CLLocationCoordinate2D(latitude: 56.12000000, longitude: -141.6050000),
CLLocationCoordinate2D(latitude: 56.47555556, longitude: -142.2886111),
CLLocationCoordinate2D(latitude: 56.62194444, longitude: -142.8158333),
CLLocationCoordinate2D(latitude: 58.85111111, longitude: -153.2508333)
CLLocationCoordinate2D(latitude: 32.53611111, longitude: -117.10305556),
CLLocationCoordinate2D(latitude: 32.53444444, longitude: -117.12472222),
CLLocationCoordinate2D(latitude: 32.52750000, longitude: -117.23888889),
CLLocationCoordinate2D(latitude: 32.55361111, longitude: -117.26388889),
CLLocationCoordinate2D(latitude: 32.57250000, longitude: -117.36694444),
CLLocationCoordinate2D(latitude: 32.58972222, longitude: -117.46472222),
CLLocationCoordinate2D(latitude: 32.62722222, longitude: -117.82611111),
CLLocationCoordinate2D(latitude: 31.13305556, longitude: -118.60583333),
CLLocationCoordinate2D(latitude: 30.55694444, longitude: -121.79138889),
CLLocationCoordinate2D(latitude: 31.76972222, longitude: -123.28944444),
CLLocationCoordinate2D(latitude: 32.36611111, longitude: -123.84555556),
CLLocationCoordinate2D(latitude: 32.94416667, longitude: -124.19638889),
CLLocationCoordinate2D(latitude: 33.67000000, longitude: -124.45416667),
CLLocationCoordinate2D(latitude: 34.52444444, longitude: -125.28111111),
CLLocationCoordinate2D(latitude: 35.24388889, longitude: -125.72305556),
CLLocationCoordinate2D(latitude: 35.73333333, longitude: -126.31472222),
CLLocationCoordinate2D(latitude: 36.27361111, longitude: -126.75833333),
CLLocationCoordinate2D(latitude: 37.02638889, longitude: -127.12166667),
CLLocationCoordinate2D(latitude: 37.76083333, longitude: -127.63388889),
CLLocationCoordinate2D(latitude: 38.41888889, longitude: -127.88333333),
CLLocationCoordinate2D(latitude: 39.41805556, longitude: -128.52305556),
CLLocationCoordinate2D(latitude: 40.31305556, longitude: -128.76277778),
CLLocationCoordinate2D(latitude: 41.22750000, longitude: -128.67277778),
CLLocationCoordinate2D(latitude: 42.21361111, longitude: -129.01055556),
CLLocationCoordinate2D(latitude: 42.79277778, longitude: -129.09500000),
CLLocationCoordinate2D(latitude: 43.43944444, longitude: -129.02388889),
CLLocationCoordinate2D(latitude: 44.41194444, longitude: -128.68972222),
CLLocationCoordinate2D(latitude: 45.51194444, longitude: -128.66722222),
CLLocationCoordinate2D(latitude: 46.18361111, longitude: -128.81694444),
CLLocationCoordinate2D(latitude: 46.56527778, longitude: -129.07472222),
CLLocationCoordinate2D(latitude: 47.66527778, longitude: -131.26138889),
CLLocationCoordinate2D(latitude: 48.54222222, longitude: -132.68333333),
CLLocationCoordinate2D(latitude: 48.96305556, longitude: -133.24638889),
CLLocationCoordinate2D(latitude: 49.37750000, longitude: -134.26416667),
CLLocationCoordinate2D(latitude: 50.03111111, longitude: -135.31694444),
CLLocationCoordinate2D(latitude: 51.05500000, longitude: -136.76250000),
CLLocationCoordinate2D(latitude: 51.90111111, longitude: -137.69833333),
CLLocationCoordinate2D(latitude: 52.75333333, longitude: -138.33722222),
CLLocationCoordinate2D(latitude: 53.48888889, longitude: -138.67666667),
CLLocationCoordinate2D(latitude: 53.67750000, longitude: -138.81472222),
CLLocationCoordinate2D(latitude: 54.22916667, longitude: -139.54388889),
CLLocationCoordinate2D(latitude: 54.65694444, longitude: -139.93861111),
CLLocationCoordinate2D(latitude: 55.33833333, longitude: -140.92916667),
CLLocationCoordinate2D(latitude: 56.12000000, longitude: -141.60500000),
CLLocationCoordinate2D(latitude: 56.47555556, longitude: -142.28861111),
CLLocationCoordinate2D(latitude: 56.62194444, longitude: -142.81583333),
CLLocationCoordinate2D(latitude: 58.85111111, longitude: -153.25083333)
]
var northAmericanAtlanticCoasts:[CLLocationCoordinate2D] = [
......@@ -4313,7 +4313,7 @@ class EcaCoordinatesTable : NSObject {
}
var ecaDataTable:[ecaData] = [
// ecaData(id: 11, name: "North American Atlantic Coasts", table: northAmericanAtlanticCoasts),
ecaData(id: 11, name: "North American Atlantic Coasts", table: northAmericanAtlanticCoasts)
// ecaData(id: 12, name: "North American Hawai", table: northAmericanHawai),
// ecaData(id: 31, name: "Unites States Caribbean", table: unitesStatesCaribbean),
// ecaData(id: 21, name: "North Sea 1", table: northSea1), //err
......@@ -4332,7 +4332,7 @@ class EcaCoordinatesTable : NSObject {
// ecaData(id: 17, name: "Korea Busan Port West", table: koreaBusanPortWest),
// ecaData(id: 18, name: "Korea Ulsan Port", table: koreaUlsanPort),
// ecaData(id: 19, name: "Panama Canal Atlantic Entrance", table: panamaCanalAtlanticEntrance),
ecaData(id: 20, name: "Panama Canal Pacific Entrance", table: panamaCanalPacificEntrance)
// ecaData(id: 20, name: "Panama Canal Pacific Entrance", table: panamaCanalPacificEntrance)
]
func setEcaData() {
......
......@@ -45,8 +45,8 @@ class EcaTask {
SharingData.my.server = CLLocationCoordinate2D(latitude: res.lat, longitude: res.lon)
SharingData.my.dataTime = res.dataTime //2023-11-02T05:25:49.4362123Z
SharingData.my.setLocation()
if Preferences.LocationType == 1 {
SharingData.my.location = SharingData.my.server
checkEca()
}
}
......@@ -58,34 +58,41 @@ class EcaTask {
func checkEca() {
let runningEca = eca.ecaArea.first(where: {(key, value) in value.isRunning == true})
if var eca = runningEca?.value {
if let eca = runningEca?.value {
if let location = SharingData.my.location {
let distance = LocationCalculation.checkPolyline(objPos: eca.points, shipPos: location)
if eca.swNotice >= Float(distance) && eca.status == EcaState.start {
notificationEca(point: SwitchingEca.Start)
eca.status = EcaState.noticePass
SharingData.eca.isShowEcaAlert = true
}
if eca.swStart >= Float(distance) && eca.status == EcaState.noticePass {
notificationEca(point: SwitchingEca.Notice)
eca.status = EcaState.startPass
SharingData.eca.isShowEcaAlert = true
}
if eca.swFinish >= Float(distance) && eca.status == EcaState.startPass {
notificationEca(point: SwitchingEca.Finish)
eca.status = EcaState.finishPass
SharingData.eca.isShowEcaAlert = true
}
if 0.0 <= Float(distance) && eca.status == EcaState.finishPass {
eca.status = EcaState.incomplete
SharingData.eca.isShowEcaAlert = true
if let distance = LocationCalculation.checkPolyline(objPos: eca.points, shipPos: location) {
if eca.swNotice >= Float(distance) && eca.status == EcaState.running {
notificationEca(point: SwitchingEca.Notice)
SharingData.eca.isShowEcaAlert = true
var newData = eca
newData.status = EcaState.noticePass
SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Notice)
}
if eca.swStart >= Float(distance) && eca.status == EcaState.noticePass {
notificationEca(point: SwitchingEca.Start)
SharingData.eca.isShowEcaAlert = true
var newData = eca
newData.status = EcaState.startPass
SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Start)
}
if eca.swFinish >= Float(distance) && eca.status == EcaState.startPass {
notificationEca(point: SwitchingEca.Finish)
SharingData.eca.isShowEcaAlert = true
var newData = eca
newData.status = EcaState.finishPass
SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Finish)
}
if 0.0 <= Float(distance) && eca.status == EcaState.finishPass {
SharingData.eca.isShowEcaAlert = true
var newData = eca
newData.status = EcaState.incomplete
SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Incomplete)
}
}
SharingData.eca.editEcaArea(key: eca.name, value: eca)
}
}
}
......
......@@ -6,15 +6,15 @@
//
import Foundation
import Foundation
import SwiftUI
class GetEcaList {
@ObservedObject var ecaData = SharingData.eca
var sessionTaskList = SessionTaskList()
func start() {
print(debug: "called")
// sessionTaskList.RequestGetTaskList(responseGetTaskList)
sessionTaskList.RequestGetTaskList(responseGetTaskList)
}
private func responseGetTaskList(result: Result<Data, APIError>) {
......@@ -24,11 +24,48 @@ class GetEcaList {
let serverSession = ServerSession()
let resjson = serverSession.fromJSON(resultData: resultData, resltType: [ReqTaskList].self)
if let res = resjson {
//ECA保存
for ecaList in res {
if var value = ecaData.ecaArea[ecaList.taskName] {
value.isEnable = true
value.swNotice = ecaList.noticeRange
value.swStart = ecaList.startRange
value.swFinish = ecaList.finishRange
if ecaList.status & serverRunning == serverRunning {
value.isRunning = true
value.status = setEcaServer(status: ecaList.status)
}
ecaData.ecaArea.updateValue(value, forKey: ecaList.taskName)
}
}
}
case .failure(let errorCode):
print(debug: errorCode)
break
}
}
private func setEcaServer(status: Int) -> EcaState {
let statusInf = status ^ serverRunning
var state = EcaState.register
switch statusInf {
case serverRunning:
state = EcaState.running
case serverNoticePass:
state = EcaState.noticePass
case serverStartPass:
state = EcaState.startPass
case serverFinishPass:
state = EcaState.finishPass
case serverEnd:
state = EcaState.end
case serverIncomplete:
state = EcaState.incomplete
case serverCancel:
state = EcaState.cancel
default:
state = EcaState.register
}
return state
}
}
......@@ -9,7 +9,8 @@ import Foundation
import CoreLocation
enum EcaState {
case start //ECAタスク実行開始
case register //登録
case running //ECAタスク実行開始
case noticePass //ECA通知円到達
case startPass //ECA開始円到達
case finishPass //ECAタスク終了円到達
......@@ -18,6 +19,15 @@ enum EcaState {
case cancel //ECAタスクキャンセル (タスク終了・タスク未完了前にキャンセル)
}
let serverRegister = 0x00000000 //登録
let serverRunning = 0x10000000 //ECAタスク実行開始
let serverNoticePass = 0x00000001 //ECA通知円到達
let serverStartPass = 0x00000002 //ECA開始円到達
let serverFinishPass = 0x00000004 //ECAタスク終了円到達
let serverEnd = 0x00000100 //ECAタスク完了(燃料切替実施済み)
let serverIncomplete = 0x00000200 //ECAタスク未完了 (燃料切替未実施で終了)
let serverCancel = 0x00000400 //ECAタスクキャンセル (タスク終了・タスク未完了前にキャンセル)
struct RegisteredEca {
var id: Int = 0
var isEnable: Bool = false //ECA有効
......@@ -26,7 +36,7 @@ struct RegisteredEca {
var swNotice: Float = 6 //ECA通知[NM]
var swStart: Float = 5 //ECA開始[NM]
var swFinish: Float = 4 //ECA終了[NM]
var status: EcaState = EcaState.start //ECA状態
var status: EcaState = EcaState.register //ECA状態
var datetime: String = "" //時刻(UTC ISO8601準拠)
var color: String = "" //ライン色(ARGB)
var width: Int = 1 //ライン幅
......
......@@ -6,26 +6,24 @@
//
import Foundation
import SwiftUI
class SetEcaArea {
@ObservedObject var ecaData = SharingData.eca
var sessionTaskList = SessionTaskList()
func start(eca : ReqTaskList) {
print(debug: "called")
// sessionTaskList.RequestPostTaskList(eca, completion: responsePostTaskList)
sessionTaskList.RequestPostTaskList(eca, completion: responsePostTaskList)
}
private func responsePostTaskList(result: Result<Data, APIError>) {
print(debug: "called")
switch result {
case .success(let resultData):
let serverSession = ServerSession()
let resjson = serverSession.fromJSON(resultData: resultData, resltType: ReqTaskList.self)
if let res = resjson {
//ECA保存
}
case .success(let errorCode):
print(debug: "success: \(errorCode)")
case .failure(let errorCode):
print(debug: errorCode)
print(debug: "failure: \(errorCode)")
break
}
}
......
......@@ -21,9 +21,10 @@ enum HttpRequestType : String {
case ShipMonitoringRoute = "https://ssv-canary-web.azurewebsites.net/api/sailassist/shipmonitoringroute/XXXXX"
case GetMessage = "https://ssv-canary-web.azurewebsites.net/api/chatdata/getmessages?shipId=XXXXX"
case SignalR = "https://ssv-canary-web.azurewebsites.net/signalr/shore"
case PushHistory = "https://ssv-canary-web.azurewebsites.net/api/sailassist/pushhistory/XXXXX"
case UploadImage = "https://ssv-canary-web.azurewebsites.net/api/chatdata/uploadimage"
case ConnectionString = "Endpoint=sb://ssv-canary-notification.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=rj2WniCJWWP2SG5gk4J7/2P/nIyChx8+JXKWCfTi8KA="
case HubName = "ssv-canary-notification"
case ConnectionString = "Endpoint=sb://ssv-canary-notification.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=zHzVMA757FciMum5jVG4NMl82YpYVzclUgCiKOVRKf8="
case HubName = "ssv-canary-sailassist-notification"
case storage = "https://ssvcanarystorage.z1.web.core.windows.net/"
}
#elseif QC
......@@ -39,6 +40,7 @@ enum HttpRequestType : String {
case ShipMonitoringRoute = "https://ssv-qc-web.azurewebsites.net/api/sailassist/shipmonitoringroute/XXXXX"
case GetMessage = "https://ssv-qc-web.azurewebsites.net/api/chatdata/getmessages?shipId=XXXXX"
case SignalR = "https://ssv-qc-web.azurewebsites.net/signalr/shore"
case PushHistory = "https://ssv-qc-web.azurewebsites.net/api/sailassist/pushhistory/XXXXX"
case UploadImage = "https://ssv-qc-web.azurewebsites.net/api/chatdata/uploadimage"
case ConnectionString = "Endpoint=sb://tacmiqchub.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=mjGZyOensA5D/T6bMiDDwX6hwhoZNsDcK+GtBBBiUXk="
case HubName = "tacmiqchub"
......@@ -58,6 +60,7 @@ enum HttpRequestType : String {
case ShipMonitoringRoute = "https://ssv.jmarinecloud.com/api/sailassist/shipmonitoringroute/XXXXX"
case GetMessage = "https://ssv.jmarinecloud.com/api/chatdata/getmessages?shipId=XXXXX"
case SignalR = "https://ssv.jmarinecloud.com/signalr/shore"
case PushHistory = "https://ssv.jmarinecloud.com/api/sailassist/pushhistory/XXXXX"
case UploadImage = "https://ssv.jmarinecloud.com/api/chatdata/uploadimage"
case ConnectionString = "Endpoint=sb://tacmihub.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=/IOJAYGLZmS2JvlsHT5aT+ETlPXqNt1+VGuMNDt4bzw="
case HubName = "tacmihub"
......
......@@ -8,7 +8,14 @@
import Foundation
struct ReqTaskList : Codable {
var areaId: Int
var taskName: String
// var status:
var areaId: Int = 0
var taskName: String = ""
var noticeRange: Float = 0.0
var startRange: Float = 0.0
var finishRange: Float = 0.0
var status: Int = 0
init(Id: Int) {
self.areaId = Id
}
}
//
// ResPushHistory.swift
// Sailassist
//
// Created by 三浦薫巳 on 2023/12/01.
//
import Foundation
//status
let statusUnknown = 0
let statusNormal = 1
let statusCaution = 2
let statusWarning = 3
let statusAlarm = 4
let statusEmergency = 5
//type
let typeRouteAlert = 0
let typeBamAlert = 1
let typeEmergency = 2
let typeChat = 3
let typeSailassistTask = 4
struct ResPushHistory : Codable {
var id: Int?
var status: Int?
var type: Int?
var time: String?
var shipId: Int?
var shipName: String?
var title: String?
var message: String?
var position: points?
var emergencyId: String?
}
......@@ -700,16 +700,16 @@ class LocationCalculation{
static func checkPolyline(
objPos: Array<CLLocationCoordinate2D>,
shipPos: CLLocationCoordinate2D)
-> Double
-> Double?
{
var distance = 1000000.0
var distance: Double?
let rtn = crossLineDistance(objPos: objPos, shipPos: shipPos)
//直線と直行していない
if (!rtn.retCode) {
let rtn1 = pointsDistance(objPos: objPos, shipPos: shipPos)
if (rtn1.retCode) {
distance = 0.0
distance = nil
} else {
distance = rtn1.xte
}
......@@ -717,7 +717,9 @@ class LocationCalculation{
distance = rtn.xte
}
print(debug: "checkPolyline \(distance)")
if let dist = distance {
print(debug: "checkPolyline \(dist)")
}
return distance
}
......
......@@ -39,34 +39,32 @@ class LocationViewModel: NSObject, ObservableObject, CLLocationManagerDelegate {
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let newLocation = locations.last {
// let isLocation = filterLocation(newLocation)
// if isLocation {
lastSeenLocation = locations.first
let targetCoordinate : CLLocationCoordinate2D = lastSeenLocation!.coordinate
SharingData.my.gps = targetCoordinate
if Preferences.LocationType == 0 {
SharingData.my.location = SharingData.my.gps
ecaTask.checkEca()
}
// }
}
}
func filterLocation(_ location: CLLocation) -> Bool {
let intervalTime = -location.timestamp.timeIntervalSinceNow
if intervalTime > 10 { //位置情報を取得してから10秒以上
return false
}
if location.horizontalAccuracy < 0 { //水平方向の位置精度
return false
}
lastSeenLocation = locations.first
let targetCoordinate : CLLocationCoordinate2D = lastSeenLocation!.coordinate
SharingData.my.gps = targetCoordinate
SharingData.my.setLocation()
if location.horizontalAccuracy > 100 { //水平方向の誤差が100m
return false
if Preferences.LocationType == 0 {
ecaTask.checkEca()
}
}
return true
}
// func filterLocation(_ location: CLLocation) -> Bool {
// let intervalTime = -location.timestamp.timeIntervalSinceNow
//
// if intervalTime > 10 { //位置情報を取得してから10秒以上
// return false
// }
//
// if location.horizontalAccuracy < 0 { //水平方向の位置精度
// return false
// }
//
// if location.horizontalAccuracy > 100 { //水平方向の誤差が100m
// return false
// }
//
// return true
// }
}
......@@ -128,8 +128,8 @@ struct LoginView: View {
}
func LoginCheckQR() -> () {
loginViewParam.shipId = Preferences.ShipId
loginViewParam.password = Preferences.ShipPassword
loginViewParam.shipId = Preferences.Id
loginViewParam.password = Preferences.Password
viewMode = .InputUserName
}
......@@ -139,9 +139,9 @@ struct LoginView: View {
let interval = Date.now.timeIntervalSince(lastDate)
if interval < 2592000 {
if Preferences.ShipId != "" && Preferences.ShipPassword != "" && Preferences.UserName != ""{
if Preferences.Id != "" && Preferences.Password != "" && Preferences.UserName != ""{
isProgressView = true
let login = ReqLogin(Id: Preferences.ShipId, Password: Preferences.ShipPassword)
let login = ReqLogin(Id: Preferences.Id, Password: Preferences.Password)
sessionLogin.RequestLogin(login, completion: responseLogin)
}
}
......@@ -171,10 +171,11 @@ struct LoginView: View {
let resjson = serverSession.fromJSON(resultData: resultData, resltType: ResLogin.self)
if let res = resjson {
SharingData.my.id = res.id
SharingData.my.shipId = res.shipId
SharingData.my.shipName = res.shipName
SharingData.my.imo = res.imo
SharingData.my.mmsi = res.mmsi
Preferences.shipId = res.shipId
}
Preferences.lastLoginDate_Int64 = DateTextLib.Date2UnixTime(date: Date())
......@@ -193,6 +194,9 @@ struct LoginView: View {
let ecaList = GetEcaList()
ecaList.start()
let pushHistory = GetPushHistory()
pushHistory.start()
}
timer?.fire()
......
......@@ -89,14 +89,18 @@ struct InputUserNameView: View {
let resjson = serverSession.fromJSON(resultData: resultData, resltType: ResLogin.self)
if let res = resjson {
SharingData.my.id = res.id
SharingData.my.shipId = res.shipId
SharingData.my.shipName = res.shipName
SharingData.my.imo = res.imo
SharingData.my.mmsi = res.mmsi
Preferences.shipId = res.shipId
let notification = notificationTags()
notification.addTags()
}
Preferences.ShipId = param.shipId
Preferences.ShipPassword = param.password
Preferences.Id = param.shipId
Preferences.Password = param.password
Preferences.lastLoginDate_Int64 = DateTextLib.Date2UnixTime(date: Date())
timer = Timer.scheduledTimer(withTimeInterval: 60.0, repeats: true) { _ in
......@@ -110,8 +114,8 @@ struct InputUserNameView: View {
let route = MonitoringRoute()
route.start()
let ecaList = GetEcaList()
ecaList.start()
// let ecaList = GetEcaList()
// ecaList.start()
}
timer?.fire()
......
......@@ -21,14 +21,14 @@ class ScannerViewModel: ObservableObject {
let jsonData = self.lastQrCode.data(using: .utf8)!
let resjson: QrLogin = try decoder.decode(QrLogin.self, from: jsonData)
Preferences.ShipId = resjson.id
Preferences.ShipPassword = resjson.pass
Preferences.Id = resjson.id
Preferences.Password = resjson.pass
Preferences.lastLoginDate_Int64 = DateTextLib.Date2UnixTime(date: Date())
} catch {
print(debug: "decodeエラー")
Preferences.ShipId = ""
Preferences.ShipPassword = ""
Preferences.Id = ""
Preferences.Password = ""
}
isShowing = false
......
......@@ -24,7 +24,7 @@ struct EcaListView: View {
Button(action: {
var newData = eca
newData.isEnable.toggle()
ecaData.editEcaArea(key: eca.name, value: newData)
ecaData.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Insert)
}, label: {
Image("icon_plus")
.resizable()
......
......@@ -34,10 +34,8 @@ struct EcaSettingView: View {
Divider()
.frame(height: 1)
.background(ColorSet.LineColor04.color)
Button(action: {
SharingData.eca.editEcaArea(key: edittingEca.name, value: edittingEca)
SharingData.eca.editEcaArea(key: edittingEca.name, value: edittingEca, type: EcaOperation.Change)
isShowSettingEca = false
}, label: {
Text("Register")
......
......@@ -35,7 +35,7 @@ struct TaskSwitchingMenuView: View {
if isEcaAlert == false {
var newData = eca
newData.isRunning = true
ecaData.editEcaArea(key: eca.name, value: newData)
SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Running)
}
} label: {
HStack {
......@@ -89,7 +89,9 @@ struct TaskSwitchingMenuView: View {
if let ecaArea = edittingEcaArea {
var newData = ecaArea
newData.isEnable = false
ecaData.editEcaArea(key: ecaArea.name, value: newData)
newData.status = EcaState.register
ecaData.editEcaArea(key: ecaArea.name, value: newData, type: EcaOperation.Delete)
deleteEcaArea.start(ecaId: ecaArea.id)
}
edittingEcaArea = nil
......@@ -103,8 +105,7 @@ struct TaskSwitchingMenuView: View {
var newData = ecaArea
newData.isRunning = false
newData.status = EcaState.cancel
ecaData.editEcaArea(key: ecaArea.name, value: newData)
//サーバーにECAキャンセルを通知
ecaData.editEcaArea(key: ecaArea.name, value: newData, type: EcaOperation.Cancel)
}
edittingEcaArea = nil
}))
......
......@@ -49,6 +49,7 @@ struct MenuGpsSelectView: View {
} else {
Preferences.LocationType = 1
}
SharingData.my.setLocation()
}label:{
HStack {
Text(content.title)
......
......@@ -36,10 +36,11 @@ class Preferences{
}
}
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.ShipId.rawValue) static var ShipId: String
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.ShipPassword.rawValue) static var ShipPassword: String
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.Id.rawValue) static var Id: String
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.Password.rawValue) static var Password: String
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.UserName.rawValue) static var UserName: String
@AppStorage(wrappedValue:0, PreferencesKey.TypeInt.shipId.rawValue) static var shipId: Int
@AppStorage(wrappedValue:0, PreferencesKey.TypeInt.LocationType.rawValue) static var LocationType: Int
// func getPreferences(key)
......
......@@ -12,18 +12,18 @@ class PreferencesKey{
///String型
enum TypeString: String{
case ShipId
case ShipPassword
case Id
case Password
case UserName
}
///Int型
enum TypeInt: String{
case shipId
case LocationType
case AppStartUsingDate
case LastLoginDate
case TermsAgreeDate
}
enum TypeURL: String{
......
......@@ -9,7 +9,6 @@ import SwiftUI
import UserNotifications
import WindowsAzureMessaging
@main
struct SailassistApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
......@@ -43,7 +42,21 @@ struct SailassistApp: App {
}
}
class AppDelegate: NSObject, UIApplicationDelegate{
class notificationTags: NSObject {
func addTags() {
if Preferences.shipId != 0 {
let shipId = String(Preferences.shipId)
let testTag = "aaa"
let routeTag = "route-" + shipId
let bamTag = "bam-" + shipId
let taskAlertTag = "taskalert-" + shipId
let sailassistTag = "sailassist-" + shipId
MSNotificationHub.addTags([testTag, routeTag, bamTag, taskAlertTag, sailassistTag])
}
}
}
class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, MSInstallationLifecycleDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
print(debug: "called")
......@@ -53,14 +66,18 @@ class AppDelegate: NSObject, UIApplicationDelegate{
return
}
if granted {
// MSNotificationHub.setLifecycleDelegate(self)
UNUserNotificationCenter.current().delegate = self
// MSNotificationHub.setDelegate(self)
}
}
application.registerForRemoteNotifications()
MSNotificationHub.start(connectionString: HttpRequestType.ConnectionString.rawValue, hubName: HttpRequestType.HubName.rawValue)
MSNotificationHub.addTags([String(SharingData.my.shipId)])
let notification = notificationTags()
notification.addTags()
return true
}
......@@ -70,7 +87,29 @@ class AppDelegate: NSObject, UIApplicationDelegate{
config.delegateClass = SceneDelegate.self
return config
}
// func addTags() {
// if Preferences.shipId == 0 {
// let shipId = String(Preferences.shipId)
// let testTag = "aaa"
// let routeTag = "route-" + shipId
// let bamTag = "bam-" + shipId
// let taskAlertTag = "taskalert-" + shipId
// let sailassistTag = "sailassist-" + shipId
// MSNotificationHub.addTags([testTag, routeTag, bamTag, taskAlertTag, sailassistTag])
// }
// }
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
print(debug: "called")
// Forward to MSNotificationHub
MSNotificationHub.didReceiveRemoteNotification(userInfo)
// Complete handling the notification
completionHandler(.noData)
}
func notificationHub(_ notificationHub: MSNotificationHub!, didReceivePushNotification notification: MSNotificationHubMessage!) {
let title = notification.title ?? ""
......
......@@ -29,6 +29,7 @@ class ServerSession{
return resjson
} catch {
let jsonstr = String(data: resultData, encoding: .utf8)!
print(debug: "\(jsonstr)")
return nil
}
}
......
......@@ -27,7 +27,7 @@ class SessionEcaArea : ObservableObject {
Calling = true
// リクエストURLの組み立て
let id = SharingData.my.shipId
let id = Preferences.shipId
if id != 0 {
var url_string : String = HttpRequestType.EcaArea.rawValue
url_string = url_string.replacingOccurrences(of: "XXXXX", with: String(id))
......
......@@ -27,7 +27,7 @@ class SessionGetMessage : ObservableObject {
Calling = true
// リクエストURLの組み立て
let id = SharingData.my.shipId
let id = Preferences.shipId
if id != 0 {
var url_string : String = HttpRequestType.GetMessage.rawValue
url_string = url_string.replacingOccurrences(of: "XXXXX", with: String(id))
......
......@@ -28,7 +28,7 @@ class SessionMonitoringRoute : ObservableObject {
Calling = true
// リクエストURLの組み立て
let id = SharingData.my.shipId
let id = Preferences.shipId
if id != 0 {
var url_string : String = HttpRequestType.ShipMonitoringRoute.rawValue
url_string = url_string.replacingOccurrences(of: "XXXXX", with: String(id))
......
//
// SessionPushHistory.swift
// Sailassist
//
// Created by 三浦薫巳 on 2023/12/02.
//
import Foundation
import SwiftUI
class SessionPushHistory : ObservableObject {
@Published var status = false
// シングルトン宣言
static let OnlyOne = SessionPushHistory()
private var serverSession = ServerSession()
private var Calling : Bool = false // 通信中
/**
* メッセージ
*/
func RequestPushHistory(_ completion: @escaping ((Result<Data, APIError>)) -> Void) {
print(debug: "calld")
if Calling {
return
}
Calling = true
// リクエストURLの組み立て
let id = Preferences.shipId
if id != 0 {
var url_string : String = HttpRequestType.PushHistory.rawValue
url_string = url_string.replacingOccurrences(of: "XXXXX", with: String(id))
guard let req_url = URL(string : url_string) else {
Calling = false
return
}
serverSession.getJson(req_url, completion: completion)
}
}
}
......@@ -27,7 +27,7 @@ class SessionShipStatus : ObservableObject {
Calling = true
// リクエストURLの組み立て
let id = SharingData.my.shipId
let id = Preferences.shipId
if id != 0 {
var url_string : String = HttpRequestType.ShipStatus.rawValue
url_string = url_string.replacingOccurrences(of: "XXXXX", with: String(id))
......
......@@ -27,7 +27,7 @@ class SessionTaskList : ObservableObject {
Calling = true
// リクエストURLの組み立て
let id = SharingData.my.shipId
let id = Preferences.shipId
if id != 0 {
var url_string : String = HttpRequestType.TaskList.rawValue
url_string = url_string.replacingOccurrences(of: "XXXXX", with: String(id))
......@@ -51,7 +51,7 @@ class SessionTaskList : ObservableObject {
Calling = true
// リクエストURLの組み立て
let id = SharingData.my.shipId
let id = Preferences.shipId
if id != 0 {
var url_string : String = HttpRequestType.TaskList.rawValue
url_string = url_string.replacingOccurrences(of: "XXXXX", with: String(id))
......@@ -81,7 +81,7 @@ class SessionTaskList : ObservableObject {
Calling = true
// リクエストURLの組み立て
let id = SharingData.my.shipId
let id = Preferences.shipId
if id != 0 {
let strId = String(id) + "/" + String(ecaId)
var url_string : String = HttpRequestType.TaskList.rawValue
......
......@@ -7,6 +7,18 @@
import Foundation
import CoreLocation
enum EcaOperation {
case Insert
case Delete
case Running
case Start
case Notice
case Finish
case Incomplete
case Change
case Cancel
}
class SharingData{
static var my = My()
......@@ -20,13 +32,16 @@ class SharingData{
@Published var dataTime: String = "" //2023-11-02T05:25:49.4362123Z
@Published var id: Int = 0
@Published var shipId: Int = 0
@Published var shipName: String = ""
@Published var imo: Int = 0
@Published var mmsi: Int = 0
func setLocation(_ location: CLLocationCoordinate2D?){
self.location = location
func setLocation(){
if Preferences.LocationType == 0 {
self.location = self.gps
} else {
self.location = self.server
}
}
func reset() {
......@@ -91,10 +106,7 @@ class SharingData{
id: "")
]
),
]
}
/**
......@@ -106,10 +118,133 @@ class SharingData{
@Published var foucusEca: String? = nil
@Published var isShowEcaAlert: Bool = false
func editEcaArea(key: String, value: RegisteredEca){
func setEcaArea(key: String, value: RegisteredEca) {
ecaArea.updateValue(value, forKey: key)
}
func editEcaArea(key: String, value: RegisteredEca, type: EcaOperation) {
let setEcaArea = SetEcaArea()
var task = ReqTaskList(Id: value.id)
switch type {
case EcaOperation.Running:
task.areaId = value.id
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
task.finishRange = value.swFinish
task.status = serverRunning
setEcaArea.start(eca: task)
case EcaOperation.Insert:
task.areaId = value.id
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
task.finishRange = value.swFinish
task.status = serverRegister
setEcaArea.start(eca: task)
case EcaOperation.Delete:
let deleteEcaArea = DeleteEcaArea()
deleteEcaArea.start(ecaId: value.id)
case EcaOperation.Start:
task.areaId = value.id
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
task.finishRange = value.swFinish
if value.isEnable && value.isRunning {
task.status = setEcaStatus(eca: value)
}
setEcaArea.start(eca: task)
case EcaOperation.Notice:
task.areaId = value.id
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
task.finishRange = value.swFinish
if value.isEnable && value.isRunning {
task.status = setEcaStatus(eca: value)
}
setEcaArea.start(eca: task)
case EcaOperation.Finish:
task.areaId = value.id
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
task.finishRange = value.swFinish
if value.isEnable && value.isRunning {
task.status = setEcaStatus(eca: value)
}
setEcaArea.start(eca: task)
case EcaOperation.Incomplete:
task.areaId = value.id
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
task.finishRange = value.swFinish
if value.isEnable && value.isRunning {
task.status = setEcaStatus(eca: value)
}
setEcaArea.start(eca: task)
case EcaOperation.Cancel:
task.areaId = value.id
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
task.finishRange = value.swFinish
if value.isEnable {
task.status = setEcaStatus(eca: value)
}
setEcaArea.start(eca: task)
case EcaOperation.Change:
task.areaId = value.id
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
task.finishRange = value.swFinish
if value.isEnable && value.isRunning {
task.status = setEcaStatus(eca: value)
}
setEcaArea.start(eca: task)
}
ecaArea.updateValue(value, forKey: key)
}
private func setEcaStatus(eca: RegisteredEca) -> Int {
var state = serverRegister
switch eca.status {
case EcaState.running:
state = serverRunning
case EcaState.noticePass:
state = serverNoticePass + serverRunning
case EcaState.startPass:
state = serverStartPass + serverRunning
case EcaState.finishPass:
state = serverFinishPass + serverRunning
case EcaState.end:
state = serverEnd + serverRunning
case EcaState.incomplete:
state = serverIncomplete
case EcaState.cancel:
state = serverCancel
default:
state = serverRegister
}
return state
}
}
static var pushHistory = PushHistory()
class PushHistory: ObservableObject{
@Published var pushHistoryData: Dictionary<Int, ResPushHistory> = [:]
func setPushHistory(key: Int, value: ResPushHistory) {
pushHistoryData.updateValue(value, forKey: key)
}
}
static var noticeInformation = NoticeInformation()
class NoticeInformation: ObservableObject {
}
}
......@@ -53,7 +53,7 @@ public class SignalRService {
//呼び出す
func chatMessage(_ message: String) {
var request = ReqMessage(shipId: SharingData.my.shipId, messageId: "aaaa")
var request = ReqMessage(shipId: Preferences.shipId, messageId: "aaaa")
request.type = 0 //0:テキスト, 1:スタンプ
// request.time = DateTextLib.Date2ISO8601Text(date: Date())
request.location = 2 //1:Shore , 2:Ship
......@@ -72,7 +72,7 @@ public class SignalRService {
}
func ackMessage(_ message: String) {
var request = ReqAckMessage(shipId: SharingData.my.shipId, messageId: "aaaa")
var request = ReqAckMessage(shipId: Preferences.shipId, messageId: "aaaa")
//request.time = DateTextLib.Date2ISO8601Text(date: Date())
request.location = 2 //1:Shore , 2:Ship
// request.fromeId = SharingData.my.shipName //ユーザーID
......@@ -86,7 +86,7 @@ public class SignalRService {
}
func chatMode(_ message: String) {
var request = ReqChatModeMessage(shipId: SharingData.my.shipId)
var request = ReqChatModeMessage(shipId: Preferences.shipId)
// request.time = DateTextLib.Date2ISO8601Text(date: Date())
request.location = 2 //1:Shore , 2:Ship
// request.fromeId = SharingData.my.shipName //ユーザーID
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment