WriteConfig
This commit is contained in:
parent
a9156b0033
commit
588d5ef898
11 changed files with 142 additions and 71 deletions
|
|
@ -619,6 +619,7 @@ int EpdBase::Epd2U::ConnectAndStatus(int tokenSourceTimeoutms)
|
||||||
|
|
||||||
int EpdBase::Epd2U::IssueAndCheck(float gain)
|
int EpdBase::Epd2U::IssueAndCheck(float gain)
|
||||||
{
|
{
|
||||||
|
//chirp not supported
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
if (isNG) {
|
if (isNG) {
|
||||||
int kx = (int)gain;
|
int kx = (int)gain;
|
||||||
|
|
|
||||||
|
|
@ -1230,40 +1230,65 @@ int Epd3Base::Epd3U::WriteConfig(void)
|
||||||
int32_t r = 0;
|
int32_t r = 0;
|
||||||
ECLen = 32;
|
ECLen = 32;
|
||||||
|
|
||||||
token = BeginWriteAccessLevel(epdComsHandle, AccessLevel_t::Admin, EC, ECLen, , nullptr);
|
token = BeginWriteAccessLevel(epdComsHandle, AccessLevel_t::Admin, EC, ECLen, nullptr);
|
||||||
r = Commit3(epdComsHandle);
|
r = Commit3(epdComsHandle);
|
||||||
r = EndWriteAccessLevel(epdComsHandle, token);
|
r = EndWriteAccessLevel(epdComsHandle, token);
|
||||||
displayIds = new QuickAccessDisplay_t[6]{
|
|
||||||
{ 0,0x0021 },
|
if (!r) {
|
||||||
{ 1,0x0022 },
|
displayIds = new QuickAccessDisplay_t[6]{
|
||||||
{ 2,0x0031 },
|
{ 0,0x0021 },
|
||||||
{ 3,0x0032 },
|
{ 1,0x0022 },
|
||||||
{ 4,0x0051 },
|
{ 2,0x0031 },
|
||||||
{ 5,0x0062 }
|
{ 3,0x0032 },
|
||||||
};
|
{ 4,0x0051 },
|
||||||
numDisplays = 6;
|
{ 5,0x0062 }
|
||||||
|
};
|
||||||
|
|
||||||
|
numDisplays = 6;
|
||||||
|
token = BeginWriteQuickAccessDisplays_R3(epdComsHandle, displayIds, numDisplays, nullptr);
|
||||||
|
r = Commit3(epdComsHandle);
|
||||||
|
r = EndWriteQuickAccessDisplays_R3(epdComsHandle, token);
|
||||||
|
}
|
||||||
|
if (!r) {
|
||||||
|
numItems = 9;
|
||||||
|
enables = new DisplayAttributeMap_t[9]{
|
||||||
|
{ 0,0xF8FF,0xFFFF },
|
||||||
|
{ 1,0xF8FF,0xFFE7 },
|
||||||
|
{ 2,0xF8FF,0xFFFF },
|
||||||
|
{ 3,0xF8FF,0xFFFF },
|
||||||
|
{ 4,0xF8FF,0xFE01 },
|
||||||
|
{ 5,0xF8FF,0xFFFF },
|
||||||
|
{ 6,0xF8FF,0xFFFF },
|
||||||
|
{ 7,0xF8FF,0xFFFB },
|
||||||
|
{ 8,0xF8FF,0xFFFF },
|
||||||
|
};
|
||||||
|
|
||||||
|
token = BeginWriteDisplayEnables_R3(epdComsHandle, enables, numItems, nullptr);
|
||||||
|
r = Commit3(epdComsHandle);
|
||||||
|
r = EndWriteDisplayEnables_R3(epdComsHandle, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!r) {
|
||||||
|
uint8_t numMenus = 9;
|
||||||
|
uint16_t permissions[9] = {
|
||||||
|
0x0000 ,
|
||||||
|
0x0016 ,
|
||||||
|
0x0000 ,
|
||||||
|
0x0000 ,
|
||||||
|
0x0000 ,
|
||||||
|
0x0000 ,
|
||||||
|
0x0000 ,
|
||||||
|
0x0006 ,
|
||||||
|
0x0000 ,
|
||||||
|
};
|
||||||
|
|
||||||
|
token = BeginWriteDisplayEnablePermissions_R3(epdComsHandle, AccessLevel_t::Admin, permissions, numDisplays, nullptr);
|
||||||
|
r = Commit3(epdComsHandle);
|
||||||
|
r = EndWriteDisplayEnablePermissions_R3(epdComsHandle, token);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
token = BeginWriteQuickAccessDisplays_R3(epdComsHandle, displayIds, 6, , nullptr);
|
|
||||||
r = Commit3(epdComsHandle);
|
|
||||||
r = EndWriteQuickAccessDisplays_R3(epdComsHandle, token);
|
|
||||||
|
|
||||||
numItems = 9;
|
|
||||||
enables = new DisplayAttributeMap_t[9]{
|
|
||||||
{ 0, 0x5E96, 0xFFFF },
|
|
||||||
{ 1, 0x5E96, 0xFFE1 },
|
|
||||||
{ 2, 0x5E96, 0xFFFF },
|
|
||||||
{ 3, 0x5E96, 0xFF0F },
|
|
||||||
{ 4, 0x5E96, 0xFE01 },
|
|
||||||
{ 5, 0x5E96, 0xFF03 },
|
|
||||||
{ 6, 0x5E96, 0xFFFF },
|
|
||||||
{ 7, 0x5E96, 0xFF81 },
|
|
||||||
{ 8, 0x5E96, 0xFFFF }
|
|
||||||
};
|
|
||||||
|
|
||||||
token = BeginWriteDisplayEnables_R3(epdComsHandle, enables, numItems, nullptr);
|
|
||||||
r = Commit3(epdComsHandle);
|
|
||||||
r = EndWriteDisplayEnables_R3(epdComsHandle, token);
|
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,6 @@ namespace Epd3Base {
|
||||||
WORD WriteCal();
|
WORD WriteCal();
|
||||||
|
|
||||||
int WriteConfig(void);
|
int WriteConfig(void);
|
||||||
int SetChirp(float Sensitivity);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -303,13 +303,13 @@ namespace EpdBaseClr {
|
||||||
void WaitEnd();
|
void WaitEnd();
|
||||||
int GetAll(bool close);
|
int GetAll(bool close);
|
||||||
int GetAllDeissue();
|
int GetAllDeissue();
|
||||||
int IssueAndCheck(float gain);
|
int IssueAndCheck(float gain, float ChirpRate);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int AfterGetStatus(EpdBase::Epd2U* epd);
|
int AfterGetStatus(EpdBase::Epd2U* epd);
|
||||||
int AfterGetStatus(Epd3Base::Epd3U* epd);
|
int AfterGetStatus(Epd3Base::Epd3U* epd);
|
||||||
int AfterGetStatus();
|
int AfterGetStatus();
|
||||||
int IssueAndCheck(float gain, float ChirpRate);
|
|
||||||
int SwitchCon();
|
int SwitchCon();
|
||||||
void InitData();
|
void InitData();
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
3
EpdBaseClr/resource.h
Normal file
3
EpdBaseClr/resource.h
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by app.rc
|
||||||
32
MK3/MK3.cpp
32
MK3/MK3.cpp
|
|
@ -366,21 +366,37 @@ namespace MK3 {
|
||||||
|
|
||||||
int Epd2::ReadDisplay()
|
int Epd2::ReadDisplay()
|
||||||
{
|
{
|
||||||
|
|
||||||
int rv = epd->ReadDisplay();
|
int rv = epd->ReadDisplay();
|
||||||
String^ s = System::String::Format("numItems: {0}", epd->numItems);
|
String^ closingQuote = gcnew System::String(" };");
|
||||||
System::Diagnostics::Debug::WriteLine(s);
|
|
||||||
for (int i = 0; i < epd->numItems; i++) {
|
|
||||||
s = System::String::Format("{{ {0},0x{1:X4},0x{2:X4} }}", epd->enables[i].MenuId, epd->enables[i].EnableMask, epd->enables[i].Enables);
|
|
||||||
System::Diagnostics::Debug::WriteLine(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
s = System::String::Format("numDisplays: {0}", epd->numDisplays);
|
String^ s = System::String::Format("\tnumDisplays = {0};\n\tdisplayIds = new QuickAccessDisplay_t[6]{{", epd->numDisplays);
|
||||||
System::Diagnostics::Debug::WriteLine(s);
|
System::Diagnostics::Debug::WriteLine(s);
|
||||||
for (int i = 0; i < epd->numDisplays; i++) {
|
for (int i = 0; i < epd->numDisplays; i++) {
|
||||||
s = System::String::Format("{{ {0},0x{1:X4} }}", epd->displayIds[i].Position, epd->displayIds[i].DisplayId);
|
s = System::String::Format("{{ {0},0x{1:X4} }}", epd->displayIds[i].Position, epd->displayIds[i].DisplayId);
|
||||||
System::Diagnostics::Debug::WriteLine(s);
|
System::Diagnostics::Debug::WriteLine(s);
|
||||||
}
|
}
|
||||||
|
System::Diagnostics::Debug::WriteLine(closingQuote);
|
||||||
|
|
||||||
|
s = System::String::Format("\tnumItems={0};\n\tenables = new DisplayAttributeMap_t[9]{{", epd->numItems);
|
||||||
|
System::Diagnostics::Debug::WriteLine(s);
|
||||||
|
for (int i = 0; i < epd->numItems; i++) {
|
||||||
|
s = System::String::Format("\t{{ {0},0x{1:X4},0x{2:X4} }},", epd->enables[i].MenuId, epd->enables[i].EnableMask & 0xff, epd->enables[i].Enables);
|
||||||
|
System::Diagnostics::Debug::WriteLine(s);
|
||||||
|
}
|
||||||
|
System::Diagnostics::Debug::WriteLine(closingQuote);
|
||||||
|
|
||||||
|
s = System::String::Format("//DisplayEnablePermissions\n\tuint8_t numMenus = {0};", epd->numMenus);
|
||||||
|
System::Diagnostics::Debug::WriteLine(s);
|
||||||
|
s = System::String::Format("uint16_t permissions[{0}] = {{", epd->numMenus);
|
||||||
|
System::Diagnostics::Debug::WriteLine(s);
|
||||||
|
System::Diagnostics::Debug::WriteLine(closingQuote);
|
||||||
|
|
||||||
|
for (int i = 0; i < epd->numMenus; i++) {
|
||||||
|
s = System::String::Format(" 0x{0:X4} ,", epd->permissions[i]);
|
||||||
|
System::Diagnostics::Debug::WriteLine(s);
|
||||||
|
}
|
||||||
|
System::Diagnostics::Debug::WriteLine(closingQuote);
|
||||||
|
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1078,15 +1078,17 @@ WORD MK3::Epd2U::WriteCal()
|
||||||
|
|
||||||
WORD MK3::Epd2U::SetSettings()
|
WORD MK3::Epd2U::SetSettings()
|
||||||
{
|
{
|
||||||
|
int c = 0;
|
||||||
if (port == 0) return 1;
|
if (port == 0) return 1;
|
||||||
int32_t r=0;
|
int32_t r=0;
|
||||||
ECLen = 32;
|
ECLen = 32;
|
||||||
|
|
||||||
ResetEvent(Ev1);
|
ResetEvent(Ev1); c++;
|
||||||
token = BeginWriteAccessLevel(epdComsHandle, AccessLevel_t::Admin, EC, ECLen, completion);
|
token = BeginWriteAccessLevel(epdComsHandle, AccessLevel_t::Admin, EC, ECLen, completion);
|
||||||
r = Commit(epdComsHandle);
|
r = Commit(epdComsHandle);
|
||||||
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
|
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
|
||||||
r = EndWriteAccessLevel(epdComsHandle, token);
|
r = EndWriteAccessLevel(epdComsHandle, token);
|
||||||
|
if (r) goto error;
|
||||||
|
|
||||||
|
|
||||||
displayIds = new QuickAccessDisplay_t[6]{
|
displayIds = new QuickAccessDisplay_t[6]{
|
||||||
|
|
@ -1101,44 +1103,59 @@ WORD MK3::Epd2U::SetSettings()
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
ResetEvent(Ev1);
|
ResetEvent(Ev1); c++;
|
||||||
token = BeginWriteQuickAccessDisplays_R3(epdComsHandle, displayIds, 6, completion);
|
token = BeginWriteQuickAccessDisplays_R3(epdComsHandle, displayIds, 6, completion);
|
||||||
r = Commit(epdComsHandle);
|
r = Commit(epdComsHandle);
|
||||||
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
|
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
|
||||||
r = EndWriteQuickAccessDisplays_R3(epdComsHandle, token);
|
r = EndWriteQuickAccessDisplays_R3(epdComsHandle, token);
|
||||||
|
if (r) goto error;
|
||||||
|
|
||||||
//numItems = 9;
|
//DisplayEnablePermissions
|
||||||
//enables = new DisplayAttributeMap_t[9]{
|
uint8_t numMenus = 9;
|
||||||
// { 0,0xCB03,0xFFFF },
|
uint16_t permissions[9] = {
|
||||||
// { 1,0xCB03,0xFFE7 },
|
0x0000,
|
||||||
// { 2,0xCB03,0xFFFF },
|
0x0016,
|
||||||
// { 3,0xCB03,0xFFFF },
|
0x0000,
|
||||||
// { 4,0xCB03,0xFE01 },
|
0x0000,
|
||||||
// { 5,0xCB03,0xFFFF },
|
0x0000,
|
||||||
// { 6,0xCB03,0xFFFF },
|
0x0000,
|
||||||
// { 7,0xCB03,0xFFFB },
|
0x0000,
|
||||||
// { 8,0xCB03,0xFFFF }
|
0x0006,
|
||||||
//};
|
0x0000
|
||||||
|
};
|
||||||
|
ResetEvent(Ev1); c++;
|
||||||
|
token = BeginWriteDisplayEnablePermissions_R3(epdComsHandle, AccessLevel_t::Admin, permissions, numDisplays, completion);
|
||||||
|
r = Commit(epdComsHandle);
|
||||||
|
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
|
||||||
|
r = EndWriteDisplayEnablePermissions_R3(epdComsHandle, token);
|
||||||
|
if (r) goto error;
|
||||||
|
|
||||||
|
|
||||||
numItems = 9;
|
numItems = 9;
|
||||||
enables = new DisplayAttributeMap_t[9]{
|
enables = new DisplayAttributeMap_t[9]{
|
||||||
{ 0, 0x5E96, 0xFFFF },
|
{ 0,0x5CFF,0xFFFF },
|
||||||
{ 1, 0x5E96, 0xFFE1 },
|
{ 1,0x5CFF,0xFFE7 },
|
||||||
{ 2, 0x5E96, 0xFFFF },
|
{ 2,0x5CFF,0xFFFF },
|
||||||
{ 3, 0x5E96, 0xFF0F },
|
{ 3,0x5CFF,0xFFFF },
|
||||||
{ 4, 0x5E96, 0xFE01 },
|
{ 4,0x5CFF,0xFE01 },
|
||||||
{ 5, 0x5E96, 0xFF03 },
|
{ 5,0x5CFF,0xFFFF },
|
||||||
{ 6, 0x5E96, 0xFFFF },
|
{ 6,0x5CFF,0xFFFF },
|
||||||
{ 7, 0x5E96, 0xFF81 },
|
{ 7,0x5CFF,0xFFFB },
|
||||||
{ 8, 0x5E96, 0xFFFF }
|
{ 8,0x5CFF,0xFFFF }
|
||||||
};
|
};
|
||||||
|
|
||||||
ResetEvent(Ev1);
|
ResetEvent(Ev1); c++;
|
||||||
token = BeginWriteDisplayEnables_R3(epdComsHandle, enables, numItems, completion);
|
token = BeginWriteDisplayEnables_R3(epdComsHandle, enables, numItems, completion);
|
||||||
r = Commit(epdComsHandle);
|
r = Commit(epdComsHandle);
|
||||||
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
|
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
|
||||||
r = EndWriteDisplayEnables_R3(epdComsHandle, token);
|
r = EndWriteDisplayEnables_R3(epdComsHandle, token);
|
||||||
|
if (r) goto error;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return r;
|
||||||
|
|
||||||
|
error:
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1212,7 +1229,11 @@ WORD MK3::Epd2U::ReadDisplay()
|
||||||
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
|
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
|
||||||
r = EndReadDisplayEnables_R3(epdComsHandle, token, enables, 20, &numItems);
|
r = EndReadDisplayEnables_R3(epdComsHandle, token, enables, 20, &numItems);
|
||||||
|
|
||||||
|
token= BeginReadDisplayEnablePermissions_R3(epdComsHandle, AccessLevel_t::Admin, completion);
|
||||||
|
ResetEvent(Ev1);
|
||||||
|
r = Commit(epdComsHandle);
|
||||||
|
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
|
||||||
|
EndReadDisplayEnablePermissions_R3(epdComsHandle, token, &curAccessLevel, permissions, permissionsLen, &numMenus);
|
||||||
|
|
||||||
return CommitRV;
|
return CommitRV;
|
||||||
}
|
}
|
||||||
|
|
@ -303,6 +303,13 @@ namespace MK3
|
||||||
QuickAccessDisplay_t *displayIds;
|
QuickAccessDisplay_t *displayIds;
|
||||||
uint8_t numDisplays;
|
uint8_t numDisplays;
|
||||||
|
|
||||||
|
|
||||||
|
AccessLevel_t curAccessLevel;
|
||||||
|
uint16_t permissions[100];
|
||||||
|
uint8_t permissionsLen = 100;
|
||||||
|
uint8_t numMenus;
|
||||||
|
|
||||||
|
|
||||||
EncryptionKey EC;
|
EncryptionKey EC;
|
||||||
uint8_t ECLen;
|
uint8_t ECLen;
|
||||||
//static HANDLE Ev1 ;
|
//static HANDLE Ev1 ;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ namespace TestEPD3Dll
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
|
||||||
DateTime jan1970 = new DateTime(1970, 1, 1);
|
DateTime jan1970 = new DateTime(1970, 1, 1);
|
||||||
var snow = (DateTime.Now - jan1970).TotalSeconds;
|
var snow = (DateTime.Now - jan1970).TotalSeconds;
|
||||||
DateTime dt2 = DateTime.Now.AddSeconds(-254246887);
|
DateTime dt2 = DateTime.Now.AddSeconds(-254246887);
|
||||||
|
|
@ -22,7 +21,7 @@ namespace TestEPD3Dll
|
||||||
x.Connect(false);
|
x.Connect(false);
|
||||||
|
|
||||||
x.ECIn = System.Security.Cryptography.SHA256.Create().ComputeHash(System.Text.Encoding.UTF8.GetBytes("Administrator"));
|
x.ECIn = System.Security.Cryptography.SHA256.Create().ComputeHash(System.Text.Encoding.UTF8.GetBytes("Administrator"));
|
||||||
rv= x.SetChirp(5);
|
//rv= x.SetChirp(5);
|
||||||
x.SetSettings();
|
x.SetSettings();
|
||||||
|
|
||||||
x.ReadDisplay(); // ToDo list
|
x.ReadDisplay(); // ToDo list
|
||||||
|
|
|
||||||
|
|
@ -51,5 +51,5 @@ using System.Windows;
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.8.0.0")]
|
[assembly: AssemblyVersion("2.9.0.0")]
|
||||||
[assembly: AssemblyFileVersion("2.8.0.0")]
|
[assembly: AssemblyFileVersion("2.9.0.0")]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue