/// <summary>注册</summary> /// <returns></returns> public static bool Register(string serverName, string userName, string password) { byte[] bytNew = Encoding.Default.GetBytes(serverName); HTPhoneSDK.htphone_server_config_t t = new HTPhoneSDK.htphone_server_config_t(); t.server_uri = new byte[HTPHONE_MAX_URI_LEN + 1]; Array.Copy(bytNew, t.server_uri, bytNew.Length); byte[] bytUserName = Encoding.Default.GetBytes(userName); byte[] bytPassowrd = Encoding.Default.GetBytes(password); HTPhoneSDK.htphone_user_config_t userConfig = new htphone_user_config_t(); userConfig.username = new byte[HTPHONE_MAX_USERNAME_LEN + 1]; userConfig.password = new byte[HTPHONE_MAX_PASSWORD_LEN + 1]; Array.Copy(bytUserName, userConfig.username, bytUserName.Length); Array.Copy(bytPassowrd, userConfig.password, bytPassowrd.Length); //return htphone_register(null ,null) == 0; return htphone_register(ref t, ref userConfig) == 0; }
private static extern int htphone_register(ref htphone_server_config_t new_server_config, ref htphone_user_config_t new_user_config);
/// <summary>用户配置</summary> /// <param name="uri"></param> /// <returns></returns> public static bool SetUserConfig(string userName, string password) { byte[] bytUserName = Encoding.Default.GetBytes(userName); byte[] bytPassowrd = Encoding.Default.GetBytes(password); HTPhoneSDK.htphone_user_config_t userConfig = new htphone_user_config_t(); userConfig.username = new byte[HTPHONE_MAX_USERNAME_LEN + 1]; userConfig.password = new byte[HTPHONE_MAX_PASSWORD_LEN + 1]; Array.Copy(bytUserName, userConfig.username, bytUserName.Length); Array.Copy(bytPassowrd, userConfig.password, bytPassowrd.Length); return htphone_set_user_config(ref userConfig) == 0; }
private static extern int htphone_set_user_config(ref htphone_user_config_t config);