Merge remote-tracking branch 'origin/develop' into new/ThermoCamManager

This commit is contained in:
Samuele E. Locatelli
2021-03-23 19:33:43 +01:00
17 changed files with 206 additions and 32 deletions
+17 -4
View File
@@ -49,6 +49,7 @@ public static class ThreadsFunctions
public static int modulesRtCounter = 0;
public static int recipeRtCounter = 0;
public static bool reconnectionIsRunning = false;
public static bool forcetakeSnapshot = false;
#endregion Public Fields
@@ -360,6 +361,14 @@ public static class ThreadsFunctions
// avvio oggetto thermocam
ThermoCamComunicator TCCom = new ThermoCamComunicator(true);
Stopwatch sw = new Stopwatch();
forcetakeSnapshot = false;
RegistrationInfo takeReginfo = MessageServices.Current.Subscribe(TAKE_SNAPSHOT_THERMO, (a, b) =>
{
ThreadsFunctions.forcetakeSnapshot = true;
});
try
{
// Try connection
@@ -380,11 +389,13 @@ public static class ThreadsFunctions
if (libraryError.IsError())
ManageLibraryError(libraryError);
if (flirImageReq)
if (flirImageReq || forcetakeSnapshot)
{
forcetakeSnapshot = false;
bool done = false;
// if requested --> give ack!
ncAdapter.ManageFlirStrobe();
if (flirImageReq)
ncAdapter.ManageFlirStrobe();
// requesto photo from library
NcAdapter.lastThermoImage = TCCom.takePicture();
done = !string.IsNullOrEmpty(NcAdapter.lastThermoImage);
@@ -407,7 +418,8 @@ public static class ThreadsFunctions
ncAdapter.WriteRecipeWarmChTCamTempAct(actualTemp);
NcAdapter.lastImageTaken = DateTime.Now;
// give PLC strobe for uploaded Actual TEMP from image
ncAdapter.SendTCamImageReadyStrb();
if(flirImageReq)
ncAdapter.SendTCamImageReadyStrb();
MessageServices.Current.Publish(SEND_NEWTCAMIMAGE, null, NcAdapter.lastImageTaken);
@@ -438,7 +450,8 @@ public static class ThreadsFunctions
}
finally
{
ncAdapter.Dispose();
MessageServices.Current.UnSubscribe(takeReginfo);
ncAdapter.Dispose();
// chiudo thermocam
TCCom.Dispose();
}
+1
View File
@@ -23,6 +23,7 @@ namespace Thermo.Active.Model
public const string AXES_CONFIG_PATH = CONFIG_DIRECTORY + "axesConfig.xml";
public const string AXES_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + @"axesConfigValidator.xsd";
public const string BROADCAST_DATA = "BROADCAST_DATA";
public const string TAKE_SNAPSHOT_THERMO = "TAKE_SNAPSHOT_THERMO";
// File paths
public const string CLIENT_EXE_NAME = @"Active_Client.exe";
@@ -591,6 +591,19 @@ namespace Thermo.Active.Controllers.WebApi
return NotFound();
}
}
/// <summary>
///Take photo Thermocam
/// </summary>
/// <param name="channelsTemp"></param>
/// <returns></returns>
[Route("takeTcamImage"), HttpPut]
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.RECIPE_MANAGER, Action = ACTIONS.READ)]
public IHttpActionResult TakeTcamImage()
{
MessageServices.Current.Publish(TAKE_SNAPSHOT_THERMO);
return Ok();
}
#endregion Public Methods
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@@ -2092,7 +2092,7 @@
}
.body {
height: calc(~"100%"- 64px);
height: calc(~"100%" - 64px);
overflow: hidden;
align-items: center;
justify-content: center;
@@ -3476,7 +3476,6 @@
position: absolute;
width: 100%;
height: 100%;
background: #ffffff;
top: 0;
display: block;
overflow: hidden;
@@ -3485,6 +3484,9 @@
width: 100%;
height: 100%;
cursor: -webkit-grab;
display: flex;
justify-content: center;
align-items: center;
}
.loading {
@@ -3530,6 +3532,17 @@
}
.btngroup2{
position: absolute;
bottom: 510px;
right: 0;
margin-right: 20px;
img{
box-shadow: none;
filter: grayscale(1)brightness(0)invert(1);
}
}
.btngroup {
position: absolute;
bottom: 0;
@@ -3562,6 +3575,9 @@
cursor: pointer;
color: #FFF;
z-index: 1;
display: flex;
justify-content: center;
align-items: center;
}
button:disabled {
+17 -4
View File
@@ -2321,7 +2321,7 @@ article .box .body {
color: #fff;
}
.modal.modal-image .body {
height: calc(100%-64px);
height: calc(100% - 64px);
overflow: hidden;
align-items: center;
justify-content: center;
@@ -3668,7 +3668,6 @@ article .box .body {
position: absolute;
width: 100%;
height: 100%;
background: #ffffff;
top: 0;
display: block;
overflow: hidden;
@@ -3677,6 +3676,9 @@ article .box .body {
width: 100%;
height: 100%;
cursor: -webkit-grab;
display: flex;
justify-content: center;
align-items: center;
}
.imageViewerZoom .loading {
position: absolute;
@@ -3715,6 +3717,16 @@ article .box .body {
margin-right: 20px;
margin-top: 20px;
}
.imageViewerZoom .btngroup2 {
position: absolute;
bottom: 510px;
right: 0;
margin-right: 20px;
}
.imageViewerZoom .btngroup2 img {
box-shadow: none;
filter: grayscale(1) brightness(0) invert(1);
}
.imageViewerZoom .btngroup {
position: absolute;
bottom: 0;
@@ -3730,8 +3742,6 @@ article .box .body {
}
.imageViewerZoom button {
font-size: 20px;
justify-content: center;
display: flex;
background-color: #ffffff;
background-image: linear-gradient(to bottom, #1756ad, #002680);
box-shadow: 0 3px 5px 0 rgba(0, 0, 0, 0.4);
@@ -3744,6 +3754,9 @@ article .box .body {
cursor: pointer;
color: #FFF;
z-index: 1;
display: flex;
justify-content: center;
align-items: center;
}
.imageViewerZoom button:disabled {
background-color: #002680 !important;
@@ -0,0 +1,70 @@
.warmers {
display: grid !important;
grid-template-columns: 1fr 70px;
margin-right: -14px;
}
.warmers .right-controls {
display: flex;
flex-flow: column nowrap;
align-items: center;
justify-content: space-between;
}
.warmers .right-controls .tm-controls {
display: flex;
flex-flow: column;
align-items: center;
justify-content: space-between;
height: 420px;
}
.warmers .right-controls .tm-controls input[type="range"][orient="vertical"] {
writing-mode: bt-lr;
/* IE */
-webkit-appearance: slider-vertical;
/* WebKit */
width: 6px;
height: 150px;
border: none !important;
box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.5);
border-radius: 10px;
}
.warmers .right-controls .tm-controls input[type="range"][orient="vertical"]::-webkit-slider-thumb {
min-width: 30px;
min-height: 30px;
border: none;
background: none !important;
appearance: none;
}
.warmers .right-controls .tm-controls input[type="range"]::-webkit-slider-thumb {
background-color: linear-gradient(to bottom, #1756ad, #002e6e 97%) !important;
}
.warmers .right-controls .um-buttons {
background-color: #dddddd;
height: 130px;
width: 40px;
border-radius: 20px;
box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.5);
display: flex;
flex-flow: column nowrap;
justify-content: space-around;
align-items: center;
}
.warmers .right-controls .um-buttons button {
width: 34px;
height: 34px;
border-radius: 50px;
border: none;
text-align: center;
line-height: 34px;
font-size: 18px;
font-weight: bold;
color: #fff;
box-shadow: inset 0 2px 2px 0 rgba(0, 0, 0, 0.19);
background-color: rgba(187, 188, 188, 0.5);
}
.warmers .right-controls .um-buttons button.selected {
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.5);
background-image: linear-gradient(to bottom, #1756ad, #002e6e 97%);
}
.warmers .right-controls .buttons button {
margin: 8px;
}
@@ -13,13 +13,13 @@
flex-flow: column;
align-items: center;
justify-content: space-between;
height: 350px;
height: 420px;
input[type="range"][orient="vertical"] {
writing-mode: bt-lr; /* IE */
-webkit-appearance: slider-vertical; /* WebKit */
width: 6px;
height: 250px;
height: 150px;
border: none !important;
box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.5);
border-radius: 10px;
@@ -10,11 +10,12 @@ import termoModal from "./thermoProphet-modal.vue";
import { ModalHelper } from '@/components/modals';
import moment from "moment";
import { messageService } from "src/_base";
import ModalImage from "@/modules/base-components/modal-image.vue";
@Component({
name: "thermocamera", components: {
warmers
warmers,ModalImage
}
})
export default class Thermocamera extends Vue {
@@ -64,8 +65,8 @@ export default class Thermocamera extends Vue {
messageService.subscribeToChannel("new-thermocam-image", (args)=>{
if(this.TCamData){
console.log(args)
this.TCamData.lastTakenImage = args[0];
ModalHelper.modalImage.content = this.thermocameraOriginalUrl;
}
});
}
@@ -95,6 +96,11 @@ export default class Thermocamera extends Vue {
return "/thermoprophet/colored/_last.jpg?lastmod=NOTAVAILABLE";
return "/thermoprophet/colored/_last.jpg?lastmod=" + this.TCamData.lastTakenImage;
}
get thermocameraOriginalUrl(){
if(!this.TCamData || moment(this.TCamData.lastTakenImage).year() <= 2000)
return "/thermoprophet/original/_last.jpg?lastmod=NOTAVAILABLE";
return "/thermoprophet/original/_last.jpg?lastmod=" + this.TCamData.lastTakenImage;
}
get thermocameraImageOk(): boolean {
clearInterval(this.timeoutLastTakenImage);
@@ -231,4 +237,16 @@ export default class Thermocamera extends Vue {
async openThermoModal() {
ModalHelper.ShowModal(termoModal, "modal2");
}
async openImageModal() {
ModalHelper.modalImage.title = moment(this.TCamData.lastTakenImage).format("L") + " - " + moment(this.TCamData.lastTakenImage).format("LTS");
ModalHelper.modalImage.content = this.thermocameraOriginalUrl;
ModalHelper.ShowModal(ModalImage, "modal2");
}
async forceTakeImage() {
warmersService.TakeNewPhoto();
}
}
@@ -125,9 +125,15 @@
</div>
<div class="tm-controls">
<button class="btn btn-info square" @click="openThermoModal()">
<button class="btn btn-info square" @click="forceTakeImage()">
<img src="/assets/icons/png/takesnap.png" />
</button>
<button class="btn btn-info square" @click="openImageModal()">
<img src="/assets/icons/png/ico-bt-selez-image.png" />
</button>
<button class="btn btn-info square" @click="openThermoModal()">
<img src="/assets/icons/png/history.png" />
</button>
<span>{{timeCamDiff}}</span>
<input
:disabled="!thermocameraImageOk"
@@ -49,7 +49,8 @@ export class ModalHelper {
};
public static modalImage = {
content: null,
title: null
title: null,
lastPhoto:null
};
public static maintenanceModal = {
currentMaintenance: null,
@@ -3,6 +3,7 @@ import { Factory, messageService } from "../../_base";
import ZoomImage from './zoom-image.vue'
import Vue from "vue";
import Component from "vue-class-component";
import moment from "moment";
@Component({
components:{
@@ -13,19 +14,24 @@ import Component from "vue-class-component";
export default class ModalImage extends Vue {
content: string = "";
title: string = "";
content: string = "";
title: string = "";
mounted() {
this.content = ModalHelper.modalImage.content;
this.title = ModalHelper.modalImage.title;
mounted() {
this.content = ModalHelper.modalImage.content;
this.title = ModalHelper.modalImage.title;
}
messageService.subscribeToChannel("new-thermocam-image", (args)=>{
this.content = "/thermoprophet/original/_last.jpg?lastmod=" + args[0];
this.title = moment(args[0]).format("L") + " - " + moment(args[0]).format("LTS");
});
}
beforeMount() {
messageService.subscribeToChannel("esc_pressed", args => {
this.close();
});
beforeMount() {
messageService.subscribeToChannel("esc_pressed", args => {
this.close();
});
}
beforeDestroy() {
@@ -34,7 +40,7 @@ export default class ModalImage extends Vue {
close() {
messageService.deleteChannel("esc_pressed");
ModalHelper.HideModal();
ModalHelper.HideModal("modal2");
}
};
@@ -1,8 +1,7 @@
<template>
<modal type="modal-image" :title="title">
<button class="close" slot="header-buttons" @click="close()"><i class="fa fa-remove"></i></button>
<zoom-image :imageSrc="this.content" :showBackButton="false" />
<zoom-image :imageSrc="this.content" :showBackButton="false" :isTcam="true"/>
</modal>
</template>
<script src="./modal-image.ts" lang="ts" />
<!--<script src="./create-maintenance.ts" lang="ts"></script>-->
@@ -1,5 +1,6 @@
import Vue from "vue";
import { Prop, Component } from "vue-property-decorator";
import { warmersService } from "@/services/warmersService";
@Component([])
export default class ZoomImage extends Vue {
@@ -9,6 +10,8 @@ export default class ZoomImage extends Vue {
imageSrc: string;
@Prop({ default: true })
showBackButton: boolean;
@Prop({ default: false })
isTcam: boolean;
transImage: string = "";
scaleImage: number = 1;
@@ -136,5 +139,10 @@ export default class ZoomImage extends Vue {
this.transImage = "translateX(" + 0 + "px)translateY(" + 0 + "px)scale(" + this.scaleImage + ")";
}
async forceTakeImage() {
warmersService.TakeNewPhoto();
}
};
@@ -7,14 +7,19 @@
@touchstart="dw"
@touchmove="move"
@dblclick="zoomPlusAnimated">
<svg xmlns="http://www.w3.org/2000/svg" :style="{'transform':transImage}" v-html="imageSrc" version="1.1" width="100%" height="100%" viewBox="0 0 2000 1500" v-on:load="onImageLoaded"></svg>
<img ref="imageChild" :style="{'transform':transImage,'transition':animation}" :src="imageSrc" v-on:load="onImageLoaded" >
<!-- <svg xmlns="http://www.w3.org/2000/svg" :style="{'transform':transImage}" v-html="imageSrc" version="1.1" width="100%" height="100%" viewBox="0 0 2000 1500" v-on:load="onImageLoaded"></svg>-->
</div>
<!-- <div class="loading" v-if="!imageLoaded"><i class="fa fa-circle-o-notch fa-spin"></i></div>-->
<div class="loading" v-if="!imageLoaded"><i class="fa fa-circle-o-notch fa-spin"></i></div>
<div class="btngroup_close" v-if="showBackButton">
<button @click="close"><i class="fa fa-chevron-left" ></i></button>
</div>
<div class="btngroup2" v-if="true">
<button @click="forceTakeImage()">
<img src="/assets/icons/png/takesnap.png" />
</button>
</div>
<div class="btngroup">
<button @click="zoomPlusAnimated"><i class="fa fa-search-plus" ></i></button>
<div class="rangecontainer">
@@ -90,5 +90,10 @@ export class WarmersService extends baseRestService {
async ResetMeasurePoints() {
return this.Put((await this.BASE_URL()) + `resetMeasurePoint`, null, true);
}
async TakeNewPhoto() {
return this.Put((await this.BASE_URL()) + `TakeTcamImage`, null, true);
}
}
export const warmersService = new WarmersService();