本文整理汇总了C++中write_one函数的典型用法代码示例。如果您正苦于以下问题:C++ write_one函数的具体用法?C++ write_one怎么用?C++ write_one使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write_one函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write_one
void Cconfigure::OnEnKillfocusEdit1()
{
CString strText;
m_edit.GetWindowText(strText);
m_edit.ShowWindow(SW_HIDE);
if (strText.CompareNoCase(m_oldname)==0)
{
return;
}
int Value=_wtoi(strText);
if (5==m_CurCol)
{
write_one(g_tstat_id,14535+m_CurRow,Value);
}
else
{
write_one(g_tstat_id,251+m_CurRow,Value);
}
OnInitDialog();
}
示例2: change_com_port_and_net_work_controller_baudrate
void change_com_port_and_net_work_controller_baudrate(int new_baudrate)
{
TRACE("%d\n",new_baudrate);
static int now_baudrate=0;
if(now_baudrate!=new_baudrate)
now_baudrate=new_baudrate;
else
return;
showing_text=T3000VIEW_SCAN_CHANGE_NET_WORK_BAUDRATE;//for showing
int baudrate=19200;
if(new_baudrate!=19200)
baudrate=9600;
bool found=false;
for(int i=0;i<m_binary_search_product_background_thread.size();i++)
{
if(NET_WORK_CONT_PRODUCT_MODEL==m_binary_search_product_background_thread.at(i).product_class_id)
{
found=true;
//Change_BaudRate(m_binary_search_product_background_thread.at(i).baudrate);/////////change to same baudrate,so next step ,read,write
if(baudrate==9600)
write_one(m_binary_search_product_background_thread.at(i).id,128,0);
else
write_one(m_binary_search_product_background_thread.at(i).id,128,1);
write_one(m_binary_search_product_background_thread.at(i).id,131,1);/////////save nemo
}
}
Change_BaudRate(baudrate);
if(found==true)
Sleep(4000);//////////it 's better for next step
else
now_baudrate=0;///////////for no net work controller
showing_text="";//for showing
}
示例3: set_color
int set_color(int led, int intensity, int r, int g, int b) {
uint16_t color = ((r)+((g)<<4)+((b)<<8));
int i;
write_begin();
for (i=6; i; i--, (led <<= 1)) {
if (led&(1<<5)) {
write_one();
} else {
write_zero();
}
}
for (i=8; i; i--, (intensity<<=1)) {
if (intensity&(1<<7)) {
write_one();
} else {
write_zero();
}
}
for (i=12; i; i--, (color<<=1)) {
if (color&(1<<11)) {
write_one();
} else {
write_zero();
}
}
write_end();
return 0;
}
示例4: write_one
// Write one cv::Mat to file
bool write_one(FILE * file, const cv::Mat & data)
{
bool okay = true;
okay &= write_one(file, int32_t(data.rows));
okay &= write_one(file, int32_t(data.cols));
okay &= write_one(file, uint32_t(data.type()));
// If matrix memory is continuous, we can reshape the matrix
int rows = data.rows, cols = data.cols;
if (data.isContinuous()) {
cols = rows*cols;
rows = 1;
}
// Currently only supports float/double matrices!
assert(data.depth() == CV_32F || data.depth() == CV_64F);
if (data.depth() == CV_32F)
for (int r = 0; r < rows; ++r)
okay &= write_n(file, data.ptr<float>(r), cols);
else if (data.depth() == CV_64F)
for (int r = 0; r < rows; ++r)
okay &= write_n(file, data.ptr<double>(r), cols);
else
return false;
return okay;
}
示例5: MessageBox
void CCO2_View::Check_HourTime()
{
CTime temp_time;
int chour,cmin,csec;
m_co2_time_picker.GetTime(temp_time);
chour = temp_time.GetHour();
cmin = temp_time.GetMinute();
csec = temp_time.GetSecond();
if(chour != product_register_value[CO2_485_MODBUS_RTC_HOUR])
{
if(write_one(g_tstat_id,CO2_485_MODBUS_RTC_HOUR,chour,3)<0)
{
MessageBox(_T("Operate failure,Please try again"));
return;
}
}
if(cmin != product_register_value[CO2_485_MODBUS_RTC_MIN])
{
if(write_one(g_tstat_id,CO2_485_MODBUS_RTC_MIN,cmin,3)<0)
{
MessageBox(_T("Operate failure,Please try again"));
return;
}
}
}
示例6: _Batch_Flash_SN
DWORD WINAPI _Batch_Flash_SN(LPVOID pParam)
{
CBatchSNDlg* pView=(CBatchSNDlg*)(pParam);
for (int i = 0;i<pView->m_modbus_IDs.size();i++)
{
int IntSN=pView->GetNewSerialNumber();
write_one(pView->m_modbus_IDs.at(i).ModbusID,2026,123,5);
int ret=write_one(pView->m_modbus_IDs.at(i).ModbusID,2027,IntSN,5);
if (ret>0)
{
pView->WriteSerialNumber(IntSN);
pView->m_modbus_IDs.at(i).SN = IntSN;
pView->m_modbus_IDs.at(i).Result = TRUE;
}
else
{
pView->m_modbus_IDs.at(i).SN = -1;
pView->m_modbus_IDs.at(i).Result = FALSE;
}
SendMessage(g_hwnd_now,WM_REFRESH_BAC_INPUT_LIST,2,i);
}
//PostMessage(g_hwnd_now,WM_REFRESH_BAC_INPUT_LIST,0,0);
return 1;
}
示例7: GetDlgItemText
void T3000_Default_MainView::OnEnKillfocusEditBacnetDeviceId()
{
// TODO: 在此添加控件通知处理程序代码
CString strText;
GetDlgItemText(IDC_EDIT_BACNET_DEVICE_ID, strText);
int nValue = _wtoi(strText);
unsigned int temp_device_id = 0;
temp_device_id = product_register_value[992] * 65536 + product_register_value[991];
if (temp_device_id == nValue) //Add this to judge weather this value need to change.
return;
unsigned short temp_device_low;
unsigned short temp_device_high;
temp_device_low = nValue % 65536;
temp_device_high = nValue / 65536;
int nret_1 = write_one(g_tstat_id, 991, temp_device_low, 6);
int nret_2 = write_one(g_tstat_id, 992, temp_device_high, 6);
if ((nret_1 >= 0) && (nret_2 >= 0))
{
product_register_value[991] = temp_device_low;
product_register_value[992] = temp_device_high;
SetPaneString(BAC_SHOW_MISSION_RESULTS, _T("Change bacnet device id success"));
}
else
{
MessageBox(_T("Change bacnet device id failed!"));
}
}
示例8: write_one
stat_value Stat::add(const std::string & key, const std::string & player, stat_value value) {
//errorstream<<"stat adding: "<<key<< " player="<<player<<" = "<< value<<std::endl;
stat_value ret = write_one("total|" + key, value);
write_one("day|"+ key + "|" + day , value);
write_one("week|"+ key + "|" + week, value);
write_one("month|"+ key + "|" + month, value);
if (!player.empty())
ret = write_one("player|" + key + "|" + player, value);
return ret;
}
示例9: if
void Cconfigure::OnCbnSelchangeRangecombo()
{
int Item=m_controlcombo.GetCurSel();
int RegValue,Value;
if (1==m_CurCol)
{
RegValue=read_one(g_tstat_id,200+m_CurRow);
if (RegValue<0)
{
RegValue=0;
}
if (0==Item)
{
Value=1;
}
else if (1==Item)
{
Value=2;
}
else if (2==Item)
{
Value=4;
}
RegValue&=0xF0;
RegValue+=Value;
write_one(g_tstat_id,200+m_CurRow,RegValue);
}
else if (3==m_CurCol)
{
RegValue=read_one(g_tstat_id,200+m_CurRow);
if (RegValue<0)
{
RegValue=0;
}
if (0==Item)
{
Value=16;
}
else if (1==Item)
{
Value=32;
}
RegValue&=0x0F;//留底位,去高位
RegValue+=Value;//置高位
write_one(g_tstat_id,200+m_CurRow,RegValue);
}
else if (4==m_CurCol)
{
write_one(g_tstat_id,4171+m_CurRow,Item);
}
OnInitDialog();
}
示例10: _wtoi
void CReg_ControlDlg::OnBnClickedBtnDeviceIdWrite()
{
// TODO: Add your control notification handler code here
CString temp_id;
CString temp_on_time;
CString temp_cycle;
int i_id;
int i_time;
int i_cycle;
m_reg_id.GetWindowTextW(temp_id);
m_reg_on_time.GetWindowTextW(temp_on_time);
m_reg_cycle.GetWindowTextW(temp_cycle);
i_id = _wtoi(temp_id);
i_time = _wtoi(temp_on_time);
i_cycle = _wtoi(temp_cycle);
if(write_one(255,6,i_id)<0)
{
MessageBox(_T("дÈëʧ°Ü£¬ÇëÖØÊÔ"));
return;
}
if(write_one(255,104,i_time)<0)
{
MessageBox(_T("дÈëʧ°Ü£¬ÇëÖØÊÔ"));
return;
}
if(write_one(255,105,i_cycle)<0)
{
MessageBox(_T("дÈëʧ°Ü£¬ÇëÖØÊÔ"));
return;
}
MessageBox(_T("дÈë³É¹¦£¡"));
int id_read=0;
int time_read=0;
int cycle_read=0;
CString temp_read_id;
CString temp_read_time;
CString temp_read_cycle;
id_read=read_one(i_id,6,3);
time_read=read_one(i_id,104,3);
cycle_read=read_one(i_id,105,3);
temp_read_id.Format(_T("%d"),id_read);
temp_read_time.Format(_T("%d"),time_read);
temp_read_cycle.Format(_T("%d"),cycle_read);
GetDlgItem(IDC_STATIC_ID)->SetWindowText(temp_read_id);
GetDlgItem(IDC_STATIC_TIME)->SetWindowText(temp_read_time);
GetDlgItem(IDC_STATIC_CYCLE)->SetWindowText(temp_read_cycle);
}
示例11: write_one
void CCO2_NodeView::OnCbnSelchangeComboCo2NodeProtocol()
{
// TODO: 在此添加控件通知处理程序代码
CString temp_string;
int nSel = ((CComboBox *)GetDlgItem(IDC_COMBO_CO2_NODE_PROTOCOL))->GetCurSel();
((CComboBox *)GetDlgItem(IDC_COMBO_CO2_NODE_PROTOCOL))->GetLBText(nSel, temp_string);
int temp_protocol = product_register_value[21];
for (int i = 0;i<sizeof(CO2_Node_Protocol) / sizeof(CO2_Node_Protocol[0]);i++)
{
if (temp_string.CompareNoCase(CO2_Node_Protocol[i]) == 0)
{
temp_protocol = i;
break;
}
}
int nret = write_one(g_tstat_id, 21, temp_protocol);
if (nret <= 0)
{
SetPaneString(BAC_SHOW_MISSION_RESULTS, _T("Change protocol failed!"));
PostMessage(WM_CO2_NODE_THREAD_READ, NULL, NULL);
}
else
{
SetPaneString(BAC_SHOW_MISSION_RESULTS, _T("Operation Done!"));
}
((CButton *)GetDlgItem(IDC_BUTTON_OK))->SetFocus();
}
示例12: write_one
void CNetworkControllView::OnBnClickedRebootbtn()
{
if(g_NetWorkLevel==1)
return;
write_one(g_tstat_id,133,1);
// TODO: Add your control notification handler code here
}
示例13: AfxMessageBox
void CRegisterWriteValueDlg::OnBnClickedOk()
{
if (m_col==0)
{
if (!m_CanWrite)
{
AfxMessageBox(_T("The register can't be written.\nBecause it is read-only."));
return;
}
m_valueEdit.GetWindowText(m_value);
int value=_wtoi(m_value);
int Add=_wtoi(m_no);
int ret=write_one(g_tstat_id,Add,value);
if (ret<0)
{
AfxMessageBox(_T("Write Fail"));
return;
}
product_register_value[Add]=value;
AfxMessageBox(_T("Write OK"));
}
else
{
CADO ado;
AfxMessageBox(_T("Save OK"));
}
}
示例14: perform_tests
static bool
perform_tests(void *data)
{
char command[128];
int n;
sol_memmap_add_map(&_memmap0);
sol_memmap_add_map(&_memmap1);
n = snprintf(command, sizeof(command), "truncate -s0 %s && truncate -s128 %s",
_memmap0.path, _memmap0.path);
ASSERT(n > 0 && (size_t)n < sizeof(command));
n = system(command);
ASSERT(!n);
n = snprintf(command, sizeof(command), "truncate -s0 %s && truncate -s128 %s",
_memmap1.path, _memmap1.path);
ASSERT(n > 0 && (size_t)n < sizeof(command));
n = system(command);
ASSERT(!n);
write_one();
read_one(); /* This one should happen before actually writing data */
sol_timeout_add(0, read_one_after_mainloop, NULL); /* This one should be after a main loop */
sol_timeout_add(50, write_two_timeout, NULL); /* This, much after */
sol_timeout_add(1000, read_two_after, NULL); /* Even later */
sol_timeout_add(2000, write_cancelled_timeout, NULL);
return false;
}
示例15: UpdateData
void CWriteSingleRegDlg::OnBnClickedOk()
{
//CDialogEx::OnOK();
UpdateData(TRUE);
int ret=write_one(g_tstat_id,m_address,m_value);
if (ret>0)
{
product_register_value[m_address]=m_value;
AfxMessageBox(_T("Write OK"));
}
else
{
// int value_ret=read_one(g_tstat_id,m_address,7);
// if (value_ret==m_value)
// {
// multi_register_value[m_address]=m_value;
// AfxMessageBox(_T("Write OK"));
// UpdateData(FALSE);
// return;
// }
// m_value=multi_register_value[m_address];
// AfxMessageBox(_T("Write Fail"));
}
}