smf/smfservermodule/smfclient/client/smfcontactfetcher_p.cpp
changeset 14 a469c0e6e7fb
parent 10 77a56c951f86
equal deleted inserted replaced
13:b5d63d5fc252 14:a469c0e6e7fb
    13  * Manasij Roy, Nalina Hariharan
    13  * Manasij Roy, Nalina Hariharan
    14  */
    14  */
    15 #include "smfcontactfetcher_p.h"
    15 #include "smfcontactfetcher_p.h"
    16 #ifdef WRITE_LOG
    16 #ifdef WRITE_LOG
    17 #include <QFile>
    17 #include <QFile>
    18 #include <QTextStream>
    18 #include <QTextstream>
    19 #endif
    19 #endif
    20 #ifdef Q_OS_SYMBIAN
    20 #ifdef Q_OS_SYMBIAN
    21 #include "SmfClientSymbian.h"
    21 #include "SmfClientSymbian.h"
    22 #else
    22 #else
    23 #include "smfclientqt.h"
    23 #include "SmfClientQt.h"
    24 #endif
    24 #endif
    25  /**
    25  /**
    26    * Constructs the SmfContactFetcher.
    26    * Constructs the SmfContactFetcher.
    27    * @param parent base provider info
    27    * @param parent base provider info
    28    * @param contact Used for searching friends of the given contact
    28    * @param contact Used for searching friends of the given contact
    30    * be generated by SMF factory of some kind
    30    * be generated by SMF factory of some kind
    31    */
    31    */
    32   SmfContactFetcherPrivate::SmfContactFetcherPrivate(SmfContactFetcher* contactFetcher)
    32   SmfContactFetcherPrivate::SmfContactFetcherPrivate(SmfContactFetcher* contactFetcher)
    33   : m_contactFetcher(contactFetcher),m_contactList(0)
    33   : m_contactFetcher(contactFetcher),m_contactList(0)
    34 	  {
    34 	  {
    35 	  //private impl for symbian
    35 		//private impl for symbian
    36 	#ifdef Q_OS_SYMBIAN
    36 		#ifdef Q_OS_SYMBIAN
    37 	m_SmfClientPrivate = CSmfClientSymbian::NewL(this);
    37 		m_SmfClientPrivate = CSmfClientSymbian::NewL(this);
    38 	#endif
    38 		#endif
    39 	  }
    39 	  }
    40   SmfContactFetcherPrivate::~SmfContactFetcherPrivate()
    40   SmfContactFetcherPrivate::~SmfContactFetcherPrivate()
    41 	  {
    41 	  {
    42 
    42 	  if(m_SmfClientPrivate)
       
    43 		  {
       
    44 		  delete m_SmfClientPrivate;
       
    45 		  m_SmfClientPrivate = NULL;
       
    46 		  }
    43 	  }
    47 	  }
    44 
    48 
    45   /**
    49   /**
    46    * Get the friend listing asynchronously. The friendsListAvailable() signal
    50    * Get the friend listing asynchronously. The friendsListAvailable() signal
    47    * is emitted with SmfContactList once data is arrived.
    51    * is emitted with SmfContactList once data is arrived.
    52    */
    56    */
    53   bool  SmfContactFetcherPrivate::friends(int pageNum,int perPage)
    57   bool  SmfContactFetcherPrivate::friends(int pageNum,int perPage)
    54 	  {
    58 	  {
    55 	  m_providerSerialized.clear();
    59 	  m_providerSerialized.clear();
    56 	  //We need to pass Opcode and SmfProvider serialized into bytearray 
    60 	  //We need to pass Opcode and SmfProvider serialized into bytearray 
    57 	  
    61 	  m_xtraInfoFlag = 0;
       
    62 	  m_pageInfoFlag = 1;
    58 	  m_baseProvider = m_contactFetcher->getProvider();
    63 	  m_baseProvider = m_contactFetcher->getProvider();
    59 	  //serialize start
    64 	  //serialize start
    60 	  QDataStream write(&m_providerSerialized,QIODevice::WriteOnly);
    65 	  QDataStream write(&m_providerSerialized,QIODevice::WriteOnly);
    61 	  write<<*(m_baseProvider);
    66 	  write<<*(m_baseProvider);
       
    67 	  write<<m_pageInfoFlag;
       
    68 	  write<<pageNum;
       
    69 	  write<<perPage;
       
    70 	  write<<m_xtraInfoFlag;
    62 	  //serialize end
    71 	  //serialize end
    63 	  
       
    64 	  
       
    65 	  QString intfName(contactFetcherInterface);
    72 	  QString intfName(contactFetcherInterface);
    66 	  
    73 	  int maxAllocation = MaxSmfContactSize*perPage;
    67 	  //call private impl's send method
    74 	  //call private impl's send method
    68 	  m_SmfClientPrivate->sendRequest(m_providerSerialized,intfName,SmfContactGetFriends);
    75 	  m_SmfClientPrivate->sendRequest(m_providerSerialized,intfName,SmfContactGetFriends,maxAllocation,QByteArray());
    69 	  }
    76 	  }
    70 
    77 
    71   /**
    78   /**
    72    * Get the list of followers asynchronously. The followersListAvailable() signal
    79    * Get the list of followers asynchronously. The followersListAvailable() signal
    73    * is emitted with SmfContactList once data is arrived. Please note that some
    80    * is emitted with SmfContactList once data is arrived. Please note that some
    83 	  
    90 	  
    84 	  m_baseProvider = m_contactFetcher->getProvider();
    91 	  m_baseProvider = m_contactFetcher->getProvider();
    85 	  //serialize start
    92 	  //serialize start
    86 	  QDataStream write(&m_providerSerialized,QIODevice::WriteOnly);
    93 	  QDataStream write(&m_providerSerialized,QIODevice::WriteOnly);
    87 	  write<<*(m_baseProvider);
    94 	  write<<*(m_baseProvider);
       
    95 	  m_pageInfoFlag = 1;
       
    96 	  write<<m_pageInfoFlag;
       
    97 	  write<<pageNum;
       
    98 	  write<<perPage;
       
    99 	  m_xtraInfoFlag = 0;
       
   100 	  write<<m_xtraInfoFlag;
    88 	  //serialize end
   101 	  //serialize end
    89 	  
   102 	  
    90 	  
   103 	  
    91 	  QString intfName(contactFetcherInterface);
   104 	  QString intfName(contactFetcherInterface);
    92 	  
   105 	  int maxAllocation = MaxSmfContactSize*perPage;
    93 	  //call private impl's send method
   106 	  //call private impl's send method
    94 	  m_SmfClientPrivate->sendRequest(m_providerSerialized,intfName,SmfContactGetFollowers);
   107 	  m_SmfClientPrivate->sendRequest(m_providerSerialized,intfName,SmfContactGetFollowers,maxAllocation);
    95 	  }
   108 	  }
    96   /**
   109   /**
    97    * Searches for a contact The searchContactFinished() signal
   110    * Searches for a contact The searchContactFinished() signal
    98    * is emitted with SmfContactList once data is arrived.
   111    * is emitted with SmfContactList once data is arrived.
    99    * When the list is big user can specify the page number and per page item data.
   112    * When the list is big user can specify the page number and per page item data.
   104   void  SmfContactFetcherPrivate::search(SmfContact* contact,int pageNum,int perPage) 
   117   void  SmfContactFetcherPrivate::search(SmfContact* contact,int pageNum,int perPage) 
   105 	  {
   118 	  {
   106 	  //We need to pass Opcode and SmfProvider+SmfContact serialized into bytearray 
   119 	  //We need to pass Opcode and SmfProvider+SmfContact serialized into bytearray 
   107 	  
   120 	  
   108 	  m_baseProvider = m_contactFetcher->getProvider();
   121 	  m_baseProvider = m_contactFetcher->getProvider();
       
   122 	  m_xtraInfoSerialized.clear();
   109 	  m_contact = contact;
   123 	  m_contact = contact;
   110 	  //serialize start
   124 	  //serialize start
   111 	  QDataStream write(&m_providerSerialized,QIODevice::WriteOnly);
   125 	  QDataStream write(&m_providerSerialized,QIODevice::WriteOnly);
   112 	  write<<*(m_baseProvider);
   126 	  write<<*(m_baseProvider);
   113 	  //now serialize SmfContact 
   127 	  m_pageInfoFlag = 1;
   114 	  write<<*(m_contact);
   128 	  write<<m_pageInfoFlag;
   115 	  //serialize end
   129 	  write<<pageNum;
   116 	  
   130 	  write<<pageNum;
       
   131 
       
   132 	  
       
   133 	  //serialize xtra info
       
   134 	  QDataStream writeXtra(&m_xtraInfoSerialized,QIODevice::WriteOnly);
       
   135 	  writeXtra<<*(m_contact);
       
   136 	  
       
   137 	  m_xtraInfoFlag = m_xtraInfoSerialized.size();
       
   138 	  write<<m_xtraInfoFlag;
   117 	  
   139 	  
   118 	  QString intfName(contactFetcherInterface);
   140 	  QString intfName(contactFetcherInterface);
   119 	  
   141 	  int maxAllocation = MaxSmfContactSize*perPage;
   120 	  //call private impl's send method
   142 	  //call private impl's send method
   121 	  m_SmfClientPrivate->sendRequest(m_providerSerialized,intfName,SmfContactSearch);
   143 	  m_SmfClientPrivate->sendRequest(m_providerSerialized,intfName,SmfContactSearch,maxAllocation,m_xtraInfoSerialized);
   122 	  }
   144 	  }
   123 
   145 
   124   /**
   146   /**
   125    * Searches for a contacts (friends) who are near the user.
   147    * Searches for a contacts (friends) who are near the user.
   126    * Signal searchNearFinished() is emitted with SmfContactList once data is arrived.
   148    * Signal searchNearFinished() is emitted with SmfContactList once data is arrived.
   128    * When the list is big user can specify the page number and per page item data.
   150    * When the list is big user can specify the page number and per page item data.
   129    * If not supplied by the user default values are used.
   151    * If not supplied by the user default values are used.
   130    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
   152    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
   131    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
   153    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
   132    */
   154    */
   133   //TODO:-implement
   155    bool  SmfContactFetcherPrivate::searchNear(SmfLocation* location,SmfLocationSearchBoundary proximity,int pageNum,int perPage) 
   134 //   bool  SmfContactFetcherPrivate::searchNear(SmfPlace* location,SmfLocationSearchBoundary proximity,int pageNum,int perPage) 
   156 	   {
   135 //	   {
   157 		  m_baseProvider = m_contactFetcher->getProvider();
   136 //	   
   158 		  m_xtraInfoSerialized.clear();
   137 //	   }
   159 		  //serialize start
       
   160 		  QDataStream write(&m_providerSerialized,QIODevice::WriteOnly);
       
   161 		  write<<*(m_baseProvider);
       
   162 		  m_pageInfoFlag = 1;
       
   163 		  write<<m_pageInfoFlag;
       
   164 		  write<<pageNum;
       
   165 		  write<<pageNum;
       
   166 		  //m_xtraInfoFlag = 1;
       
   167 		  //write<<m_xtraInfoFlag;
       
   168 		  
       
   169 		  //serialize xtra info
       
   170 		  QDataStream writeXtra(&m_xtraInfoSerialized,QIODevice::WriteOnly);
       
   171 		  writeXtra<<*(location);
       
   172 		  writeXtra<<proximity;
       
   173 		  m_xtraInfoFlag = m_xtraInfoSerialized.size();
       
   174 		  write<<m_xtraInfoFlag;
       
   175 		  QString intfName(contactFetcherInterface);
       
   176 		  int maxAllocation = MaxSmfContactSize*perPage;
       
   177 		  //call private impl's send method
       
   178 		  m_SmfClientPrivate->sendRequest(m_providerSerialized,intfName,SmfContactSearchNear,maxAllocation,m_xtraInfoSerialized);
       
   179 	   }
   138 
   180 
   139 
   181 
   140   /**
   182   /**
   141    * Get the list of groups. The groupListAvailable() signal
   183    * Get the list of groups. The groupListAvailable() signal
   142    * is emitted with SmfGroupList once data is arrived. False might be returned
   184    * is emitted with SmfGroupList once data is arrived. False might be returned
   152 		  
   194 		  
   153 		  m_baseProvider = m_contactFetcher->getProvider();
   195 		  m_baseProvider = m_contactFetcher->getProvider();
   154 		  //serialize start
   196 		  //serialize start
   155 		  QDataStream write(&m_providerSerialized,QIODevice::WriteOnly);
   197 		  QDataStream write(&m_providerSerialized,QIODevice::WriteOnly);
   156 		  write<<*(m_baseProvider);
   198 		  write<<*(m_baseProvider);
       
   199 		  m_pageInfoFlag = 1;
       
   200 		  write<<m_pageInfoFlag;
       
   201 		  write<<pageNum;
       
   202 		  write<<perPage;
       
   203 		  m_xtraInfoFlag = 0;
       
   204 		  write<<m_xtraInfoFlag;
   157 		  //serialize end
   205 		  //serialize end
   158 		  
   206 		  
   159 		  
   207 		  
   160 		  QString intfName(contactFetcherInterface);
   208 		  QString intfName(contactFetcherInterface);
   161 		  
   209 		  int maxAllocation = MaxSmfGroupSize*perPage;
   162 		  //call private impl's send method
   210 		  //call private impl's send method
   163 		  m_SmfClientPrivate->sendRequest(m_providerSerialized,intfName,SmfContactGetGroups);
   211 		  m_SmfClientPrivate->sendRequest(m_providerSerialized,intfName,SmfContactGetGroups,maxAllocation);
   164 	   }
   212 	   }
   165 
   213 
   166   /**
   214   /**
   167    * Searches for Smf Contacts in an Smf group.
   215    * Searches for Smf Contacts in an Smf group.
   168    * When the list is big user can specify the page number and per page item data.
   216    * When the list is big user can specify the page number and per page item data.
   178 	  m_baseProvider = m_contactFetcher->getProvider();
   226 	  m_baseProvider = m_contactFetcher->getProvider();
   179 	  m_grp = group;
   227 	  m_grp = group;
   180 	  //serialize start
   228 	  //serialize start
   181 	  QDataStream write(&m_providerSerialized,QIODevice::WriteOnly);
   229 	  QDataStream write(&m_providerSerialized,QIODevice::WriteOnly);
   182 	  write<<*(m_baseProvider);
   230 	  write<<*(m_baseProvider);
   183 	  //now serialize SmfGroup 
   231 	  m_pageInfoFlag = 1;
   184 	  write<<m_grp;
   232 	  write<<m_pageInfoFlag;
       
   233 	  write<<pageNum;
       
   234 	  write<<perPage;
       
   235 	  //m_xtraInfoFlag = 1;
       
   236 	  //write<<m_xtraInfoFlag;
       
   237 	  
       
   238 	  //serialize xtra info
       
   239 	  QDataStream writeXtra(&m_xtraInfoSerialized,QIODevice::WriteOnly);
       
   240 	  writeXtra<<m_grp;
       
   241 	  m_xtraInfoFlag = m_xtraInfoSerialized.size();
       
   242 	  write<<m_xtraInfoFlag;
   185 	  //serialize end
   243 	  //serialize end
   186 	  
   244 	  
   187 	  
   245 	  
   188 	  QString intfName(contactFetcherInterface);
   246 	  QString intfName(contactFetcherInterface);
   189 	  
   247 	  int maxAllocation = MaxSmfContactSize*perPage;
   190 	  //call private impl's send method
   248 	  //call private impl's send method
   191 	  m_SmfClientPrivate->sendRequest(m_providerSerialized,intfName,SmfContactSearch);
   249 	  m_SmfClientPrivate->sendRequest(m_providerSerialized,intfName,SmfContactSearchInGroup,maxAllocation);
       
   250 	  return 0;
   192    }
   251    }
   193 
       
   194 
       
   195 void SmfContactFetcherPrivate::resultsAvailable(QByteArray result,SmfRequestTypeID opcode,SmfError error)
   252 void SmfContactFetcherPrivate::resultsAvailable(QByteArray result,SmfRequestTypeID opcode,SmfError error)
   196    	{
   253    	{
   197 	writeLog("SmfContactFetcherPrivate::resultsAvailable");
   254 	writeLog("SmfContactFetcherPrivate::resultsAvailable");
   198 	
       
   199 	//note:- "result" is serialized and we need to de-serialize it as per opcode
       
   200 	//TODO:- order of serialization Error value followed by data
       
   201 	
   255 	
   202    	QDataStream reader(&result,QIODevice::ReadOnly);
   256    	QDataStream reader(&result,QIODevice::ReadOnly);
   203    	
   257    	
   204    	//Now de-serialize it based on opcode
   258    	//Now de-serialize it based on opcode
   205    	switch(opcode)
   259    	switch(opcode)
   206    		{
   260    		{
   207    		case SmfContactGetFriendsComplete:
   261    		case SmfContactGetFriends:
   208    			{
   262    			{
   209 
   263 
   210    			if(m_contactList)
   264    			if(m_contactList)
   211    				{
   265    				{
   212 				delete m_contactList;
   266 				delete m_contactList;
   213 				m_contactList = NULL;
   267 				m_contactList = NULL;
   214    				}
   268    				}
   215    			m_contactList = new SmfContactList;
   269    			m_contactList = new SmfContactList;
   216    			//TODO
       
   217 //   			SmfError error;
       
   218 //   			reader>>error;
       
   219 //   			writeLog("Error=");
       
   220 //   			writeLog(QString::number(error));
       
   221 //   			SmfError err = (SmfError)error;
       
   222    			m_frndist.clear();
   270    			m_frndist.clear();
   223    			reader>>m_frndist;
   271    			reader>>m_frndist;
   224    			writeLog("m_frndist.count=");
   272    			writeLog("m_frndist.count=");
   225    			writeLog(QString::number(m_frndist.count()));
   273    			writeLog(QString::number(m_frndist.count()));
   226    			//not incorporating paging now
   274    			//TODO:-After consulting with PM owner decide page serialization
   227    			SmfResultPage page;
   275    			SmfResultPage page;
   228 
   276 
   229    			emit m_contactFetcher->friendsListAvailable(&m_frndist,SmfNoError,page);
   277    			emit m_contactFetcher->friendsListAvailable(&m_frndist,error,page);
   230    			
   278    			
   231    			}
   279    			}
   232    			break;
   280    			break;
   233    		case SmfContactGetFollowersComplete:
   281    		case SmfContactGetFollowers:
   234    			{
   282    			{
   235    			if(m_contactList)
   283    			if(m_contactList)
   236    				{
   284    				{
   237 				delete m_contactList;
   285 				delete m_contactList;
   238 				m_contactList = NULL;
   286 				m_contactList = NULL;
   239    				}
   287    				}
   240    			m_contactList = new SmfContactList;
   288    			m_contactList = new SmfContactList;
   241    			quint32 error;
       
   242    			reader>>error;
       
   243    			SmfError err = (SmfError)error;
       
   244    			reader>>*(m_contactList);
   289    			reader>>*(m_contactList);
   245    			//not incorporating paging now
   290    			//TODO:-After consulting with PM owner decide page serialization
   246    			SmfResultPage page;
   291    			SmfResultPage page;
   247 
   292 
   248    			emit m_contactFetcher->followersListAvailable(m_contactList,err,page);
   293    			emit m_contactFetcher->followersListAvailable(m_contactList,error,page);
   249 			
   294 			
   250    			}
   295    			}
   251    			break;
   296    			break;
   252    		case SmfContactGetGroupsComplete:
   297    		case SmfContactGetGroups:
   253    			{
   298    			{
   254    			writeLog("Before m_grpList.clear=");
   299    			writeLog("Before m_grpList.clear=");
   255    			m_grpList.clear();
   300    			m_grpList.clear();
   256    			writeLog("Before reader>>m_grpList=");
   301    			writeLog("Before reader>>m_grpList=");
   257    			reader>>m_grpList ;
   302    			reader>>m_grpList ;
   258    			//not incorporating paging now
   303    			/** @TODO:-After consulting with PM owner decide page serialization */
   259    			SmfResultPage page;
   304    			SmfResultPage page;
   260    			writeLog("m_grpList.count=");
   305    			writeLog("m_grpList.count=");
   261    			writeLog(QString::number(m_grpList.count()));
   306    			writeLog(QString::number(m_grpList.count()));
   262    			emit m_contactFetcher->groupListAvailable(&m_grpList,SmfNoError,page);
   307    			emit m_contactFetcher->groupListAvailable(&m_grpList,error,page);
   263    			
   308    			
   264    			}
   309    			}
   265    			break;
   310    			break;
   266    		case SmfContactSearchComplete:
   311    		case SmfContactSearch:
   267    			{
   312    			{
   268    			if(m_contactList)
   313    			if(m_contactList)
   269    				{
   314    				{
   270 				delete m_contactList;
   315 				delete m_contactList;
   271 				m_contactList = NULL;
   316 				m_contactList = NULL;
   272    				}
   317    				}
   273    			m_contactList = new SmfContactList;
   318    			m_contactList = new SmfContactList;
   274    			quint32 error;
       
   275    			reader>>error;
       
   276    			SmfError err = (SmfError)error;
       
   277    			reader>>*(m_contactList);
   319    			reader>>*(m_contactList);
   278    			//not incorporating paging now
   320    			/** @TODO:-After consulting with PM owner decide page serialization */
   279    			SmfResultPage page;
   321    			SmfResultPage page;
   280    			//searchContactFinished
   322    			//searchContactFinished
   281    			emit m_contactFetcher->searchContactFinished(m_contactList,err,page);
   323    			emit m_contactFetcher->searchContactFinished(m_contactList,error,page);
       
   324    			}
       
   325    			break;
       
   326    		case SmfContactSearchNear:
       
   327    			{
       
   328    			if(m_contactList)
       
   329    				{
       
   330 				delete m_contactList;
       
   331 				m_contactList = NULL;
       
   332    				}
       
   333    			m_contactList = new SmfContactList;
       
   334    			reader>>*(m_contactList);
       
   335    			/** @TODO:-After consulting with PM owner decide page serialization*/
       
   336    			SmfResultPage page;
       
   337    			//searchContactFinished
       
   338    			emit m_contactFetcher->searchNearFinished(m_contactList,error,page);
       
   339    			}
       
   340    			break;
       
   341    		case SmfContactSearchInGroup:
       
   342    			{
       
   343    			if(m_contactList)
       
   344    				{
       
   345 				delete m_contactList;
       
   346 				m_contactList = NULL;
       
   347    				}
       
   348    			m_contactList = new SmfContactList;
       
   349    			reader>>*(m_contactList);
       
   350    			//TODO:-After consulting with PM owner decide page serialization
       
   351    			SmfResultPage page;
       
   352    			//searchContactFinished
       
   353    			emit m_contactFetcher->searchInGroupFinished(m_contactList,error,page);
   282    			}
   354    			}
   283    			break;
   355    			break;
   284    		default:
   356    		default:
   285    			writeLog("Before m_grpList.clear=");
   357    			writeLog("!!!!!!!!!!default!!!!!!!!!!!!!!");
   286    			m_grpList.clear();
       
   287    			writeLog("Before reader>>m_grpList=");
       
   288    			reader>>m_grpList ;
       
   289    			//not incorporating paging now
       
   290    			SmfResultPage page;
       
   291    			writeLog("m_grpList.count=");
       
   292    			writeLog(QString::number(m_grpList.count()));
       
   293    			emit m_contactFetcher->groupListAvailable(&m_grpList,SmfNoError,page);
       
   294    		}
   358    		}
   295    	
   359    	
   296    	}
   360    	}
   297 void SmfContactFetcherPrivate::writeLog(QString log) const
   361 void SmfContactFetcherPrivate::writeLog(QString log) const
   298 	{
   362 	{
       
   363 #ifdef WRITE_LOG
   299 	QFile file("c:\\data\\SmfClientLogs.txt");
   364 	QFile file("c:\\data\\SmfClientLogs.txt");
   300     if (!file.open(QIODevice::Append | QIODevice::Text))
   365     if (!file.open(QIODevice::Append | QIODevice::Text))
   301 	         return;
   366 	         return;
   302     QTextStream out(&file);
   367     QTextStream out(&file);
   303     out << log << "\n";
   368     out << log << "\n";
   304     file.close();
   369     file.close();
   305 
   370 #endif
   306 	}
   371 	}
   307 QDataStream &operator<<( QDataStream &aDataStream, 
   372 QDataStream &operator<<( QDataStream &aDataStream, 
   308 		const SmfError &err )
   373 		const SmfError &err )
   309 	{
   374 	{
   310 	quint32 errInt = (quint32)err;
   375 	quint32 errInt = (quint32)err;