Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sailassist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
54
Merge Requests
54
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gr-ssv
Sailassist
Commits
f4d8fe36
Commit
f4d8fe36
authored
Sep 20, 2025
by
shigemi miura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
音声入力追加
parent
a2e1336e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
66 deletions
+37
-66
Imagepicker.swift
Seilassist/Sailassist/Chat/Imagepicker.swift
+3
-2
ChatInputView.swift
Seilassist/Sailassist/Chat/View/ChatInputView.swift
+18
-16
LocationCalculation.swift
Seilassist/Sailassist/Location/LocationCalculation.swift
+10
-10
SailassistApp.swift
Seilassist/Sailassist/SailassistApp.swift
+6
-1
ServerSession.swift
Seilassist/Sailassist/ServerSession/ServerSession.swift
+0
-37
No files found.
Seilassist/Sailassist/Chat/Imagepicker.swift
View file @
f4d8fe36
...
...
@@ -42,8 +42,9 @@ struct Imagepicker : UIViewControllerRepresentable {
//Use Photo
func
imagePickerController
(
_
picker
:
UIImagePickerController
,
didFinishPickingMediaWithInfo
info
:
[
UIImagePickerController
.
InfoKey
:
Any
])
{
let
image
=
info
[
.
originalImage
]
as!
UIImage
let
data
=
image
.
pngData
()
self
.
parent
.
image
=
data
!
if
let
data
=
image
.
jpegData
(
compressionQuality
:
1.0
)
{
self
.
parent
.
image
=
data
}
self
.
parent
.
show
.
toggle
()
}
}
...
...
Seilassist/Sailassist/Chat/View/ChatInputView.swift
View file @
f4d8fe36
...
...
@@ -34,6 +34,8 @@ struct ChatInputView: View {
Divider
()
HStack
(
spacing
:
10
)
{
Spacer
(
minLength
:
10
)
// MARK: - カメラボタン
Button
{
sceneDelegate
.
tabWindow
?
.
isHidden
=
true
...
...
@@ -73,24 +75,24 @@ struct ChatInputView: View {
}
//MARK: - 音声入力ボタン
//
Button {
//
isRecording.toggle()
//
if isRecording {
//
speechRecognizer.transcribedText = ""
//
speechRecognizer.startRecording()
//
} else {
//
speechRecognizer.stopRecording()
//
inputText = speechRecognizer.transcribedText
//
}
//
} label: {
//
Image(systemName: isRecording ? "mic.fill" : "mic")
//
.resizable()
//
.frame(width: 20, height: 20)
//
.padding(5)
//
}
Button
{
isRecording
.
toggle
()
if
isRecording
{
speechRecognizer
.
transcribedText
=
""
speechRecognizer
.
startRecording
()
}
else
{
speechRecognizer
.
stopRecording
()
inputText
=
speechRecognizer
.
transcribedText
}
}
label
:
{
Image
(
systemName
:
isRecording
?
"mic.fill"
:
"mic"
)
.
resizable
()
.
frame
(
width
:
20
,
height
:
20
)
.
padding
(
5
)
}
//MARK: - テキスト入力
TextField
(
""
,
text
:
$
inputText
,
onEditingChanged
:
{
isEditing
in
TextField
(
"
Enter your message
"
,
text
:
$
inputText
,
onEditingChanged
:
{
isEditing
in
sceneDelegate
.
tabWindow
?
.
isHidden
=
isEditing
isFocus
=
true
})
...
...
Seilassist/Sailassist/Location/LocationCalculation.swift
View file @
f4d8fe36
...
...
@@ -909,7 +909,7 @@ class LocationCalculation{
}
if
let
dist
=
distance
{
print
(
debug
:
"checkPolyline
\(
dist
)
"
)
//
print(debug: "checkPolyline \(dist)")
}
return
distance
}
...
...
@@ -950,14 +950,14 @@ class LocationCalculation{
}
}
print
(
debug
:
"crossLineDistance
\(
rtn
)
/(isOutside)/(distance)"
)
//
print(debug: "crossLineDistance \(rtn)/(isOutside)/(distance)")
}
}
if
isOutside
{
distance
*=
-
1
}
print
(
debug
:
"crossLineDistance
\(
distance
)
"
)
//
print(debug: "crossLineDistance \(distance)")
return
(
isCross
,
distance
)
}
...
...
@@ -988,7 +988,7 @@ class LocationCalculation{
for
cnt
in
0
...
(
loopCntMax
-
1
)
{
let
newDistance
=
distance2
(
lastPos
:
objPos
[
cnt
],
nextPos
:
shipPos
,
type
:
Mrdc
.
E_NV_MRDC_NORMAL
)
if
newDistance
.
retCode
{
print
(
debug
:
"pointsDistance
\(
newDistance
)
(cnt)"
)
//
print(debug: "pointsDistance \(newDistance) (cnt)")
if
distance
>
newDistance
.
dist
{
distance
=
newDistance
.
dist
nearbyPoint
=
cnt
...
...
@@ -1024,7 +1024,7 @@ class LocationCalculation{
var
distance1
=
0.0
let
rtn1
=
eNvXteRL
(
lastPos
:
objPos
[
beforePoint
],
nextPos
:
objPos
[
nearbyPoint
],
shipPos
:
shipPos
)
if
rtn1
.
retCode
{
print
(
debug
:
"pointsDistance
\(
rtn1
)
/(beforePoint)/(nearbyPoint)/(distance)"
)
//
print(debug: "pointsDistance \(rtn1)/(beforePoint)/(nearbyPoint)/(distance)")
if
rtn1
.
xte
<
0
{
outside1
=
true
}
...
...
@@ -1035,7 +1035,7 @@ class LocationCalculation{
var
distance2
=
0.0
let
rtn2
=
eNvXteRL
(
lastPos
:
objPos
[
nearbyPoint
],
nextPos
:
objPos
[
nextPoint
],
shipPos
:
shipPos
)
if
rtn2
.
retCode
{
print
(
debug
:
"pointsDistance
\(
rtn2
)
/(beforePoint)/(nearbyPoint)/(distance)"
)
//
print(debug: "pointsDistance \(rtn2)/(beforePoint)/(nearbyPoint)/(distance)")
if
rtn2
.
xte
<
0
{
outside2
=
true
}
...
...
@@ -1060,7 +1060,7 @@ class LocationCalculation{
if
outside
{
distance
*=
-
1
}
print
(
debug
:
"pointsDistance
\(
distance
)
"
)
//
print(debug: "pointsDistance \(distance)")
return
(
lineOut
,
distance
)
}
...
...
@@ -1077,13 +1077,13 @@ class LocationCalculation{
->
(
retCode
:
Bool
,
xte
:
Double
)
//正常終了:true 異常:false 距離[NM]
{
let
rtn1
=
eNvMrdc
(
lastPos
:
lastPos
,
nextPos
:
nextPos
,
type
:
Mrdc
.
E_NV_MRDC_NORMAL
)
print
(
debug
:
"eNvXteRL1
\(
rtn1
)
"
)
//
print(debug: "eNvXteRL1 \(rtn1)")
if
(
!
rtn1
.
retCode
)
{
return
(
false
,
0.0
)
}
let
rRegCo
=
LocationCalculation
.
deg2rad
(
deg
:
rtn1
.
co1
)
let
rtn2
=
eNvMrdc
(
lastPos
:
lastPos
,
nextPos
:
shipPos
,
type
:
Mrdc
.
E_NV_MRDC_NORMAL
)
print
(
debug
:
"eNvXteRL2
\(
rtn2
)
"
)
//
print(debug: "eNvXteRL2 \(rtn2)")
if
(
!
rtn2
.
retCode
)
{
return
(
false
,
0.0
)
}
...
...
@@ -1318,7 +1318,7 @@ class LocationCalculation{
dist
=
LocationCalculation
.
rad2deg
(
rad
:
dist
)
*
deg2NM
}
dist
=
abs
(
dist
)
print
(
debug
:
"dist:
\(
dist
)
"
)
//
print( debug: "dist:\(dist)" )
return
DistanceInf
(
retCode
:
true
,
dist
:
dist
)
}
...
...
Seilassist/Sailassist/SailassistApp.swift
View file @
f4d8fe36
...
...
@@ -117,7 +117,7 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
.
withAutoReconnect
()
// .withLogging(minLogLevel: .error)
.
withLogging
(
minLogLevel
:
.
debug
)
.
withHubConnectionOptions
(
configureHubConnectionOptions
:
{
options
in
options
.
keepAliveInterval
=
20
})
.
withHubConnectionOptions
(
configureHubConnectionOptions
:
{
options
in
options
.
keepAliveInterval
=
30
})
.
build
()
if
let
r_connection
=
connection
{
...
...
@@ -315,22 +315,27 @@ class ChatHubConnectionDelegate: HubConnectionDelegate {
}
func
connectionDidOpen
(
hubConnection
:
HubConnection
)
{
print
(
debug
:
"connectionDidStart"
)
app
?
.
connectionDidStart
()
}
func
connectionDidFailToOpen
(
error
:
Error
)
{
print
(
debug
:
"connectionDidFailToOpen:
\(
error
)
"
)
app
?
.
connectionDidFailToOpen
(
error
:
error
)
}
func
connectionDidClose
(
error
:
Error
?)
{
print
(
debug
:
"connectionDidClose:
\(
String
(
describing
:
error
)
)
"
)
app
?
.
connectionDidClose
(
error
:
error
)
}
func
connectionWillReconnect
(
error
:
Error
)
{
print
(
debug
:
"connectionWillReconnect:
\(
error
)
"
)
app
?
.
connectionWillReconnect
(
error
:
error
)
}
func
connectionDidReconnect
()
{
print
(
debug
:
"connectionDidReconnect"
)
app
?
.
connectionDidReconnect
()
}
}
...
...
Seilassist/Sailassist/ServerSession/ServerSession.swift
View file @
f4d8fe36
...
...
@@ -231,41 +231,4 @@ class ServerSession{
}
return
false
}
func
httpBody
(
boundary
:
String
,
_
uploadImage
:
ReqUploadImage
)
->
Data
!
{
var
httpBody1
=
"--
\(
boundary
)\r\n
"
httpBody1
+=
"Content-Disposition: form-data; name=
\"
ShipId
\"\r\n
"
httpBody1
+=
"
\r\n
"
httpBody1
+=
"
\(
uploadImage
.
shipId
)\r\n
"
httpBody1
+=
"--
\(
boundary
)\r\n
"
httpBody1
+=
"Content-Disposition: form-data; name=
\"
MessageId
\"\r\n
"
httpBody1
+=
"
\r\n
"
httpBody1
+=
"
\(
uploadImage
.
messageId
)\r\n
"
httpBody1
+=
"--
\(
boundary
)\r\n
"
httpBody1
+=
"Content-Disposition: form-data; name=
\"
Location
\"\r\n
"
httpBody1
+=
"
\r\n
"
httpBody1
+=
"
\(
uploadImage
.
location
)\r\n
"
httpBody1
+=
"--
\(
boundary
)\r\n
"
httpBody1
+=
"Content-Disposition: form-data; name=
\"
From
\"\r\n
"
httpBody1
+=
"
\r\n
"
httpBody1
+=
"
\(
uploadImage
.
from
)\r\n
"
httpBody1
+=
"--
\(
boundary
)\r\n
"
httpBody1
+=
"Content-Disposition: form-data; name=
\"
FromId
\"\r\n
"
httpBody1
+=
"
\r\n
"
httpBody1
+=
"
\(
uploadImage
.
fromId
)\r\n
"
httpBody1
+=
"--
\(
boundary
)\r\n
"
httpBody1
+=
"Content-Type: image/jpeg
\r\n
"
httpBody1
+=
"
\r\n
"
var
httpBody
=
Data
()
httpBody
.
append
(
httpBody1
.
data
(
using
:
.
utf8
)
!
)
httpBody
.
append
(
uploadImage
.
files
)
var
httpBody2
=
"
\r\n
"
httpBody2
+=
"--
\(
boundary
)
--
\r\n
"
httpBody
.
append
(
httpBody2
.
data
(
using
:
.
utf8
)
!
)
return
httpBody
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment