1、合并master与2021.1
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
[RING_LIGHT_RS232_SERIALCOMPORT]
|
||||
RingLightRS232SerialComport=1
|
||||
[DIGITAL_LUX_METER_RS232_SERIALCOMPORT]
|
||||
DigitalLuxMeterRS232Enable=1
|
||||
DigitalLuxMeterRS232ComNum=3
|
||||
DigitalLuxMeterRS232SleepTime=100
|
||||
DigitalLuxMeterCabStep=0.100000
|
||||
DigitalLuxMeterCabCompGap=25
|
||||
DigitalLuxMeterGetSingRingInitValue=1
|
||||
DigitalLuxMeterGetWhichRingForInitValue=2
|
||||
@@ -0,0 +1,101 @@
|
||||
0%Value,15.0,843,15.0,865,15.0,608,15.0,925,15.0,977,15.0,1023,
|
||||
1%Value,134.9,1096,94.9,1117,64.8,1095,56.8,1128,50.8,1166,44.8,1203,
|
||||
2%Value,254.7,1209,179.8,1241,114.7,1235,98.7,1252,86.7,1283,74.7,1315,
|
||||
3%Value,374.5,1298,264.7,1335,164.6,1339,140.6,1345,122.6,1375,104.6,1406,
|
||||
4%Value,494.4,1370,349.6,1415,214.4,1428,182.4,1424,158.4,1453,134.4,1483,
|
||||
5%Value,614.3,1435,434.5,1483,264.3,1500,224.3,1493,194.3,1523,164.3,1552,
|
||||
6%Value,734.1,1494,519.4,1545,314.1,1563,266.1,1556,230.1,1588,194.1,1615,
|
||||
7%Value,854.0,1548,604.3,1602,364.0,1626,308.0,1615,266.0,1644,223.9,1676,
|
||||
8%Value,973.8,1600,689.2,1657,413.8,1682,349.8,1669,301.8,1696,253.8,1731,
|
||||
9%Value,1093.7,1647,774.1,1707,463.6,1736,391.6,1719,337.6,1756,283.6,1781,
|
||||
10%Value,1213.5,1693,859.0,1757,513.5,1789,433.5,1767,373.5,1803,313.5,1833,
|
||||
11%Value,1333.3,1736,943.9,1803,563.3,1839,475.4,1813,409.4,1850,343.4,1880,
|
||||
12%Value,1453.2,1778,1028.8,1849,613.2,1887,517.2,1859,445.2,1898,373.2,1923,
|
||||
13%Value,1573.1,1820,1113.7,1892,663.0,1932,559.0,1902,481.0,1941,403.0,1966,
|
||||
14%Value,1692.9,1859,1198.6,1934,712.9,1975,600.9,1943,516.9,1986,432.9,2011,
|
||||
15%Value,1812.8,1898,1283.5,1974,762.8,2018,642.8,1984,552.8,2028,462.8,2055,
|
||||
16%Value,1932.6,1936,1368.4,2015,812.6,2060,684.6,2023,588.6,2067,492.6,2093,
|
||||
17%Value,2052.4,2000,1453.3,2054,862.5,2101,726.5,2062,624.5,2109,522.5,2134,
|
||||
18%Value,2172.3,2031,1538.2,2093,912.3,2141,768.3,2099,660.3,2148,552.3,2172,
|
||||
19%Value,2292.1,2072,1623.1,2130,962.2,2180,810.2,2135,696.2,2184,582.2,2212,
|
||||
20%Value,2412.0,2103,1708.0,2169,1012.0,2218,852.0,2173,732.0,2221,612.0,2248,
|
||||
21%Value,2531.9,2146,1792.9,2206,1061.8,2257,893.8,2210,767.8,2258,641.8,2284,
|
||||
22%Value,2651.7,2179,1877.8,2244,1111.7,2295,935.7,2244,803.7,2296,671.7,2319,
|
||||
23%Value,2771.6,2219,1962.7,2307,1161.6,2332,977.5,2281,839.5,2331,701.5,2356,
|
||||
24%Value,2891.4,2253,2047.6,2347,1211.4,2368,1019.4,2314,875.4,2367,731.4,2390,
|
||||
25%Value,3011.3,2289,2132.5,2386,1261.3,2405,1061.3,2350,911.3,2403,761.3,2426,
|
||||
26%Value,3131.1,2328,2217.4,2413,1311.1,2441,1103.1,2383,947.1,2437,791.1,2459,
|
||||
27%Value,3250.9,2363,2302.3,2457,1360.9,2477,1144.9,2416,983.0,2472,821.0,2493,
|
||||
28%Value,3370.8,2397,2387.2,2495,1410.8,2511,1186.8,2451,1018.8,2507,850.8,2528,
|
||||
29%Value,3490.6,2434,2472.1,2530,1460.7,2546,1228.7,2485,1054.7,2541,880.7,2561,
|
||||
30%Value,3610.5,2469,2557.0,2567,1510.5,2581,1270.5,2516,1090.5,2576,910.5,2594,
|
||||
31%Value,3730.4,2506,2641.9,2611,1560.3,2616,1312.3,2550,1126.3,2608,940.3,2627,
|
||||
32%Value,3850.2,2546,2726.8,2639,1610.2,2653,1354.2,2582,1162.2,2642,970.2,2661,
|
||||
33%Value,3970.1,2580,2811.7,2683,1660.1,2689,1396.1,2616,1198.1,2675,1000.0,2696,
|
||||
34%Value,4089.9,2611,2896.6,2722,1709.9,2724,1437.9,2649,1233.9,2708,1029.9,2728,
|
||||
35%Value,4209.8,2646,2981.5,2763,1759.8,2761,1479.8,2682,1269.8,2742,1059.8,2759,
|
||||
36%Value,4329.6,2681,3066.4,2790,1809.6,2796,1521.6,2715,1305.6,2775,1089.6,2792,
|
||||
37%Value,4449.5,2721,3151.3,2836,1859.4,2831,1563.4,2748,1341.4,2807,1119.4,2826,
|
||||
38%Value,4569.3,2752,3236.2,2877,1909.3,2867,1605.3,2780,1377.3,2840,1149.3,2859,
|
||||
39%Value,4689.1,2795,3321.1,2907,1959.2,2902,1647.2,2814,1413.2,2872,1179.2,2891,
|
||||
40%Value,4809.0,2830,3406.0,2937,2009.0,2940,1689.0,2847,1449.0,2906,1209.0,2925,
|
||||
41%Value,4928.9,2866,3490.9,2984,2058.9,2974,1730.8,2881,1484.8,2940,1238.8,2956,
|
||||
42%Value,5048.7,2902,3575.8,3014,2108.7,3059,1772.7,2914,1520.7,2972,1268.7,2987,
|
||||
43%Value,5168.5,2937,3660.7,3060,2158.6,3086,1814.6,2947,1556.6,3006,1298.6,3019,
|
||||
44%Value,5288.4,2974,3745.6,3097,2208.4,3136,1856.4,2980,1592.4,3038,1328.4,3051,
|
||||
45%Value,5408.3,3010,3830.5,3125,2258.3,3173,1898.3,3013,1628.3,3072,1358.3,3084,
|
||||
46%Value,5528.1,3049,3915.4,3173,2308.1,3206,1940.1,3046,1664.1,3103,1388.1,3116,
|
||||
47%Value,5648.0,3082,4000.3,3208,2357.9,3242,1981.9,3080,1699.9,3138,1417.9,3147,
|
||||
48%Value,5767.8,3118,4085.2,3243,2407.8,3278,2023.8,3119,1735.8,3170,1447.8,3180,
|
||||
49%Value,5887.6,3156,4170.1,3280,2457.6,3309,2065.6,3207,1771.7,3203,1477.7,3213,
|
||||
50%Value,6007.5,3189,4255.0,3322,2507.5,3361,2107.5,3242,1807.5,3237,1507.5,3245,
|
||||
51%Value,6127.4,3227,4339.9,3354,2557.4,3396,2149.4,3262,1843.3,3270,1537.3,3276,
|
||||
52%Value,6247.2,3261,4424.8,3397,2607.2,3422,2191.2,3300,1879.2,3301,1567.2,3309,
|
||||
53%Value,6367.0,3301,4509.7,3429,2657.1,3458,2233.1,3332,1915.1,3333,1597.1,3343,
|
||||
54%Value,6486.9,3332,4594.6,3464,2706.9,3496,2274.9,3367,1950.9,3367,1626.9,3374,
|
||||
55%Value,6606.8,3370,4679.5,3512,2756.8,3535,2316.8,3396,1986.8,3399,1656.8,3407,
|
||||
56%Value,6726.6,3407,4764.4,3547,2806.6,3566,2358.6,3425,2022.6,3435,1686.6,3441,
|
||||
57%Value,6846.5,3442,4849.3,3584,2856.4,3605,2400.4,3458,2058.4,3523,1716.4,3472,
|
||||
58%Value,6966.3,3479,4934.2,3622,2906.3,3641,2442.3,3501,2094.3,3560,1746.3,3506,
|
||||
59%Value,7086.1,3516,5019.1,3660,2956.1,3678,2484.1,3550,2130.1,3592,1776.2,3539,
|
||||
60%Value,7206.0,3555,5104.0,3701,3006.0,3710,2526.0,3575,2166.0,3624,1806.0,3571,
|
||||
61%Value,7325.9,3588,5188.9,3729,3055.9,3753,2567.9,3600,2201.9,3654,1835.8,3603,
|
||||
62%Value,7445.7,3629,5273.8,3776,3105.7,3794,2609.7,3637,2237.7,3698,1865.7,3636,
|
||||
63%Value,7565.5,3664,5358.7,3805,3155.6,3822,2651.6,3676,2273.6,3729,1895.6,3668,
|
||||
64%Value,7685.4,3698,5443.6,3851,3205.4,3859,2693.4,3708,2309.4,3764,1925.4,3699,
|
||||
65%Value,7805.3,3736,5528.5,3886,3255.3,3915,2735.3,3742,2345.3,3799,1955.3,3729,
|
||||
66%Value,7925.1,3773,5613.4,3922,3305.1,3946,2777.1,3780,2381.1,3838,1985.1,3763,
|
||||
67%Value,8045.0,3809,5698.3,3965,3354.9,3978,2818.9,3811,2416.9,3872,2014.9,3846,
|
||||
68%Value,8164.8,3845,5783.2,4004,3404.8,4007,2860.8,3850,2452.8,3895,2044.8,3895,
|
||||
69%Value,8284.7,3881,5868.1,4039,3454.6,4062,2902.6,3887,2488.6,3940,2074.6,3920,
|
||||
70%Value,8404.5,3919,5953.0,4072,3504.5,4089,2944.5,3924,2524.5,3962,2104.5,3967,
|
||||
71%Value,8524.3,3957,6037.9,4113,3554.4,4127,2986.4,3950,2560.4,3983,2134.4,3992,
|
||||
72%Value,8644.2,3992,6122.8,4151,3604.2,4155,3028.2,3980,2596.2,4038,2164.2,4033,
|
||||
73%Value,8764.0,4026,6207.7,4194,3654.1,4178,3070.1,4025,2632.1,4063,2194.1,4060,
|
||||
74%Value,8883.9,4064,6292.6,4226,3703.9,4244,3111.9,4060,2667.9,4104,2223.9,4104,
|
||||
75%Value,9003.8,4101,6377.5,4263,3753.8,4271,3153.8,4086,2703.8,4129,2253.8,4133,
|
||||
76%Value,9123.6,4138,6462.4,4305,3803.6,4308,3195.6,4121,2739.6,4166,2283.6,4178,
|
||||
77%Value,9243.5,4176,6547.3,4343,3853.4,4339,3237.4,4160,2775.4,4195,2313.4,4208,
|
||||
78%Value,9363.3,4216,6632.2,4376,3903.3,4386,3279.3,4199,2811.3,4224,2343.3,4239,
|
||||
79%Value,9483.2,4248,6717.1,4418,3953.1,4427,3321.1,4235,2847.1,4279,2373.1,4269,
|
||||
80%Value,9603.0,4290,6802.0,4459,4003.0,4464,3363.0,4260,2883.0,4314,2403.0,4299,
|
||||
81%Value,9722.8,4328,6886.9,4494,4052.9,4495,3404.9,4292,2918.9,4349,2432.9,4344,
|
||||
82%Value,9842.7,4364,6971.8,4532,4102.7,4531,3446.7,4324,2954.7,4370,2462.7,4368,
|
||||
83%Value,9962.5,4400,7056.7,4577,4152.5,4571,3488.6,4373,2990.6,4410,2492.6,4432,
|
||||
84%Value,10082.4,4438,7141.6,4613,4202.4,4606,3530.4,4395,3026.4,4450,2522.4,4453,
|
||||
85%Value,10202.3,4475,7226.5,4652,4252.3,4640,3572.3,4435,3062.3,4482,2552.3,4474,
|
||||
86%Value,10322.1,4514,7311.4,4688,4302.1,4680,3614.1,4465,3098.1,4516,2582.1,4518,
|
||||
87%Value,10442.0,4547,7396.3,4723,4352.0,4705,3655.9,4496,3133.9,4550,2611.9,4551,
|
||||
88%Value,10561.8,4585,7481.2,4765,4401.8,4757,3697.8,4539,3169.8,4583,2641.8,4575,
|
||||
89%Value,10681.7,4625,7566.1,4803,4451.6,4788,3739.6,4575,3205.6,4619,2671.6,4599,
|
||||
90%Value,10801.5,4659,7651.0,4842,4501.5,4819,3781.5,4594,3241.5,4659,2701.5,4638,
|
||||
91%Value,10921.3,4697,7735.9,4877,4551.4,4857,3823.4,4636,3277.4,4699,2731.4,4664,
|
||||
92%Value,11041.2,4733,7820.8,4917,4601.2,4892,3865.2,4668,3313.2,4733,2761.2,4734,
|
||||
93%Value,11161.0,4771,7905.7,4948,4651.0,4934,3907.1,4714,3349.1,4761,2791.1,4754,
|
||||
94%Value,11280.9,4807,7990.6,4955,4700.9,4943,3948.9,4749,3384.9,4795,2820.9,4774,
|
||||
95%Value,11400.8,4844,8075.5,4962,4750.8,4952,3990.8,4785,3420.8,4819,2850.8,4826,
|
||||
96%Value,11520.6,4880,8160.4,4969,4800.6,4961,4032.6,4810,3456.6,4863,2880.6,4858,
|
||||
97%Value,11640.5,4911,8245.3,4976,4850.5,4970,4074.4,4858,3492.4,4901,2910.4,4887,
|
||||
98%Value,11760.3,4946,8330.2,4983,4900.3,4979,4116.3,4885,3528.3,4935,2940.3,4916,
|
||||
99%Value,11880.2,4973,8415.1,4990,4950.1,4988,4158.1,4922,3564.1,4965,2970.1,4945,
|
||||
100%Value,12000.0,5000,8500.0,4997,5000.0,4997,4200.0,4956,3600.0,4976,3000.0,4974,
|
||||
|
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UtilityForSo7Light", "UtilityForSo7Light\UtilityForSo7Light.vcxproj", "{BFC37D2E-B136-44A0-9FC6-64A410E6C13A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{BFC37D2E-B136-44A0-9FC6-64A410E6C13A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BFC37D2E-B136-44A0-9FC6-64A410E6C13A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BFC37D2E-B136-44A0-9FC6-64A410E6C13A}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{BFC37D2E-B136-44A0-9FC6-64A410E6C13A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BFC37D2E-B136-44A0-9FC6-64A410E6C13A}.Release|Win32.Build.0 = Release|Win32
|
||||
{BFC37D2E-B136-44A0-9FC6-64A410E6C13A}.Release|x64.ActiveCfg = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+272
@@ -0,0 +1,272 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "cmmio_base.h"
|
||||
#ifdef _WIN64
|
||||
#include "..\..\..\WAI64bit\WAI64bit.h"
|
||||
#endif
|
||||
|
||||
// added notifying feature to base class CMMIO [7/30/2004] /MP
|
||||
// - SetCallback(ptr) to establish the feedback path
|
||||
// then AddReceived will notify if such a ptr was set
|
||||
// caller receive function is prototyped as function(CString), i.e. Recieved(CString sWhat)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CMMIO::Init()
|
||||
{
|
||||
m_RXTempPtr = NULL;
|
||||
m_RXHead=NULL;
|
||||
m_RXTail=NULL;
|
||||
m_SXTempPtr = NULL;
|
||||
m_SXHead=NULL;
|
||||
m_SXTail=NULL;
|
||||
CurrentPointer=0;
|
||||
m_iNbMsgWaiting=0;
|
||||
m_terminator='\0';
|
||||
m_usesTerminator=FALSE;
|
||||
m_pReceiveNotify = NULL;
|
||||
}
|
||||
|
||||
void CMMIO::SetCallback(CMMIO::p_fstr ptr)
|
||||
{
|
||||
m_pReceiveNotify = ptr;
|
||||
}
|
||||
|
||||
DWORD CMMIO::Send(CString buffer, BOOL needsResponse/*=FALSE*/)
|
||||
{
|
||||
//ZH 12-12-05 EnterCriticalSection(&m_QueueLock); //ZH-122904
|
||||
|
||||
char LocBuffer[MAX_OUTPUT_BUFFER_SIZE];
|
||||
int length = buffer.GetLength ();
|
||||
if (length >MAX_OUTPUT_BUFFER_SIZE)
|
||||
{
|
||||
length = MAX_OUTPUT_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
unsigned short* ptr = (unsigned short*)buffer.GetBuffer (MAX_OUTPUT_BUFFER_SIZE);
|
||||
|
||||
for (int i=0;i<length;i++)
|
||||
{
|
||||
LocBuffer[i] = (char)(ptr[i] & 0xff);
|
||||
}
|
||||
DWORD res = Send(LocBuffer,length, needsResponse);
|
||||
|
||||
//ZH 12-12-05 LeaveCriticalSection( &m_QueueLock ); //ZH-122904
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// GetNextReceived() : Helper function, rreturns receives messages placed in the queue
|
||||
// by LineReceive()
|
||||
//
|
||||
int CMMIO::GetNextReceived(char *inputBuf)
|
||||
{
|
||||
struct SerialList *Free;
|
||||
int cnt=0;
|
||||
|
||||
// If there is a previous block then delete it
|
||||
if (NULL != m_RXTempPtr)
|
||||
delete[] m_RXTempPtr;
|
||||
m_RXTempPtr = NULL;
|
||||
|
||||
// We are messing with pointers so use the CriticalSection
|
||||
// EnterCriticalSection(&m_QueueLock);
|
||||
|
||||
// If there any more to return
|
||||
if( m_RXHead )
|
||||
{
|
||||
Free = m_RXHead;
|
||||
m_RXHead = m_RXHead->Next;
|
||||
|
||||
// Point the temp pointer at the block
|
||||
m_RXTempPtr = Free->Buffer;
|
||||
cnt = Free->Bytes;
|
||||
// delete the list entry
|
||||
delete Free;
|
||||
--m_iNbMsgWaiting; // mp
|
||||
|
||||
// move over the data to the user's buffer
|
||||
if (NULL != inputBuf)
|
||||
memcpy (inputBuf, m_RXTempPtr, cnt);
|
||||
}
|
||||
|
||||
if( m_RXHead == NULL )
|
||||
m_RXTail = NULL;
|
||||
|
||||
// All done so out of the CriticalSection
|
||||
// LeaveCriticalSection( &m_QueueLock );
|
||||
|
||||
return(cnt);
|
||||
}
|
||||
|
||||
int CMMIO::AddReceived( const char *Buffer,DWORD Bytes)
|
||||
{
|
||||
DWORD index = 0; //primary buffer index
|
||||
struct SerialList *Ptr;
|
||||
static char Buffer2[MAX_RECIEVE_BUFFER_SIZE]; // result buffer
|
||||
static char* pBuffer2 = &Buffer2[0];
|
||||
unsigned char c;
|
||||
bool bArmed;
|
||||
/************************************************************************/
|
||||
/* Greg Guilbeau - 2011/08/23 */
|
||||
/* The following line(s) have been modified to handle x64 conversion */
|
||||
/************************************************************************/
|
||||
/* int count; */
|
||||
INT_PTR count;
|
||||
static int escape = 0;
|
||||
static int tilde = 0;
|
||||
static int tildeseqcount = 0;
|
||||
|
||||
bool bDone = false;
|
||||
bool bEventRequest = false;
|
||||
|
||||
//TRACE(_T("AddReceived> pBuffer2 = %x\n"),pBuffer2);
|
||||
// TRACE(_T("Content %s\n"),Buffer);
|
||||
if (FALSE /*Bytes==0*/)
|
||||
{
|
||||
TRACE(_T("CMMIO> Exiting , no real input"));
|
||||
return TRUE;
|
||||
}
|
||||
do
|
||||
{
|
||||
bArmed = false;
|
||||
|
||||
for (;index<Bytes;index++)
|
||||
{
|
||||
c=Buffer[index] & 0xff;
|
||||
//TRACE(_T("== %02x% ==\n"),c); //copy char one by one
|
||||
*(pBuffer2++) = c ; //copy char one by one
|
||||
|
||||
// check for end of packet. ignore if this is the last char anyways
|
||||
if (m_usesTerminator && c == m_terminator && (index < Bytes - 1))
|
||||
{
|
||||
bArmed = TRUE;
|
||||
index++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (index == Bytes)
|
||||
bArmed = bDone = true;
|
||||
|
||||
// We are messing with pointers so use the CriticalSection
|
||||
if (bArmed )
|
||||
{
|
||||
// EnterCriticalSection(&m_QueueLock);
|
||||
//Allocate a new list and add it in
|
||||
count = pBuffer2-(&Buffer2[0]);
|
||||
if (m_pReceiveNotify)
|
||||
{ // send a string to callback or,
|
||||
char* pLocalBuffer = new char[count+1];
|
||||
if (pLocalBuffer)
|
||||
{
|
||||
memcpy (pLocalBuffer,Buffer2,count);
|
||||
pLocalBuffer[count] = 0;
|
||||
CString LocalStr(pLocalBuffer);
|
||||
(*m_pReceiveNotify)(LocalStr);
|
||||
delete pLocalBuffer;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // add it as before to received data ....
|
||||
Ptr = new struct SerialList;
|
||||
Ptr->Buffer = new char[count + 1 ];
|
||||
/************************************************************************/
|
||||
/* Greg Guilbeau - 2011/08/23 */
|
||||
/* The following line(s) have been modified to handle x64 conversion */
|
||||
/************************************************************************/
|
||||
/* Ptr->Bytes = count; */
|
||||
#ifdef _WIN64
|
||||
Ptr->Bytes = WAI64bit::to32bit(count,__FILE__,__LINE__);
|
||||
#else
|
||||
Ptr->Bytes = count,__FILE__,__LINE__;
|
||||
#endif
|
||||
Ptr->Next = NULL;
|
||||
memcpy( Ptr->Buffer, Buffer2, count );
|
||||
Ptr->Buffer[count] = 0;
|
||||
|
||||
memcpy(m_sLastMessage,Buffer2,count); //copy to last message
|
||||
m_sLastMessage[count]=0;
|
||||
|
||||
if( m_RXTail )
|
||||
m_RXTail->Next = Ptr;
|
||||
else
|
||||
m_RXHead = Ptr;
|
||||
m_RXTail = Ptr;
|
||||
|
||||
// All done so out of the CriticalSection
|
||||
++m_iNbMsgWaiting;
|
||||
}
|
||||
// LeaveCriticalSection( &m_QueueLock );
|
||||
pBuffer2=&Buffer2[0]; // reset out buffer
|
||||
count = 0;
|
||||
bEventRequest = true;
|
||||
}
|
||||
}
|
||||
while (!bDone);
|
||||
//TRACE (_T("CMMIO> Done\n"));
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
void CMMIO::LineReceive(char* s, int nbCharAvail, BOOL ignoreDelimiter /*= FALSE*/)
|
||||
{
|
||||
if (nbCharAvail != -1)
|
||||
{
|
||||
//TRACE(_T("LineReceive got %d chars \n"),nbCharAvail);
|
||||
char c;
|
||||
for (int i=0 ; i<nbCharAvail ; i++ )
|
||||
{
|
||||
c=s[i];
|
||||
m_InputBuffer[CurrentPointer++] = c;
|
||||
|
||||
// only add a packet if we have a delimiter
|
||||
if ((!m_usesTerminator && i == nbCharAvail -1) || (m_usesTerminator && c == m_terminator) || ignoreDelimiter)
|
||||
{
|
||||
m_InputBuffer[CurrentPointer] = '\0';
|
||||
AddReceived(m_InputBuffer, CurrentPointer);
|
||||
CurrentPointer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
DWORD CMMIO::Close()
|
||||
{
|
||||
struct SerialList *Free;
|
||||
|
||||
// Delete the contents of the temp rx pointer if any
|
||||
delete[] m_RXTempPtr;
|
||||
m_RXTempPtr = NULL;
|
||||
|
||||
// Clear down all internal lists
|
||||
// EnterCriticalSection( &m_QueueLock );
|
||||
while( m_RXHead )
|
||||
{
|
||||
Free = m_RXHead;
|
||||
m_RXHead = m_RXHead->Next;
|
||||
delete[] Free->Buffer;
|
||||
delete Free;
|
||||
}
|
||||
m_RXHead = NULL;
|
||||
|
||||
// for now we are not using the Transmit list
|
||||
#if 0
|
||||
|
||||
while( m_TXHead )
|
||||
{
|
||||
Free = m_TXHead;
|
||||
m_TXHead = m_TXHead->Next;
|
||||
delete[] Free->Buffer;
|
||||
delete Free;
|
||||
}
|
||||
m_TXHead = NULL;
|
||||
#endif
|
||||
// LeaveCriticalSection( &m_QueueLock );
|
||||
return(TRUE);
|
||||
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// END OF BASE CLASS CMMIO
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
#ifndef CMMIO_BASE_H
|
||||
#define CMMIO_BASE_H
|
||||
|
||||
#include <WinBase.h>
|
||||
#include <WinDef.h>
|
||||
|
||||
|
||||
#define MAX_OUTPUT_BUFFER_SIZE 2048
|
||||
#define MAX_RECIEVE_BUFFER_SIZE 30000
|
||||
// TCP, serial style routines
|
||||
struct SerialList
|
||||
{
|
||||
struct SerialList *Next;
|
||||
DWORD Bytes;
|
||||
int Item;
|
||||
char *Buffer;
|
||||
};
|
||||
|
||||
class CMMIO
|
||||
{
|
||||
private:
|
||||
// For now we are not using the transmit list
|
||||
// struct SerialList *m_TXHead;
|
||||
char m_terminator;
|
||||
BOOL m_usesTerminator;
|
||||
char m_InputBuffer[MAX_RECIEVE_BUFFER_SIZE];
|
||||
int CurrentPointer;
|
||||
char m_sLastMessage[MAX_RECIEVE_BUFFER_SIZE];
|
||||
|
||||
struct SerialList *m_RXHead;
|
||||
struct SerialList *m_RXTail;
|
||||
char *m_RXTempPtr;
|
||||
CString m_LastError;
|
||||
BOOL m_hasError;
|
||||
|
||||
protected:
|
||||
CString m_lastErrMsg;
|
||||
int m_iNbMsgWaiting;
|
||||
BOOL m_UseBuffferedSend;
|
||||
CRITICAL_SECTION m_QueueLock;
|
||||
CRITICAL_SECTION m_ReadLock;
|
||||
CRITICAL_SECTION m_WriteLock;
|
||||
|
||||
struct SerialList *m_SXHead;
|
||||
struct SerialList *m_SXTail;
|
||||
char *m_SXTempPtr;
|
||||
|
||||
protected:
|
||||
virtual void Init();
|
||||
int AddReceived( const char *Buffer,DWORD Bytes); // [7/30/2004]
|
||||
void Error(CString sErr) {
|
||||
TRACE(sErr);
|
||||
m_LastError = sErr;
|
||||
m_hasError = TRUE;
|
||||
}
|
||||
|
||||
virtual DWORD Close();
|
||||
|
||||
public:
|
||||
CMMIO()
|
||||
{
|
||||
InitializeCriticalSection( &m_QueueLock ); // Sean Flynn mutex needs to be initialized prior to attempting to lock otherwise it will core
|
||||
InitializeCriticalSection( &m_ReadLock ); // initializing here will ensure the mutex is always initialized
|
||||
InitializeCriticalSection( &m_WriteLock );
|
||||
Init();
|
||||
};
|
||||
|
||||
virtual ~CMMIO()
|
||||
{
|
||||
DeleteCriticalSection( &m_QueueLock ); // Clean up the mutexes resources when the destructor is called.
|
||||
DeleteCriticalSection( &m_ReadLock );
|
||||
DeleteCriticalSection( &m_WriteLock );
|
||||
};
|
||||
|
||||
virtual DWORD Open() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL getError(CString& sErr) {
|
||||
BOOL hasError = m_hasError;
|
||||
if (m_hasError)
|
||||
{
|
||||
sErr = m_LastError;
|
||||
m_hasError = FALSE;
|
||||
}
|
||||
return (hasError);
|
||||
}
|
||||
|
||||
virtual int GetNextReceived(char *inputBuf=NULL);
|
||||
|
||||
virtual int HasNextReceived(void) {
|
||||
return (m_RXHead ? m_RXHead->Bytes : FALSE);
|
||||
}
|
||||
virtual void SetTerminateChar(char ch) {
|
||||
m_terminator=ch;
|
||||
m_usesTerminator=TRUE;
|
||||
}
|
||||
virtual void LineReceive(char* s, int nbCharAvail, BOOL ignoreDelimiter = FALSE);
|
||||
virtual CString GetLastErrStr() {
|
||||
return m_lastErrMsg;
|
||||
}
|
||||
|
||||
typedef void(*p_fstr)(CString);
|
||||
void SetCallback(p_fstr);
|
||||
|
||||
virtual DWORD Send(LPCSTR buffer, int l, BOOL needsResponse=FALSE) = 0; // [8/11/2004]
|
||||
virtual DWORD Send(CString buffer, BOOL needsResponse=FALSE); // [8/11/2004]
|
||||
|
||||
virtual bool IsValid() = 0; // pure virtual function
|
||||
protected:
|
||||
p_fstr m_pReceiveNotify;
|
||||
};
|
||||
|
||||
|
||||
#endif // CMMIO_BASE_H
|
||||
+1275
File diff suppressed because it is too large
Load Diff
+196
@@ -0,0 +1,196 @@
|
||||
#ifndef CMMIO_SERIAL_H
|
||||
#define CMMIO_SERIAL_H
|
||||
|
||||
#include <WinBase.h>
|
||||
#include <WinDef.h>
|
||||
#include "CMMIO_BASE.H "
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
*$!!***************************************************************************
|
||||
*$!! MODULE NAME
|
||||
*$!! Serial.h
|
||||
*$!!
|
||||
*$!! DESCRIPTION
|
||||
*$!! Header file for CPSerial.
|
||||
*$!!
|
||||
*$!! AUTHOR
|
||||
*$!! M.J.S.Gooder.
|
||||
*$!!
|
||||
*$!! HISTORY
|
||||
*$!! $Log: /Plugins/BPI/Serial.h $
|
||||
*$!!
|
||||
*$!! 28 19/03/98 14:04 Mgooder
|
||||
*$!!***************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Function for starting serial monitor thread
|
||||
unsigned int WINAPI CSerialTask(LPVOID CSerialPtr);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Useful serial codes
|
||||
const char CS_NUL = 0;
|
||||
const char CS_SOH = 1;
|
||||
const char CS_STX = 2;
|
||||
const char CS_ETX = 3;
|
||||
const char CS_EOT = 4;
|
||||
const char CS_ENQ = 5;
|
||||
const char CS_ACK = 6;
|
||||
const char CS_BEL = 7;
|
||||
const char CS_LF = 10;
|
||||
const char CS_DLE = 16;
|
||||
const char CS_X_ON = 17;
|
||||
const char CS_X_OFF = 19;
|
||||
const char CS_NAK = 21;
|
||||
const char CS_ETB = 23;
|
||||
const char CS_CAN = 24;
|
||||
const char CS_ESC = 27;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Handshake settings
|
||||
const int CS_HANDSHAKE_RTSCTS = 1;
|
||||
const int CS_HANDSHAKE_XONXOFF = 2;
|
||||
const int CS_HANDSHAKE_NONE = 3;
|
||||
const int CS_HANDSHAKE_RTSCTS_DTRDSR = 4;
|
||||
const int CS_HANDSHAKE_FOR_SO7 = 5;
|
||||
const int CS_HANDSHAKE_FOR_TRESASTR_E = 6;
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Debug constants
|
||||
const int CS_DEBUG_SIZE = 1024;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Timeouts (ms)
|
||||
const int CS_DEFAULT_RX_TIMEOUT = 25;
|
||||
const int CS_DEFAULT_TX_TIMEOUT = 1000;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// The CPSerial class
|
||||
|
||||
class CPSerial : public CMMIO
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CPSerial();
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CPSerial();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
// Open the serial port ( if possible ) using the parameters set by SetPort()
|
||||
DWORD Open();
|
||||
// Setup the serial port prior to opening it
|
||||
int SetPort( int Port, int Baud = 0, char Parity = 0, int Bits = 0,
|
||||
int StopBits = 0, int HandShake = 0 );
|
||||
// Set up the port timeouts
|
||||
void SetTimeouts( int RXTimeout = CS_DEFAULT_RX_TIMEOUT,
|
||||
int TXTimeout = CS_DEFAULT_TX_TIMEOUT );
|
||||
// Get the serial port settings
|
||||
void GetPortData( int *Port, int *Baud, char *Parity, int *Bits,
|
||||
int *StopBits, int *HandShake );
|
||||
// Test if the serial port is open
|
||||
bool IsValid() {
|
||||
return IsOpen()!=0;
|
||||
}
|
||||
int IsOpen( void );
|
||||
// Close the serial port
|
||||
DWORD Close( void );
|
||||
// Flush all data in any serial port buffers
|
||||
int FlushPort( void );
|
||||
// Attempt to read the specified number of bytes
|
||||
DWORD ReadPort( char *Buffer, DWORD Bytes );
|
||||
DWORD ReadPort( CString &Buffer, DWORD Bytes );
|
||||
// Attempt to write the specified number of bytes
|
||||
DWORD WritePort( const char *Buffer, DWORD Bytes );
|
||||
DWORD SendWriteFile(const char *Buffer, DWORD Bytes);
|
||||
// Send the specifed number of bytes out when possible
|
||||
int Transmit( const char *Buffer, DWORD Bytes );
|
||||
// Add a block of data to the internal list of receieved blocks
|
||||
int AddReceived( const char *Buffer, DWORD Bytes );
|
||||
// Get the next block of data added with AddReceived()
|
||||
// char *GetNextReceived( void );
|
||||
// Find the maximum port number available
|
||||
int MaxPort( void );
|
||||
// Add text to the debug output
|
||||
void AddToDebug( const char *Ptr, DWORD BytesToCopy, int State );
|
||||
// Attach this serial port to a debug window
|
||||
//CSerialRaw *AttachWnd( CWnd *Wnd );
|
||||
// Convert ascii hex into an int
|
||||
int HexToInt( char *Data, int Bytes );
|
||||
|
||||
virtual DWORD Send(LPCSTR buffer, int l, BOOL needsResponse=FALSE);
|
||||
//virtual DWORD Send(CString what);
|
||||
|
||||
// Called when data is received on the serial port
|
||||
virtual void OnReceive( void );
|
||||
// Called when data has been sent using the Transmit() function
|
||||
virtual void OnTransmit( int Item, DWORD Error );
|
||||
|
||||
private:
|
||||
// Private so no comment :-)
|
||||
void RegisterDebugWindow(void);
|
||||
void SendBuffer(int Next);
|
||||
void ReceiveTask(void);
|
||||
int ProgramPort(int Port,int Baud,char Parity,int Bits,int StopBits,int HandShake);
|
||||
|
||||
// Attributes
|
||||
protected:
|
||||
int m_RXTimeout;
|
||||
int m_TXTimeout;
|
||||
|
||||
// Attributes
|
||||
private:
|
||||
char m_Parity;
|
||||
// char m_DebugData[CS_DEBUG_SIZE];
|
||||
// char m_DebugState[CS_DEBUG_SIZE];
|
||||
// char *m_RXTempPtr;
|
||||
int m_Port;
|
||||
int m_Baud;
|
||||
int m_Bits;
|
||||
int m_StopBits;
|
||||
int m_HandShake;
|
||||
int m_MaxTXRetries;
|
||||
int m_DebugInPtr;
|
||||
int m_DebugCount;
|
||||
int m_Item;
|
||||
// struct SerialList *m_TXHead;
|
||||
// struct SerialList *m_TXTail;
|
||||
// struct SerialList *m_RXHead;
|
||||
// struct SerialList *m_RXTail;
|
||||
OVERLAPPED m_ReceiveOLap;
|
||||
OVERLAPPED m_TransmitOLap;
|
||||
OVERLAPPED m_ReadOLap;
|
||||
OVERLAPPED m_WriteOLap;
|
||||
HANDLE m_PortHandle;
|
||||
HANDLE m_ThreadHandle;
|
||||
HANDLE m_ReceiveTaskEvent;
|
||||
|
||||
private:
|
||||
friend unsigned int WINAPI CSerialTask(LPVOID CSerialPtr);
|
||||
|
||||
//Buffer for incomming commands:
|
||||
int CurrentPointer;
|
||||
BOOL m_IsWrtingData;
|
||||
public:
|
||||
HANDLE m_hWaitCMMResponse;
|
||||
HANDLE m_hNewRx;
|
||||
|
||||
// BV Nov 2001: Made public
|
||||
// CRITICAL_SECTION m_QueueLock;
|
||||
BOOL m_iRecvState;
|
||||
INT m_iRecvBytes;
|
||||
INT m_iRecvCount;
|
||||
unsigned char m_RecvData[MAX_RECIEVE_BUFFER_SIZE];
|
||||
};
|
||||
|
||||
#endif // CMMIO_SERIAL_H
|
||||
+287
@@ -0,0 +1,287 @@
|
||||
#include "stdafx.h"
|
||||
#include "So7_Illumination.h"
|
||||
#include "ReadWriteIni.h"
|
||||
#include "GetDigitalLuxMeterValue.h"
|
||||
|
||||
|
||||
enum eThreadSignal
|
||||
{
|
||||
THREAD_STATE_RUNNING, // Current state of the thread
|
||||
THREAD_STATE_EXIT // Signal to thread to exit
|
||||
};
|
||||
unsigned __stdcall ReadLightData(LPVOID pThis);
|
||||
eThreadSignal _serial_WatchThreadState;
|
||||
const char DigitalLuxMeter_StopDatas[9] = { 0X3C,0X02,0X00,0X00,0X00,0X00,0X00,0XDE,0X00 };
|
||||
const char DigitalLuxMeter_StartDatas[9] = { 0X1E,0X00,0X00,0X00,0X00,0X00,0X00,0X1E,0X00 };
|
||||
const char DigitalLuxMeter_BeginDatas[9] = { 0X3C,0X01,0X00,0X00,0X00,0X00,0X00,0X3D,0X00 };
|
||||
HANDLE _smc_WatchThreadHandle;
|
||||
CGetDigitalLuxMeterValue::CGetDigitalLuxMeterValue()
|
||||
{
|
||||
m_iSerialComPort = 1;
|
||||
m_iBuadRate = 19200;
|
||||
m_iSleepTime = 50;
|
||||
m_dCabStep = 0.1;
|
||||
m_iCompareGap = 25;
|
||||
m_iSelectLightType = 0;
|
||||
m_iRoadBoardNum = 1;
|
||||
m_iGetWhichRingForInitValue = 2;
|
||||
m_iRingGapSleepTime = 20;
|
||||
m_bIsEnableToGetLuxValue = true;
|
||||
m_bGetSingleRingInitValue = true;
|
||||
m_bPopUpPromptDialog = false;
|
||||
}
|
||||
|
||||
|
||||
CGetDigitalLuxMeterValue::~CGetDigitalLuxMeterValue()
|
||||
{
|
||||
_serial_WatchThreadState = THREAD_STATE_EXIT;
|
||||
}
|
||||
|
||||
void CGetDigitalLuxMeterValue::LoadConfig()
|
||||
{
|
||||
CString filePath;
|
||||
CSo7_Illumination oSo7Illum;
|
||||
oSo7Illum.GetAppPath(filePath);
|
||||
CString strFileName = filePath + _T("\\Device.Config.ini");
|
||||
CString strKeyName = _T("DIGITAL_LUX_METER_RS232_SERIALCOMPORT");
|
||||
CString strRS232Enable = _T("DigitalLuxMeterRS232Enable");
|
||||
CString strRS232ComNum = _T("DigitalLuxMeterRS232ComNum");
|
||||
//CString strRS232BuadRate = _T("DigitalLuxMeterRS232BuadRate");
|
||||
CString strRS232SleepTime = _T("DigitalLuxMeterRS232SleepTime");
|
||||
CString strRS232CabStep = _T("DigitalLuxMeterCabStep");
|
||||
CString strRS232LightType= _T("LightType");
|
||||
CString strRS232RoadBoardNum = _T("RoadBoardNum");
|
||||
CString strRS232CabCompGap = _T("DigitalLuxMeterCabCompGap");
|
||||
CString strRS232CabGetSingRingInitValue = _T("DigitalLuxMeterGetSingRingInitValue");
|
||||
CString strRS232CabGetWhichRingForInitValue = _T("DigitalLuxMeterGetWhichRingForInitValue");
|
||||
CString strPopUpPromptDialog = _T("PopUpPromptDialog");
|
||||
CString strRingGapSleepTime = _T("RingGapSleepTime");
|
||||
ReadWriteIni rIni(strFileName);
|
||||
rIni.setSection(strKeyName);
|
||||
m_bIsEnableToGetLuxValue = rIni.getBool(strRS232Enable, false, true);
|
||||
m_bPopUpPromptDialog = rIni.getBool(strPopUpPromptDialog, false, true);
|
||||
m_iSerialComPort = rIni.getInt(strRS232ComNum, 1, true);
|
||||
m_iBuadRate = 19200;
|
||||
//m_iBuadRate = rIni.getInt(strRS232BuadRate, 19200);
|
||||
m_iSleepTime = rIni.getInt(strRS232SleepTime, 100, true);
|
||||
m_dCabStep = rIni.getDouble(strRS232CabStep, 0.1, true);
|
||||
m_iCompareGap = rIni.getInt(strRS232CabCompGap, 25, true);
|
||||
m_iRoadBoardNum = rIni.getInt(strRS232RoadBoardNum, 1, true);
|
||||
m_iSelectLightType = rIni.getInt(strRS232LightType, 0, true);
|
||||
m_bGetSingleRingInitValue = rIni.getBool(strRS232CabGetSingRingInitValue, true, true);
|
||||
m_iGetWhichRingForInitValue = rIni.getInt(strRS232CabGetWhichRingForInitValue, 2, true);
|
||||
m_iRingGapSleepTime = rIni.getInt(strRingGapSleepTime, 20, true);
|
||||
if ((m_iGetWhichRingForInitValue > 5) || (m_iGetWhichRingForInitValue < 0))
|
||||
{
|
||||
m_iGetWhichRingForInitValue = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void CGetDigitalLuxMeterValue::SaveIni()
|
||||
{
|
||||
CString filePath;
|
||||
CSo7_Illumination oSo7Illum;
|
||||
oSo7Illum.GetAppPath(filePath);
|
||||
CString strFileName = filePath + _T("\\Device.Config.ini");
|
||||
CString strKeyName = _T("DIGITAL_LUX_METER_RS232_SERIALCOMPORT");
|
||||
CString strRS232Enable = _T("DigitalLuxMeterRS232Enable");
|
||||
CString strRS232ComNum = _T("DigitalLuxMeterRS232ComNum");
|
||||
//CString strRS232BuadRate = _T("DigitalLuxMeterRS232BuadRate");
|
||||
CString strRS232SleepTime = _T("DigitalLuxMeterRS232SleepTime");
|
||||
CString strRS232CabStep = _T("DigitalLuxMeterCabStep");
|
||||
CString strRS232LightType = _T("LightType");
|
||||
CString strRS232RoadBoardNum = _T("RoadBoardNum");
|
||||
CString strRS232CabCompGap = _T("DigitalLuxMeterCabCompGap");
|
||||
CString strRS232CabGetSingRingInitValue = _T("DigitalLuxMeterGetSingRingInitValue");
|
||||
CString strRS232CabGetWhichRingForInitValue = _T("DigitalLuxMeterGetWhichRingForInitValue");
|
||||
ReadWriteIni wIni(strFileName);
|
||||
wIni.setSection(strKeyName);
|
||||
wIni.setBool(strRS232Enable, m_bIsEnableToGetLuxValue);
|
||||
wIni.setInt(strRS232ComNum, m_iSerialComPort);
|
||||
wIni.setInt(strRS232SleepTime, m_iSleepTime);
|
||||
wIni.setDouble(strRS232CabStep, m_dCabStep);
|
||||
wIni.setInt(strRS232RoadBoardNum, m_iRoadBoardNum);
|
||||
wIni.setInt(strRS232LightType, m_iSelectLightType);
|
||||
wIni.setInt(strRS232CabCompGap, m_iCompareGap);
|
||||
wIni.setBool(strRS232CabGetSingRingInitValue, m_bGetSingleRingInitValue);
|
||||
wIni.setInt(strRS232CabGetWhichRingForInitValue, m_iGetWhichRingForInitValue);
|
||||
//wIni.setInt(strRS232BuadRate, m_iBuadRate);
|
||||
}
|
||||
|
||||
unsigned __stdcall ReadLightData(LPVOID pThis)
|
||||
{
|
||||
CGetDigitalLuxMeterValue* _pThis = (CGetDigitalLuxMeterValue*)pThis;
|
||||
while (_serial_WatchThreadState == THREAD_STATE_RUNNING)
|
||||
{
|
||||
_pThis->OnGetRealTimeDigitalLuxMeterValueResult();
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
BOOL CGetDigitalLuxMeterValue::OnInit()
|
||||
{
|
||||
BOOL bInitState = FALSE;
|
||||
LoadConfig();
|
||||
|
||||
if (m_bIsEnableToGetLuxValue)
|
||||
{
|
||||
m_SO7_Serial.SetPort(m_iSerialComPort, m_iBuadRate);
|
||||
if (m_SO7_Serial.Open())
|
||||
{
|
||||
bInitState = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bInitState = FALSE;
|
||||
}
|
||||
|
||||
if (bInitState == FALSE)
|
||||
{
|
||||
CString str = (L"Serial port open failed!");
|
||||
str.AppendFormat((L"Port Number:"));
|
||||
str.AppendFormat(_T("%d "), m_iSerialComPort);
|
||||
MessageBoxEx(NULL, str, (L"Serial port"), MB_OK | MB_SYSTEMMODAL, MB_SYSTEMMODAL);
|
||||
}
|
||||
BOOL bReady = OnStartDigitalLuxMeter();
|
||||
if (bReady)
|
||||
{
|
||||
_serial_WatchThreadState = THREAD_STATE_RUNNING;
|
||||
_smc_WatchThreadHandle = CreateThread((LPSECURITY_ATTRIBUTES)NULL,
|
||||
0, (LPTHREAD_START_ROUTINE)ReadLightData,
|
||||
this, 0, NULL);
|
||||
}
|
||||
}
|
||||
return bInitState;
|
||||
}
|
||||
|
||||
BOOL CGetDigitalLuxMeterValue::OnUninit()
|
||||
{
|
||||
if (m_bIsEnableToGetLuxValue)
|
||||
{
|
||||
m_SO7_Serial.Close();
|
||||
_serial_WatchThreadState = THREAD_STATE_EXIT;
|
||||
ExitThread(0);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CGetDigitalLuxMeterValue::OnStartDigitalLuxMeter()
|
||||
{
|
||||
BOOL bState = FALSE;
|
||||
|
||||
DWORD iWriteByte = m_SO7_Serial.Send(DigitalLuxMeter_StopDatas, 9);
|
||||
INT iRetrys(0);
|
||||
Sleep(50);
|
||||
|
||||
iWriteByte = m_SO7_Serial.Send(DigitalLuxMeter_StartDatas, 9);
|
||||
iRetrys = 0;
|
||||
while (!m_SO7_Serial.m_iRecvState && iRetrys < 18 && iWriteByte == 9)
|
||||
{
|
||||
iRetrys++;
|
||||
Sleep(50);
|
||||
}
|
||||
if (m_SO7_Serial.m_iRecvState)
|
||||
{
|
||||
m_SO7_Serial.m_iRecvState = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bState = FALSE;
|
||||
MessageBox(nullptr, L"Start digital lux meter error", L"Error", MB_ICONERROR);
|
||||
}
|
||||
|
||||
iWriteByte = m_SO7_Serial.Send(DigitalLuxMeter_BeginDatas, 9);
|
||||
iRetrys = 0;
|
||||
while (!m_SO7_Serial.m_iRecvState && iRetrys < 18 && iWriteByte == 9)
|
||||
{
|
||||
iRetrys++;
|
||||
Sleep(50);
|
||||
}
|
||||
if (m_SO7_Serial.m_iRecvState)
|
||||
{
|
||||
m_SO7_Serial.m_iRecvState = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bState = FALSE;
|
||||
MessageBox(nullptr, L"Start digital lux meter error", L"Error", MB_ICONERROR);
|
||||
}
|
||||
bState = TRUE;
|
||||
return bState;
|
||||
}
|
||||
|
||||
BOOL CGetDigitalLuxMeterValue::OnStopToGetRealTimeDigitalLuxMeterValue()
|
||||
{
|
||||
BOOL bState = FALSE;
|
||||
DWORD iWriteByte = m_SO7_Serial.Send(DigitalLuxMeter_StopDatas, 9);
|
||||
INT iRetrys(0);
|
||||
while (!m_SO7_Serial.m_iRecvState && iRetrys < 18 && iWriteByte == 9)
|
||||
{
|
||||
iRetrys++;
|
||||
Sleep(50);
|
||||
}
|
||||
if (m_SO7_Serial.m_iRecvState)
|
||||
{
|
||||
m_SO7_Serial.m_iRecvState = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bState = FALSE;
|
||||
MessageBox(nullptr, L"Stop digital lux meter error", L"Error", MB_ICONERROR);
|
||||
}
|
||||
bState = TRUE;
|
||||
return bState;
|
||||
}
|
||||
|
||||
void CGetDigitalLuxMeterValue::OnGetRealTimeDigitalLuxMeterValueResult()
|
||||
{
|
||||
INT iRetrys(0);
|
||||
if (m_SO7_Serial.m_iRecvState)
|
||||
{
|
||||
if (m_SO7_Serial.m_iRecvBytes == 8)
|
||||
{
|
||||
int num3 = 0.0;
|
||||
double num4 = 0.0;
|
||||
int num5 = 0;
|
||||
int num6 = 0.0;
|
||||
num3 = m_SO7_Serial.m_RecvData[2] >> 6;
|
||||
switch (num3)
|
||||
{
|
||||
case 0:
|
||||
num4 = 1.0;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
num4 = 10.0;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
num4 = 100.0;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
num4 = 1000.0;
|
||||
break;
|
||||
}
|
||||
num5 = m_SO7_Serial.m_RecvData[2] & 0x3f;
|
||||
num6 = m_SO7_Serial.m_RecvData[3];
|
||||
double value1 = ((num5 * 0x100) + num6) * 0.1;
|
||||
m_dLuxVal = value1 * num4;
|
||||
m_dTempVal = (m_SO7_Serial.m_RecvData[5] * 0x100) + m_SO7_Serial.m_RecvData[6];
|
||||
if (m_SO7_Serial.m_RecvData[4] == 0)
|
||||
{
|
||||
m_dTempVal *= -0.1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dTempVal *= 0.1;
|
||||
}
|
||||
}
|
||||
|
||||
m_SO7_Serial.m_iRecvState = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Sleep(50);
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include "CMMIO_SERIAL.H"
|
||||
|
||||
class CGetDigitalLuxMeterValue
|
||||
{
|
||||
public:
|
||||
CGetDigitalLuxMeterValue();
|
||||
~CGetDigitalLuxMeterValue();
|
||||
BOOL OnInit();
|
||||
BOOL OnUninit();
|
||||
BOOL OnStartDigitalLuxMeter();
|
||||
BOOL OnStopToGetRealTimeDigitalLuxMeterValue();
|
||||
void OnGetRealTimeDigitalLuxMeterValueResult();
|
||||
void SaveIni();
|
||||
public:
|
||||
int m_iSerialComPort;
|
||||
int m_iBuadRate;
|
||||
int m_iSleepTime;
|
||||
int m_iCompareGap;
|
||||
int m_iRoadBoardNum;
|
||||
int m_iSelectLightType;
|
||||
int m_iRingGapSleepTime;
|
||||
bool m_bGetSingleRingInitValue;
|
||||
int m_iGetWhichRingForInitValue;
|
||||
double m_dCabStep;
|
||||
bool m_bIsEnableToGetLuxValue;
|
||||
bool m_bPopUpPromptDialog;
|
||||
double m_dLuxVal;
|
||||
double m_dTempVal;
|
||||
protected:
|
||||
void LoadConfig();
|
||||
CPSerial m_SO7_Serial;
|
||||
};
|
||||
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ReadWriteIni.h"
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4786)
|
||||
#pragma warning(disable: 4996)
|
||||
#pragma warning(disable: 4800)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ReadWriteIni::ReadWriteIni()
|
||||
{
|
||||
m_nDefDoubleBitNum = 6;
|
||||
setSection(_T("Defalut"));
|
||||
}
|
||||
|
||||
ReadWriteIni::ReadWriteIni(const wchar_t* szFilePath)
|
||||
{
|
||||
m_nDefDoubleBitNum = 6;
|
||||
LoadFile(szFilePath);
|
||||
setSection(_T("Defalut"));
|
||||
}
|
||||
|
||||
ReadWriteIni::ReadWriteIni(const wchar_t* szFilePath, const wchar_t* szSection)
|
||||
{
|
||||
m_nDefDoubleBitNum = 6;
|
||||
LoadFile(szFilePath);
|
||||
setSection(szSection);
|
||||
}
|
||||
|
||||
bool ReadWriteIni::LoadFile(const wchar_t* szFilePath)
|
||||
{
|
||||
::GetFullPathNameW(szFilePath, MAX_PATH, m_szFilePath, NULL);
|
||||
setSection(_T("Defalut"));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadWriteIni::SaveFile()
|
||||
{
|
||||
setSection(L"XXX{B1CAE400-AF03-40E4-A1CE-30F2134309DE}XXX");
|
||||
delSection(L"XXX{B1CAE400-AF03-40E4-A1CE-30F2134309DE}XXX");
|
||||
setSection(m_szSection);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReadWriteIni::setSection(const wchar_t* szSection)
|
||||
{
|
||||
wcscpy_s(m_szSection, szSection);
|
||||
return;
|
||||
}
|
||||
|
||||
bool ReadWriteIni::delSection(const wchar_t* szSection)
|
||||
{
|
||||
return ::WritePrivateProfileStringW(szSection, NULL, NULL, m_szFilePath);
|
||||
}
|
||||
|
||||
bool ReadWriteIni::delKeyName(const wchar_t* szKeyName)
|
||||
{
|
||||
return ::WritePrivateProfileStringW(m_szSection, szKeyName, NULL, m_szFilePath);
|
||||
}
|
||||
|
||||
bool ReadWriteIni::setInt(const wchar_t* szKey, int nVal)
|
||||
{
|
||||
swprintf_s(m_szValTemp, L"%d", nVal);
|
||||
return ::WritePrivateProfileStringW(m_szSection, szKey, m_szValTemp, m_szFilePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ReadWriteIni::getInt(const wchar_t* szKey, int nDefVal /*= 0*/, bool bAddIfUnexist /*= false*/)
|
||||
{
|
||||
int UnExistNumber = LIMIT_MAX_32INT;
|
||||
int nVal = ::GetPrivateProfileIntW(m_szSection, szKey, UnExistNumber, m_szFilePath);
|
||||
if (nVal == UnExistNumber)
|
||||
{
|
||||
if (bAddIfUnexist)
|
||||
setInt(szKey, nDefVal);
|
||||
return nDefVal;
|
||||
}
|
||||
return nVal;
|
||||
}
|
||||
|
||||
|
||||
bool ReadWriteIni::setBool(const wchar_t* szKey, bool bVal)
|
||||
{
|
||||
return setInt(szKey, (int)bVal);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ReadWriteIni::getBool(const wchar_t* szKey, bool bDefVal /*= false*/, bool bAddIfUnexist /*= false*/)
|
||||
{
|
||||
return (bool)getInt(szKey, bDefVal, bAddIfUnexist);
|
||||
}
|
||||
|
||||
bool ReadWriteIni::setString(const wchar_t* szKey, const wchar_t* szVal)
|
||||
{
|
||||
return ::WritePrivateProfileStringW(m_szSection, szKey, szVal, m_szFilePath);
|
||||
}
|
||||
|
||||
const wchar_t* ReadWriteIni::getString(const wchar_t* szKey, const wchar_t* szDefVal /*= NULL*/, bool bAddIfUnexist /*= false*/)
|
||||
{
|
||||
::GetPrivateProfileStringW(m_szSection, szKey, szDefVal, m_szValTemp, sizeof(m_szValTemp), m_szFilePath);
|
||||
if (bAddIfUnexist && (m_szValTemp[0] == 0) && (szDefVal != nullptr))
|
||||
{
|
||||
wcscpy_s(m_szValTemp, szDefVal);
|
||||
setString(szKey, szDefVal);
|
||||
}
|
||||
return m_szValTemp;
|
||||
}
|
||||
|
||||
bool ReadWriteIni::setDouble(const wchar_t* szKey, double dVal)
|
||||
{
|
||||
switch (m_nDefDoubleBitNum)
|
||||
{
|
||||
case 1: {swprintf_s(m_szValTemp, L"%.1f", dVal);break;}
|
||||
case 2: {swprintf_s(m_szValTemp, L"%.2f", dVal);break;}
|
||||
case 3: {swprintf_s(m_szValTemp, L"%.3f", dVal);break;}
|
||||
case 4: {swprintf_s(m_szValTemp, L"%.4f", dVal);break;}
|
||||
case 5: {swprintf_s(m_szValTemp, L"%.5f", dVal);break;}
|
||||
case 6: {swprintf_s(m_szValTemp, L"%.6f", dVal);break;}
|
||||
case 7: {swprintf_s(m_szValTemp, L"%.7f", dVal);break;}
|
||||
case 8: {swprintf_s(m_szValTemp, L"%.8f", dVal);break;}
|
||||
case 9: {swprintf_s(m_szValTemp, L"%.9f", dVal);break;}
|
||||
default: {swprintf_s(m_szValTemp, L"%.6f", dVal);break;}
|
||||
}
|
||||
return setString(szKey, m_szValTemp);
|
||||
}
|
||||
|
||||
double ReadWriteIni::getDouble(const wchar_t* szKey, double dDefVal/*=0*/, bool bAddIfUnexist /*= false*/)
|
||||
{
|
||||
const wchar_t* m_pVal = getString(szKey, 0, false);
|
||||
if (m_pVal[0] != 0)
|
||||
{
|
||||
double dVal = _wtof(m_pVal);
|
||||
return dVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bAddIfUnexist)
|
||||
{
|
||||
setDouble(szKey, dDefVal);
|
||||
}
|
||||
return dDefVal;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#define MAX_PATH 260
|
||||
#define LIMIT_MAX_32INT 2147483647
|
||||
class ReadWriteIni
|
||||
{
|
||||
public:
|
||||
ReadWriteIni();
|
||||
ReadWriteIni(const wchar_t* szFilePath);
|
||||
ReadWriteIni(const wchar_t* szFilePath, const wchar_t* szSection);
|
||||
~ReadWriteIni() {}
|
||||
public:
|
||||
bool LoadFile(const wchar_t* szFilePath);
|
||||
bool SaveFile();
|
||||
const wchar_t* GetFile() { return m_szFilePath; }
|
||||
public:
|
||||
void setSection(const wchar_t* szSection);
|
||||
bool delSection(const wchar_t* szSection);
|
||||
bool delKeyName(const wchar_t* szKeyName);
|
||||
public:
|
||||
bool setInt(const wchar_t* szKey, int nVal);
|
||||
int getInt(const wchar_t* szKey, int nDefVal = 0, bool bAddIfUnexist = false);
|
||||
|
||||
bool setBool(const wchar_t* szKey, bool bVal);
|
||||
bool getBool(const wchar_t* szKey, bool bDefVal = false, bool bAddIfUnexist = false);
|
||||
|
||||
bool setString(const wchar_t* szKey, const wchar_t* szVal);
|
||||
const wchar_t* getString(const wchar_t* szKey, const wchar_t* szDefVal = NULL, bool bAddIfUnexist = false);
|
||||
public:
|
||||
bool setDouble(const wchar_t* szKey, double dVal);
|
||||
double getDouble(const wchar_t* szKey, double dDefVal = 0, bool bAddIfUnexist = false);
|
||||
void setDefDoubleBitNum(int num) { m_nDefDoubleBitNum = num; }
|
||||
private:
|
||||
static const int MAX_BUFF_STRING = 1024;
|
||||
wchar_t m_szFilePath[MAX_PATH];
|
||||
wchar_t m_szSection[MAX_BUFF_STRING];
|
||||
wchar_t m_szValTemp[MAX_BUFF_STRING];
|
||||
int m_nDefDoubleBitNum;
|
||||
};
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+2
@@ -0,0 +1,2 @@
|
||||
#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1
|
||||
Release|Win32|D:\why\Git_Metus_Tree\HG_EF7_HSI_EF1\PcDmis\Base\Interfac\Msi\Hsi\SevenOcean\UtilityForSo7Light\|
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+1154
File diff suppressed because it is too large
Load Diff
+104
@@ -0,0 +1,104 @@
|
||||
#ifndef SO7_ILLUMINATION_H_
|
||||
#define SO7_ILLUMINATION_H_
|
||||
|
||||
#include "CMMIO_SERIAL.H"
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Illumination API
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
const int SO7_ILLUMINATION_MAX_LAMPS = 6;
|
||||
const int SO7_ILLUMINATION_MAX_BULB_COLORS = 3;
|
||||
const int SO7_ILLUMINATION_MAX_RINGS = 12;
|
||||
const int SO7_ILLUMINATION_MAX_SECTORS = 16;
|
||||
const int SO7_ILLUMINATION_MAX_BULBS = SO7_ILLUMINATION_MAX_RINGS*SO7_ILLUMINATION_MAX_SECTORS;
|
||||
|
||||
|
||||
enum SO7_ILLUMINATION_INFO
|
||||
{
|
||||
SO7_ILLUMINATION_INFO_UNKNOWN = 0,
|
||||
SO7_ILLUMINATION_INFO_SO7 = 0x01,
|
||||
SO7_ILLUMINATION_INFO_SO7_II = 0x02,//lvgang
|
||||
SO7_ILLUMINATION_INFO_SO7_III = 0x04,//shixuyong
|
||||
SO7_ILLUMINATION_INFO_TOTAL
|
||||
};
|
||||
enum SO7_ILLUMINATION_BULB_TYPE
|
||||
{
|
||||
SO7_ILLUMINATION_BULB_ROUND = 1,
|
||||
SO7_ILLUMINATION_BULB_SQUARE = 2,
|
||||
SO7_ILLUMINATION_BULB_RING = 3,
|
||||
SO7_ILLUMINATION_BULB_GRID = 4
|
||||
};
|
||||
enum SO7_ILLUMINATION_LAMP_TYPE
|
||||
{
|
||||
SO7_ILLUMINATION_LAMP_NONE = 0,
|
||||
SO7_ILLUMINATION_LAMP_COAXIAL = 1,
|
||||
SO7_ILLUMINATION_LAMP_SURFACE = 2,
|
||||
SO7_ILLUMINATION_LAMP_PROFILE = 3,
|
||||
SO7_ILLUMINATION_LAMP_PROFILE_OUTER = 4
|
||||
};
|
||||
|
||||
enum SO7_ILLUMINATION_SURFACE_LAMP_CONTROL_TYPE
|
||||
{
|
||||
SO7_ILLUMINATION_LAMP_CONTROL_NONE = 0,
|
||||
SO7_ILLUMINATION_LAMP_CONTROL_BY_WHOLE_LAMP,
|
||||
SO7_ILLUMINATION_LAMP_CONTROL_BY_RINGS,
|
||||
SO7_ILLUMINATION_LAMP_CONTROL_BY_OCTANTS,
|
||||
SO7_ILLUMINATION_LAMP_CONTROL_BY_SEGMENTS,
|
||||
SO7_ILLUMINATION_LAMP_CONTROL_BY_OTHER
|
||||
|
||||
};
|
||||
|
||||
class CSo7_Illumination
|
||||
{
|
||||
public:
|
||||
CSo7_Illumination(void);
|
||||
~CSo7_Illumination(void);
|
||||
bool m_bIllumiationEnable;
|
||||
BOOL Init();
|
||||
BOOL UnInit(bool _bInitConfig=true);
|
||||
BOOL SetLampState(int _NumLamps,int* _LampsType,int (*bBulbStates)[SO7_ILLUMINATION_MAX_BULBS],double (*Intensities)[SO7_ILLUMINATION_MAX_BULBS],bool bWait);
|
||||
BOOL Shutdown();
|
||||
void GetAppPath(CString &Path);
|
||||
short m_CalibrateData[6][101];
|
||||
short m_GetInfoOfRoad[10];
|
||||
private:
|
||||
void LoadConfig();
|
||||
|
||||
int m_iControlType;
|
||||
int m_iSerialComPort;
|
||||
int m_iBuadRate;
|
||||
int m_iCommMode;//0-rs232,1-usb
|
||||
int m_iSleepTime;
|
||||
int m_iMinRings;
|
||||
int m_iMaxRings;
|
||||
int m_iMinSectors;
|
||||
int m_iMaxSectors;
|
||||
|
||||
CPSerial m_SO7_Serial;
|
||||
BOOL SetLampState_So7II(int _NumLamps,int* _LampsType,int (*bBulbStates)[SO7_ILLUMINATION_MAX_BULBS],double (*Intensities)[SO7_ILLUMINATION_MAX_BULBS],bool bWait);
|
||||
BOOL SetLampState_So7III(int _NumLamps,int* _LampsType,int (*bBulbStates)[SO7_ILLUMINATION_MAX_BULBS],double (*Intensities)[SO7_ILLUMINATION_MAX_BULBS],bool bWait);
|
||||
BOOL So7LightII_set_light_off();
|
||||
BOOL So7LightIII_set_light_off();
|
||||
BOOL _Send_Command(const char* _SendData,DWORD _SendDataLength);
|
||||
BOOL _Receive_Data(char* _SendData,DWORD& _SendDataLength);
|
||||
char m_RecvData[MAX_RECIEVE_BUFFER_SIZE];
|
||||
DWORD m_RecvDataSize;
|
||||
BOOL m_bReading;
|
||||
BOOL m_bWriting;
|
||||
public:
|
||||
//********* send 20 byte data
|
||||
//1--------2----3-----4---5-----6---7-----8---9----10--11----12--13-------14--15--16--17--18--19--------20--//
|
||||
//[aa] [13][88] [13][88] [13][88] [13][88] [13][88] [13][88] [01][01][01][01][01][01] [bb]
|
||||
//<begin> <brightness from 0x0001 to 0x1388> <switch on=1 off=1> <end>
|
||||
// <inner ring>----------------------------------<outer ring> <outer ring section>-----<inner ring section>
|
||||
BOOL _Send_So7LightIII_Command(const double _SendData[48],const int minIllumination,const int maxLillumination,const bool bWait,BYTE* _DATA);
|
||||
BOOL ReadCalibration(const int& iLightType = 0, const int& iRoadNum = 0, const int& iPortNum = 0);
|
||||
BOOL WriteCalibration(const short wdata[6][101], const int& iLightType = 0, const int& iRoadNum = 0, const int& iPortNum = 0);
|
||||
BOOL ReadRoadLightValue(BYTE* _reData, const int& iLightType = 1, const int& iRoadNum = 1, const int& iPortNum = 1);
|
||||
BOOL WriteRoadLightValue(BYTE* _reData, const bool& bWait, const int& iLightType = 1, const int& iRoadNum = 1, const int& iPortNum = 1, const double _SendData[48] = { 0 });
|
||||
BOOL ResetForRoadLight(const int& iLightType = 1, const int& iRoadNum = 1, const int& iPortNum = 1);
|
||||
BOOL ReflushConnection();
|
||||
void SetBuadRate(const int& valueBuad);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
|
||||
// UtilityForSo7Light.cpp : Defines the class behaviors for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "UtilityForSo7Light.h"
|
||||
#include "UtilityForSo7LightDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
|
||||
// CUtilityForSo7LightApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CUtilityForSo7LightApp, CWinApp)
|
||||
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CUtilityForSo7LightApp construction
|
||||
|
||||
CUtilityForSo7LightApp::CUtilityForSo7LightApp()
|
||||
{
|
||||
// TODO: add construction code here,
|
||||
// Place all significant initialization in InitInstance
|
||||
}
|
||||
|
||||
|
||||
// The one and only CUtilityForSo7LightApp object
|
||||
|
||||
CUtilityForSo7LightApp theApp;
|
||||
|
||||
|
||||
// CUtilityForSo7LightApp initialization
|
||||
|
||||
BOOL CUtilityForSo7LightApp::InitInstance()
|
||||
{
|
||||
CWinApp::InitInstance();
|
||||
|
||||
|
||||
// Create the shell manager, in case the dialog contains
|
||||
// any shell tree view or shell list view controls.
|
||||
CShellManager *pShellManager = new CShellManager;
|
||||
|
||||
// Activate "Windows Native" visual manager for enabling themes in MFC controls
|
||||
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
|
||||
|
||||
// Standard initialization
|
||||
// If you are not using these features and wish to reduce the size
|
||||
// of your final executable, you should remove from the following
|
||||
// the specific initialization routines you do not need
|
||||
// Change the registry key under which our settings are stored
|
||||
// TODO: You should modify this string to be something appropriate
|
||||
// such as the name of your company or organization
|
||||
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
|
||||
|
||||
CUtilityForSo7LightDlg dlg;
|
||||
m_pMainWnd = &dlg;
|
||||
INT_PTR nResponse = dlg.DoModal();
|
||||
if (nResponse == IDOK)
|
||||
{
|
||||
// TODO: Place code here to handle when the dialog is
|
||||
// dismissed with OK
|
||||
}
|
||||
else if (nResponse == IDCANCEL)
|
||||
{
|
||||
// TODO: Place code here to handle when the dialog is
|
||||
// dismissed with Cancel
|
||||
}
|
||||
else if (nResponse == -1)
|
||||
{
|
||||
TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n");
|
||||
TRACE(traceAppMsg, 0, "Warning: if you are using MFC controls on the dialog, you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n");
|
||||
}
|
||||
|
||||
// Delete the shell manager created above.
|
||||
if (pShellManager != NULL)
|
||||
{
|
||||
delete pShellManager;
|
||||
}
|
||||
|
||||
// Since the dialog has been closed, return FALSE so that we exit the
|
||||
// application, rather than start the application's message pump.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
|
||||
// UtilityForSo7Light.h : main header file for the PROJECT_NAME application
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error "include 'stdafx.h' before including this file for PCH"
|
||||
#endif
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
|
||||
// CUtilityForSo7LightApp:
|
||||
// See UtilityForSo7Light.cpp for the implementation of this class
|
||||
//
|
||||
|
||||
class CUtilityForSo7LightApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
CUtilityForSo7LightApp();
|
||||
|
||||
// Overrides
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
|
||||
// Implementation
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern CUtilityForSo7LightApp theApp;
|
||||
BIN
Binary file not shown.
+149
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{BFC37D2E-B136-44A0-9FC6-64A410E6C13A}</ProjectGuid>
|
||||
<RootNamespace>UtilityForSo7Light</RootNamespace>
|
||||
<Keyword>MFCProj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="CMMIO_BASE.H" />
|
||||
<ClInclude Include="CMMIO_SERIAL.H" />
|
||||
<ClInclude Include="GetDigitalLuxMeterValue.h" />
|
||||
<ClInclude Include="ReadWriteIni.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="So7_Illumination.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="UtilityForSo7Light.h" />
|
||||
<ClInclude Include="UtilityForSo7LightDlg.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CMMIO_BASE.CPP" />
|
||||
<ClCompile Include="CMMIO_SERIAL.CPP" />
|
||||
<ClCompile Include="GetDigitalLuxMeterValue.cpp" />
|
||||
<ClCompile Include="ReadWriteIni.cpp" />
|
||||
<ClCompile Include="So7_Illumination.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UtilityForSo7Light.cpp" />
|
||||
<ClCompile Include="UtilityForSo7LightDlg.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="UtilityForSo7Light.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\UtilityForSo7Light.rc2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\Fan.bmp" />
|
||||
<Image Include="res\Pie.bmp" />
|
||||
<Image Include="res\Ring.bmp" />
|
||||
<Image Include="res\Single.bmp" />
|
||||
<Image Include="res\UtilityForSo7Light.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties RESOURCE_FILE="UtilityForSo7Light.rc" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="UtilityForSo7Light.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UtilityForSo7LightDlg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="So7_Illumination.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CMMIO_BASE.H">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CMMIO_SERIAL.H">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ReadWriteIni.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GetDigitalLuxMeterValue.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="UtilityForSo7Light.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UtilityForSo7LightDlg.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="So7_Illumination.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CMMIO_BASE.CPP">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CMMIO_SERIAL.CPP">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ReadWriteIni.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GetDigitalLuxMeterValue.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="UtilityForSo7Light.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\UtilityForSo7Light.rc2">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\UtilityForSo7Light.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="res\Fan.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="res\Pie.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="res\Ring.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="res\Single.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+4045
File diff suppressed because it is too large
Load Diff
+299
@@ -0,0 +1,299 @@
|
||||
#pragma once
|
||||
#include "resource.h"
|
||||
#include "afxwin.h"
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
enum LIGHT_MODE{
|
||||
PICKED_SINGLE_LAMP,
|
||||
PICKED_RING_LAMP,
|
||||
PICKED_FAN_LAMP,
|
||||
PICKED_PIE_LAMP
|
||||
};
|
||||
struct Light
|
||||
{
|
||||
double bottomLight;
|
||||
double coaxialLight;
|
||||
double topLight;
|
||||
double vectorLight[48];
|
||||
void init()
|
||||
{
|
||||
bottomLight = 0;
|
||||
coaxialLight = 0;
|
||||
topLight = 0;
|
||||
for (int i=0; i<48; i++)
|
||||
{
|
||||
vectorLight[i] = 0;
|
||||
}
|
||||
}
|
||||
void SetValid()
|
||||
{
|
||||
bottomLight = max(bottomLight,0);
|
||||
bottomLight = min(bottomLight,100);
|
||||
|
||||
|
||||
coaxialLight = max(coaxialLight,0);
|
||||
coaxialLight = min(coaxialLight,100);
|
||||
|
||||
topLight = max(topLight,0);
|
||||
topLight = min(topLight,100);
|
||||
|
||||
for (int i=0; i<48; i++)
|
||||
{
|
||||
vectorLight[i] = max(vectorLight[i],0);
|
||||
vectorLight[i] = min(vectorLight[i],100);
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
enum LightHit
|
||||
{
|
||||
null = -1,
|
||||
Hit_Coaxial,
|
||||
Hit_Top,
|
||||
Hit_Bottom,
|
||||
Hit_Ring
|
||||
};
|
||||
|
||||
struct MSG_LightContent
|
||||
{
|
||||
INT senderID;//the control that sends this message;
|
||||
Light light; //light information, global data.
|
||||
LightHit lightHit;
|
||||
BOOL bUpateToMachine;//The request to update machine;
|
||||
};
|
||||
class CUtilityForSo7LightDlg : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CUtilityForSo7LightDlg)
|
||||
|
||||
public:
|
||||
CUtilityForSo7LightDlg(CWnd* pParent = NULL); // standard constructor
|
||||
virtual ~CUtilityForSo7LightDlg();
|
||||
|
||||
// Dialog Data
|
||||
enum { IDD = IDD_UTILITYFORSO7LIGHT_DIALOG };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnClickedEf7ControlRingLightPickedFan();
|
||||
afx_msg void OnClickedEf7ControlRingLightPickedPie();
|
||||
afx_msg void OnClickedEf7ControlRingLightPickedRing();
|
||||
afx_msg void OnClickedEf7ControlRingLightPickedSingle();
|
||||
afx_msg void OnTurnOffLight();
|
||||
afx_msg void OnContextMenu(CWnd*, CPoint /*point*/);
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
|
||||
void UpdateLightStateToMachine();
|
||||
|
||||
struct LAMP_PROPERTY
|
||||
{
|
||||
double illumination;//0~100.0
|
||||
bool bHighlight;
|
||||
COLORREF color;
|
||||
};
|
||||
|
||||
LAMP_PROPERTY lightGroup[49+1];
|
||||
bool bStateOfGroupSelect[49+1];
|
||||
|
||||
enum MODE_PICKED_LAMP{//used in selecting modes by four button
|
||||
PICKED_SINGLE_LAMP,
|
||||
PICKED_RING_LAMP,
|
||||
PICKED_FAN_LAMP,
|
||||
PICKED_PIE_LAMP
|
||||
};
|
||||
|
||||
enum em_ID_TimerEvent
|
||||
{
|
||||
ID_REFLESH_REDRAW,
|
||||
ID_SEND_MESSAGE,
|
||||
ID_GET_REAL_LUX
|
||||
};
|
||||
|
||||
public:
|
||||
CPoint RotatePointCenterSweep(CPoint orginPoint,CPoint center,double angle);
|
||||
BOOL DrawRingLightFrame(CDC *pdc,MODE_PICKED_LAMP m_SwitchPickLamp);
|
||||
BOOL DrawRingLightFrameForSixRingRight(CDC *pdc, MODE_PICKED_LAMP m_SwitchPickLamp);
|
||||
BOOL DrawRingLightFrameForFourRoadRight(CDC *pdc, MODE_PICKED_LAMP m_SwitchPickLamp);
|
||||
BOOL DrawRingLightFrameForEightRoadRight(CDC *pdc, MODE_PICKED_LAMP m_SwitchPickLamp);
|
||||
void SettingForDrawRingLightFrameForSixRingRight(CDC& memDC, CBrush& mBrush);
|
||||
void SettingForDrawRingLightFrameForFourRoadRight(CDC& memDC, CBrush& mBrush);
|
||||
void SettingForDrawRingLightFrameForEightRoadRight(CDC& memDC, CBrush& mBrush);
|
||||
BOOL FillArcRegion(int num,CDC *pDC,bool bHighlight);
|
||||
COLORREF GetColor(double value=100.0);
|
||||
CRect GetArcRect(CPoint origin,CPoint center);
|
||||
int GetLightName(CPoint mousepoint);
|
||||
int GetLightMode(){return m_SwitchPickLamp;}
|
||||
private :
|
||||
int sumRingCollumn;
|
||||
int bottomLightID;
|
||||
int collumnWidth;
|
||||
int OUT_FRAME;
|
||||
int MouseMoveSelectBeginName;
|
||||
bool bInvalidateScreen;
|
||||
bool bTiggerSendMessage;
|
||||
double m_drawRotated;
|
||||
|
||||
MODE_PICKED_LAMP m_SwitchPickLamp ;
|
||||
MSG_LightContent m_MsgContent;
|
||||
void SelectRingLightExclusive(MODE_PICKED_LAMP lamp);
|
||||
void CancelSelectAll(void);
|
||||
void MarkRelatedRingWhenRing(int clickedLightName );
|
||||
void MarkRelatedRingWhenSingle(int clickedLightName);
|
||||
void MarkRelatedRingWhenPie(int clickedLightName);
|
||||
void MarkRelatedRingWhenFan(int clickedLightName);
|
||||
bool MarkGroupByName(int clickedLightName,bool *bValidate);
|
||||
void SetToSameIllumination();
|
||||
public:
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnBnClickedCancel();
|
||||
afx_msg void OnBnClickedButtonOpen();
|
||||
afx_msg void OnBnClickedButtonSave();
|
||||
afx_msg void OnBnClickedButtonUpLoad();
|
||||
afx_msg void OnBnClickedButtonDownLoad();
|
||||
afx_msg void OnDrawListValueBkColor(NMHDR *pNmHdr, LRESULT *pResult);
|
||||
afx_msg void OnBnClickedButtonReset();
|
||||
afx_msg void OnBnClickedButtonDelete();
|
||||
afx_msg void OnNMKillfocusListGetRingLightValue();
|
||||
afx_msg void OnNMDblclkListGetRingLightValue(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnBnClickedButtonGetLuxMeterInitValue();
|
||||
afx_msg void OnEnChangeEditWhichRingToCalibration();
|
||||
afx_msg void OnBnClickedCheckRing();
|
||||
afx_msg void OnEnChangeEditGetValueGap();
|
||||
afx_msg void OnEnChangeEditStayTime();
|
||||
afx_msg void OnEnChangeEditCalibrationStep();
|
||||
afx_msg void OnCbnSelchangeComboSelectLightType();
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
void UpdateLightDisplay(byte* data);
|
||||
void UpdateLightMode();
|
||||
void ModifyLightMode(int iSelect);
|
||||
void InitListContrl();
|
||||
void AdjustStringLength(CString &str, const int len);
|
||||
void ReadIni();
|
||||
void GetCalibrationValue(const double percenValue, const int iRing, const double iCurValue);
|
||||
void GetInitLuxMeterValue(const double percenValue, const int iRing, const double iCurLuxValue);
|
||||
void OnBnClickedButtonCalibration();
|
||||
void GetLuxMeterInitValue();
|
||||
void GetLuxMeterInitValueForWhichLight(const double& value);
|
||||
void DoLightCablication();
|
||||
void ButtonEnableWindows(BOOL bEnable);
|
||||
void OnShowLuxMeterValue();
|
||||
void OnUpdataLuxMeterValue();
|
||||
void OnShowListLightValue();
|
||||
void GetCalibAfterUpdateLightValue();
|
||||
void GetListColNumAndColWidthScale(int& iListColNum, double& dScale);
|
||||
void ShowWhichLightIcon();
|
||||
void SelectSixRingEightSectorLight();
|
||||
void SelectFourRoadLight();
|
||||
void SelectEightRoadLight();
|
||||
void SetLampeByOutSide(MSG_LightContent &msg,double illumination);
|
||||
void SetShortcutTitle(UINT lightName);
|
||||
void SetControlsIllumination(double illumination = 100.0, bool bUpdateToScrollBar = true);
|
||||
void OnUpdateCtrlStatus(BOOL bEnable);
|
||||
COLORREF GetBottomColor();
|
||||
COLORREF GetTopColor();
|
||||
CPoint Fan2Point();
|
||||
virtual BOOL OnInitDialog();
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
|
||||
public:
|
||||
enum SELECT_RING_NUMBER
|
||||
{
|
||||
SELECT_RING_ONE = 0,
|
||||
SELECT_RING_TWO,
|
||||
SELECT_RING_THREE,
|
||||
SELECT_RING_FOUR,
|
||||
SELECT_RING_FIVE,
|
||||
SELECT_RING_SIX
|
||||
};
|
||||
enum SELECT_LIGHT_TYPE
|
||||
{
|
||||
SELECT_LIGHT_SIX_RING = 0,
|
||||
SELECT_LIGHT_ROAD_FOUR,
|
||||
SELECT_LIGHT_ROAD_EIGHT
|
||||
};
|
||||
CButton m_btCalibration;
|
||||
CButton m_btExit;
|
||||
CButton m_btOpen;
|
||||
CButton m_btSave;
|
||||
CButton m_btReset;
|
||||
CButton m_btDelete;
|
||||
CButton m_btUpLoad;
|
||||
CButton m_btDownLoad;
|
||||
CButton m_btInitValue;
|
||||
CStatic m_stTempText;
|
||||
CStatic m_stIllumText;
|
||||
CEdit m_edIllumValue;
|
||||
CEdit m_edTempValue;
|
||||
CStatic m_stLightText;
|
||||
CEdit m_edLightValue;
|
||||
CButton m_btCheckRing;
|
||||
CEdit m_edWhichRing;
|
||||
CStatic m_stValueGap;
|
||||
CEdit m_edValueGap;
|
||||
CStatic m_stStayTime;
|
||||
CEdit m_edStayTime;
|
||||
CStatic m_stCalibStep;
|
||||
CEdit m_edCalibStep;
|
||||
CStatic m_stLightType;
|
||||
CComboBox m_comLightType;
|
||||
CButton m_RingLightButtonSingle;
|
||||
CButton m_RingLightButtonRing;
|
||||
CButton m_RingLightButtonFan;
|
||||
CButton m_RingLightButtonPie;
|
||||
CButton m_LightOff;
|
||||
CButton m_LightAuto;
|
||||
CStatic m_TextIllumination;
|
||||
CStatic m_TextLightName;
|
||||
CScrollBar m_vScrollLight;
|
||||
CListCtrl m_listValue;
|
||||
Light m_light;
|
||||
CEdit m_edtUseInputValue;
|
||||
CString m_strBeforeEdit;
|
||||
CString m_strSelectfilePath;
|
||||
int m_nCol;
|
||||
int m_nRow;
|
||||
int m_iSleepTime;
|
||||
int m_iCompareGap;
|
||||
int m_nLastSelectFan;
|
||||
int m_iCalibCurrent;
|
||||
int m_iSelectLightType;
|
||||
int m_iRoadBoardNum;
|
||||
int m_iRingGapSleepTime;
|
||||
UINT m_iLightFanTolNum;
|
||||
UINT m_iLightRingTolNum;
|
||||
int m_iSelctRingLightNum;
|
||||
int m_iGetWhichRingForInitValue;
|
||||
float m_LightIllum[6][101] = { 0 };
|
||||
float m_KeepLightIllum[6][101];
|
||||
short m_KeepLightValue[6][101];
|
||||
short m_LightValue[6][101] = { 0 };
|
||||
short WriteIllumData[6][101] = { 0 };
|
||||
int m_iRingIlluminationObj[6] = { 0 };
|
||||
int m_iRingIlluminationObjForRoad[8] = { 0 };
|
||||
bool m_bInputByUser;
|
||||
bool m_bPressOpenBt;
|
||||
bool m_bStopCalibration;
|
||||
bool m_bCalibration;
|
||||
bool m_bInitLuxValue;
|
||||
bool m_bReset;
|
||||
bool m_bGetSingleRingInitValue;
|
||||
bool m_bUseDefaultPath;
|
||||
bool m_bCheckRing;
|
||||
bool m_bUpdate;
|
||||
bool m_bPopUpPromptDialog;
|
||||
double m_dCabStep;
|
||||
double m_LuxValue;
|
||||
double m_LuxTempleture;
|
||||
struct Keep_Calib_Value
|
||||
{
|
||||
double current_LuxLight;
|
||||
short current_LightValue;
|
||||
};
|
||||
vector<Keep_Calib_Value> m_vGetTempValue;
|
||||
};
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Binary file not shown.
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
||||
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// UtilityForSo7Light.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently,
|
||||
// but are changed infrequently
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef VC_EXTRALEAN
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
#endif
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
|
||||
|
||||
// turns off MFC's hiding of some common and often safely ignored warning messages
|
||||
#define _AFX_ALL_WARNINGS
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _AFX_NO_OLE_SUPPORT
|
||||
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
||||
#endif
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include <afxcontrolbars.h> // MFC support for ribbons and control bars
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
Reference in New Issue
Block a user